diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-08-09 21:10:31 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-08-09 21:10:31 +0800 |
| commit | 9b7283a567f350c8f4776a57945c91c3847c9866 (patch) | |
| tree | ae49875db4aad0234a17baccef5152a410ae66b8 | |
| parent | a178d143fa3060822365665f15ad5b2d7950313c (diff) | |
Update
| -rw-r--r-- | alias | 1 | ||||
| -rw-r--r-- | bin/gpt/shellrc | 2 | ||||
| -rw-r--r-- | vim/after/syntax/basic.vim | 2 | ||||
| -rw-r--r-- | vim/init.vim | 2 | ||||
| -rw-r--r-- | vim/init/config.vim | 1 | ||||
| -rw-r--r-- | vim/init/keymaps.vim | 15 | ||||
| -rw-r--r-- | vim/mini.lua | 36 |
7 files changed, 33 insertions, 26 deletions
| @@ -134,6 +134,7 @@ alias k='kill %1' | |||
| 134 | alias s='sudo systemctl' | 134 | alias s='sudo systemctl' |
| 135 | alias j='sudo journalctl -xeu' | 135 | alias j='sudo journalctl -xeu' |
| 136 | alias m='mutt' | 136 | alias m='mutt' |
| 137 | alias h='himalaya' | ||
| 137 | alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail" | 138 | alias gmail="mutt -F $SETTING_DIR/mutt/muttrc.gmail" |
| 138 | alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041" | 139 | alias ntu="mutt -F $SETTING_DIR/mutt/muttrc.b97602041" |
| 139 | path() { echo $PATH; } # Should not use alias, because $PATH is not initialized | 140 | path() { echo $PATH; } # Should not use alias, because $PATH is not initialized |
diff --git a/bin/gpt/shellrc b/bin/gpt/shellrc index eeeec5d..d7fcb61 100644 --- a/bin/gpt/shellrc +++ b/bin/gpt/shellrc | |||
| @@ -4,7 +4,7 @@ gptt() { | |||
| 4 | vim $file && cat $file | gpt --skip | 4 | vim $file && cat $file | gpt --skip |
| 5 | } | 5 | } |
| 6 | # Ask GPT what's wrong with the last command | 6 | # Ask GPT what's wrong with the last command |
| 7 | h() { | 7 | gpth() { |
| 8 | printf '%s\n\n%s' "$(fc -s 2>&1 >/dev/null)" "Tell me what's wrong with the command above" | \ | 8 | printf '%s\n\n%s' "$(fc -s 2>&1 >/dev/null)" "Tell me what's wrong with the command above" | \ |
| 9 | gpt --skip | 9 | gpt --skip |
| 10 | } | 10 | } |
diff --git a/vim/after/syntax/basic.vim b/vim/after/syntax/basic.vim new file mode 100644 index 0000000..db3d6b4 --- /dev/null +++ b/vim/after/syntax/basic.vim | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | hi CursorLine guibg=NONE | ||
| 2 | hi CursorLineNr term=bold cterm=bold ctermfg=226 gui=bold guifg=#eeee00 | ||
diff --git a/vim/init.vim b/vim/init.vim index ef303c3..ad434c4 100644 --- a/vim/init.vim +++ b/vim/init.vim | |||
| @@ -28,5 +28,3 @@ else | |||
| 28 | LoadScript init/plugins.vim | 28 | LoadScript init/plugins.vim |
| 29 | LoadScript init/style.vim | 29 | LoadScript init/style.vim |
| 30 | endif | 30 | endif |
| 31 | |||
| 32 | highlight CursorLineNr term=bold cterm=bold ctermfg=226 gui=bold guifg=#eeee00 | ||
diff --git a/vim/init/config.vim b/vim/init/config.vim index 281caf5..8c75de9 100644 --- a/vim/init/config.vim +++ b/vim/init/config.vim | |||
| @@ -24,6 +24,7 @@ augroup TerminalSize | |||
| 24 | endif | 24 | endif |
| 25 | endfunc | 25 | endfunc |
| 26 | autocmd VimEnter,VimResized * silent call LayoutForSmallTerminal(20) | 26 | autocmd VimEnter,VimResized * silent call LayoutForSmallTerminal(20) |
| 27 | autocmd VimLeave * if g:alacritty_extra_padding | call ToggleWinPadding() | endif | ||
| 27 | augroup END | 28 | augroup END |
| 28 | 29 | ||
| 29 | " }}} | 30 | " }}} |
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index 01726b9..a28ce09 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim | |||
| @@ -475,14 +475,13 @@ function! CloseBufferSafely() | |||
| 475 | " Ask Saving | 475 | " Ask Saving |
| 476 | if &modified | 476 | if &modified |
| 477 | let answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") | 477 | let answer = confirm("Save changes?", "&Yes\n&No\n&Cancel") |
| 478 | if answer == 1 | write | endif | 478 | if answer == 1 | call s:WriteOrEnterFileName() | endif |
| 479 | if answer == 2 && empty(bufname()) | bd! | return | endif | ||
| 480 | if answer == 3 | return | endif | 479 | if answer == 3 | return | endif |
| 481 | if answer == "" | return | endif | 480 | if answer == "" | return | endif |
| 482 | endif | 481 | endif |
| 483 | 482 | ||
| 484 | let bufnr = bufnr() | 483 | let bufnr = bufnr() |
| 485 | if len(t:bufs) == 1 | 484 | if !has_key(t:, 'bufs') || len(t:bufs) == 1 |
| 486 | " Close tab for last buffer | 485 | " Close tab for last buffer |
| 487 | tabclose | 486 | tabclose |
| 488 | else | 487 | else |
| @@ -491,11 +490,14 @@ function! CloseBufferSafely() | |||
| 491 | exe "b "..next_buf | 490 | exe "b "..next_buf |
| 492 | call filter(t:bufs, 'v:val != '..bufnr) | 491 | call filter(t:bufs, 'v:val != '..bufnr) |
| 493 | endif | 492 | endif |
| 493 | |||
| 494 | " Remove unnamed buffer | ||
| 495 | if empty(bufname(bufnr)) | silent! exe 'bd! '.bufnr | endif | ||
| 494 | endfunction | 496 | endfunction |
| 495 | function! Bye() | 497 | function! Bye() |
| 496 | let windows = gettabinfo(tabpagenr())[0]['windows'] | 498 | let windows = gettabinfo(tabpagenr())[0]['windows'] |
| 497 | 499 | ||
| 498 | if len(t:bufs) <= 1 && len(windows) == 1 | 500 | if len(gettabinfo()) == 1 && len(t:bufs) <= 1 && len(windows) == 1 |
| 499 | call QuitWithCheck() | 501 | call QuitWithCheck() |
| 500 | elseif &diff | 502 | elseif &diff |
| 501 | silent call CloseBuffersForDiff() | 503 | silent call CloseBuffersForDiff() |
| @@ -630,12 +632,13 @@ function! ToggleWinPadding() | |||
| 630 | else | 632 | else |
| 631 | redir => output | hi LineNr | redir END | 633 | redir => output | hi LineNr | redir END |
| 632 | let bg_color = matchstr(output, 'guibg=\zs[^\s]\+\ze') | 634 | let bg_color = matchstr(output, 'guibg=\zs[^\s]\+\ze') |
| 635 | if empty(bg_color) | let bg_color = "#14161b" | endif | ||
| 633 | 636 | ||
| 634 | try | 637 | try |
| 635 | exe "hi EndOfBuffer guifg="..bg_color.." guibg="..bg_color | 638 | exe "hi EndOfBuffer guifg="..bg_color.." guibg="..bg_color |
| 636 | exe "hi MsgArea guibg="..bg_color | 639 | exe "hi MsgArea guibg="..bg_color |
| 637 | endtry | 640 | endtry |
| 638 | exe "!alacritty msg config --window-id $WINDOWID window.padding.x=300 'colors.primary.background=\"\\"..bg_color.."\"'" | 641 | exe "!alacritty msg config --window-id $WINDOWID window.padding.x=270 'colors.primary.background=\"\\"..bg_color.."\"'" |
| 639 | endif | 642 | endif |
| 640 | 643 | ||
| 641 | let g:alacritty_extra_padding = !g:alacritty_extra_padding | 644 | let g:alacritty_extra_padding = !g:alacritty_extra_padding |
| @@ -706,7 +709,7 @@ nnoremap <leader>cp :cp<CR> | |||
| 706 | nnoremap <leader>cw :cw 10<CR> | 709 | nnoremap <leader>cw :cw 10<CR> |
| 707 | 710 | ||
| 708 | " }}} | 711 | " }}} |
| 709 | " REDIRECTION_WITH_BUFFER {{{ | 712 | " REDIRECTION {{{ |
| 710 | 713 | ||
| 711 | " Usage: | 714 | " Usage: |
| 712 | " :Redir hi ............. show the full output of command ':hi' in a scratch window | 715 | " :Redir hi ............. show the full output of command ':hi' in a scratch window |
diff --git a/vim/mini.lua b/vim/mini.lua index 398ebb4..ff1a3fe 100644 --- a/vim/mini.lua +++ b/vim/mini.lua | |||
| @@ -152,9 +152,7 @@ end, { buffer = bufnr, desc = "Toggle diff" }) | |||
| 152 | -- }}} | 152 | -- }}} |
| 153 | -- mini.map {{{ | 153 | -- mini.map {{{ |
| 154 | require("mini.map").setup() | 154 | require("mini.map").setup() |
| 155 | vim.keymap.set("n", "\\m", function() | 155 | vim.keymap.set("n", "\\M", function() require("mini.map").toggle() end, { desc = "Minimap", buffer = bufnr }) |
| 156 | require("mini.map").toggle() | ||
| 157 | end, { desc = "Minimap", buffer = bufnr }) | ||
| 158 | -- }}} | 156 | -- }}} |
| 159 | -- mini.visits {{{ | 157 | -- mini.visits {{{ |
| 160 | 158 | ||
| @@ -971,20 +969,24 @@ require("lazy").setup({ | |||
| 971 | end, | 969 | end, |
| 972 | }, | 970 | }, |
| 973 | -- }}} | 971 | -- }}} |
| 974 | -- -- markview.nvim {{{ | 972 | -- markview.nvim {{{ |
| 975 | -- { | 973 | { |
| 976 | -- "OXY2DEV/markview.nvim", | 974 | "OXY2DEV/markview.nvim", |
| 977 | -- enable = false, | 975 | lazy = false, |
| 978 | -- ft = "markdown", | 976 | ft = "markdown", |
| 979 | -- | 977 | |
| 980 | -- dependencies = { | 978 | dependencies = { |
| 981 | -- -- You may not need this if you don't lazy load | 979 | -- You may not need this if you don't lazy load |
| 982 | -- -- Or if the parsers are in your $RUNTIMEPATH | 980 | -- Or if the parsers are in your $RUNTIMEPATH |
| 983 | -- "nvim-treesitter/nvim-treesitter", | 981 | "nvim-treesitter/nvim-treesitter", |
| 984 | -- | 982 | |
| 985 | -- "nvim-tree/nvim-web-devicons" | 983 | "nvim-tree/nvim-web-devicons" |
| 986 | -- }, | 984 | }, |
| 987 | -- },-- }}} | 985 | config = function() |
| 986 | vim.keymap.set( 'n', '\\m', ":Markview<CR>", { buffer = bufnr, desc = '' }) | ||
| 987 | end | ||
| 988 | }, | ||
| 989 | -- }}} | ||
| 988 | 990 | ||
| 989 | -- lspconfig {{{ | 991 | -- lspconfig {{{ |
| 990 | -- Use :help lspconfig-all to check servers | 992 | -- Use :help lspconfig-all to check servers |