Merge branch 'main' into wsl-ubuntu

- conflicted : config.fish
	- moved interactive functions
	- add $LESS
	- add custom history
This commit is contained in:
qwjyh 2022-10-17 19:03:03 +09:00
commit e27916a8ee
9 changed files with 138 additions and 8 deletions

View file

@ -26,8 +26,15 @@ Install-Module -Name posh-git
Write-Output "Pscx"
Install-Module -Name Pscx -AllowPrerelease
Write-Output "z"
Install-Module -Name z
Install-Module -Name ZLocation
Write-Output "PSFzf"
Install-Module -Name PSFzf -RequiredVersion 2.5.10
Write-Output "Latest PSReadLine"
Install-Module -Name PSReadLine -Force # Override default version to get the latest one
Write-Output "CompletionPredictor"
Install-Module -Name CompletionPredictor
# install scoop
if(!(Get-Command scoop -ErrorAction SilentlyContinue)) {
@ -42,7 +49,9 @@ scoop import .\bin\scoop_apps\scoop_minimal_apps.json
# make symbolic links
# neovim
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.vim -Target (Resolve-Path .\dotfiles\neovim\init.vim) -Force
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.lua -Target (Resolve-Path .\dotfiles\neovim\init.lua) -Force
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\plugins.lua -Target (Resolve-Path .\dotfiles\neovim\lua\plugins.lua) -Force
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lualine_setup.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lualine_setup.lua) -Force
# pwsh
New-Item -ItemType SymbolicLink -Path $PROFILE -Target (Resolve-Path .\dotfiles\pwsh\powershell_profile.ps1) -Force
New-Item -ItemType SymbolicLink -Path ~\.config\powershell\chezmoi_completion.ps1 -Target (Resolve-Path .\dotfiles\pwsh\chezmoi_completion.ps1) -Force

View file

@ -0,0 +1,25 @@
; extra key remaps
; mainly for inputting special characters
; Play/Pause
;sc121::
; Send {Media_Play_Pause}
; return
;
; Henkan/Muhenkan + - -> en, em dash
vk1D & vkBD::
Send {U+2013} ; en dash
return
vk1C & vkBD::
Send {U+2014} ; em dash
return
; Henkan/Muhenkan + {Space} -> ZWSP, ZWJ
vk1D & Space::
Send {U+200B} ; ZWSP
return
vk1C & Space::
Send {U+200D} ; ZWJ
return

View file

@ -57,6 +57,9 @@ vk1C & d::
Send,{Blind}{PgDn}
return
; ==========================================
; include extra key remaps
#Include extra_remaps.ahk
; ==========================================
; HankakuZenkaku to esc

View file

@ -2,6 +2,21 @@
# bass source ~/.bashrc
if status is-interactive
# starship
starship init fish | source
function set_win_title
echo -ne "\033]0; (basename "$PWD") \007"
end
set starship_precmd_uesr_func "set_win_title"
# keychain
set -x SHELL fish
keychain --eval --quiet -Q id_rsa, id_ed25519 | source
set -x SHELL bash
# opam
source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true
end
# starship
@ -27,3 +42,11 @@ bind \b backward-kill-word
# env
set -x LESS '-i -r -M -R -S -W -z-4 -x4'
# save fish log to my custom file
set -gx my_fish_history "$HOME/my_fish_history.txt"
function save_myhistory --on-event fish_prompt -d "Save custom shell log to $my_fish_history"
set -l prev_status $status
echo "$(date '+%Y-%m-%d %H:%M:%S') $hostname:$fish_pid $PWD [$prev_status] $(history -1)" \
>> $my_fish_history
end

View file

@ -4,7 +4,8 @@
vim.o.number = true
vim.o.relativenumber = true
vim.cmd([[
highlight LineNr cterm=none ctermfg=256
highlight LineNr cterm=none ctermfg=243
highlight CursorLineNr cterm=none ctermfg=250
]])
vim.o.tabstop = 4
vim.o.shiftwidth = 4
@ -139,3 +140,13 @@ cmp.setup({
vim.api.nvim_set_keymap('n', '<c-P>',
"<cmd>lua require('fzf-lua').files()<CR>",
{ noremap = true, silent = true })
-----------------------------------------------------------
-- lualine
require('lualine_setup')
lualine = require('lualine')
lualine.setup({
options = { theme = 'iceberg_dark' }
})
lualine.setup()

View file

@ -0,0 +1,40 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '|', right = '|'},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View file

@ -9,6 +9,12 @@ return require('packer').startup(function(use)
--requires = { 'kyazdan142/nvim-web/devicons' } -- not found
}
-- lualine(statusline)
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
-- LSP
use 'neovim/nvim-lspconfig'
use "williamboman/mason.nvim"

View file

@ -2,6 +2,7 @@
some notable features
## Key-Bindings
- `F2` to toggle InlineView and ListView of predictions
- tab completion like fish
- `Ctrl + D` to exit
- `Ctrl + G` to Invoke-FzfTabCompletion
@ -31,4 +32,4 @@ Especially useful for piping into linux commands like `less`
- chezmoi
- git
- winget
- chocolatey
- chocolatey

View file

@ -1,14 +1,19 @@
# ==============================================================
# PSReadLine Settings
# ==============================================================
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Import-Module PSReadLine # >= 2.2.2
Import-Module CompletionPredictor
Set-PSReadLineOption -EditMode Windows
Set-PSReadLineOption -PredictionSource HistoryAndPlugin # require PowerShell ≧ 7.2 and PSReadLine ≧ 2.2.2
Set-PSReadlineOption -HistoryNoDuplicates
Set-PSReadLineOption -DingTone 880 # beep frequency
Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord # like fish
Set-PSReadLineKeyHandler -Chord "Ctrl+u" -Function BackwardKillInput # like emacs
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory # like emacs
Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory # like emacs
Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function AcceptSuggestion # like fish
Set-PSReadLineKeyHandler -Chord "Tab" MenuComplete
Set-PSReadLineKeyHandler -Chord "Ctrl+d" DeleteCharOrExit
Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion }
Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion } -BriefDescription "Fzf tab completion" -Description "Invoke fzf tab completion. Need some input first."
# PsFzf Options
# 'Ctrl+t' for provider path, 'Ctrl+r' for reverse history
@ -26,9 +31,16 @@ Set-Alias whereis where.exe
# starship
# change window name
# save my history
$My_Pwsh_History = "$HOME\my_pwsh_history.txt"
function Invoke-Starship-PreCommand {
# window title
$ParentFolder = Split-Path $PWD -Leaf
$host.ui.Write("`e]0; $ParentFolder `a")
# save log
Write-Output "$(Get-Date -UFormat '+%Y-%m-%d %H:%M:%S') $env:COMPUTERNAME`:$PID [$Global:LASTEXITCODE] $(Get-History -Count 1)"
| Out-File -FilePath $My_Pwsh_History -Append -Encoding utf8
}
Invoke-Expression (&starship init powershell)
$ENV:STARSHIP_CONFIG = "$HOME\.config\starship.toml"