diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-07-03 16:11:32 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-07-03 16:11:32 +0800 |
| commit | 31664bc6bd1f666f4ea6f9ae5b583bb8d18b69d2 (patch) | |
| tree | 90e7685126b175376f8eecd153fe01653b4beb07 | |
| parent | 0bed649a238b300f7b960d52d161cbb0adc717af (diff) | |
Update
| -rw-r--r-- | vim/init/basic.vim | 4 | ||||
| -rw-r--r-- | vim/init/config.vim | 7 | ||||
| -rw-r--r-- | vim/init/keymaps.vim | 12 | ||||
| -rw-r--r-- | vim/lua/chadrc.lua | 9 |
4 files changed, 15 insertions, 17 deletions
diff --git a/vim/init/basic.vim b/vim/init/basic.vim index b74f988..945c134 100644 --- a/vim/init/basic.vim +++ b/vim/init/basic.vim | |||
| @@ -113,10 +113,6 @@ nnoremap gl :call ToggleQuit()<CR> | |||
| 113 | " Simply exit when closing the last buffer | 113 | " Simply exit when closing the last buffer |
| 114 | 114 | ||
| 115 | function! Bye() | 115 | function! Bye() |
| 116 | let specialFileTypes = ['help', 'netrw', 'vim-plug', 'nerdtree'] | ||
| 117 | let bufIsSpecial = index(specialFileTypes, &filetype) != -1 | ||
| 118 | let bufInMultipleWindow = len(getbufinfo(bufnr())[0].windows) > 1 | ||
| 119 | |||
| 120 | if len(getbufinfo({'buflisted': 1})) == 1 && len(getwininfo()) == 1 | 116 | if len(getbufinfo({'buflisted': 1})) == 1 && len(getwininfo()) == 1 |
| 121 | if g:quitVimWhenPressingCtrlC | 117 | if g:quitVimWhenPressingCtrlC |
| 122 | :silent! quit | 118 | :silent! quit |
diff --git a/vim/init/config.vim b/vim/init/config.vim index f15c5a8..39f1c12 100644 --- a/vim/init/config.vim +++ b/vim/init/config.vim | |||
| @@ -7,6 +7,13 @@ | |||
| 7 | " | 7 | " |
| 8 | "====================================================================== | 8 | "====================================================================== |
| 9 | 9 | ||
| 10 | "---------------------------------------------------------------------- | ||
| 11 | " | ||
| 12 | "---------------------------------------------------------------------- | ||
| 13 | augroup LeavingBuffer! | ||
| 14 | au BufLeave {} if getline(1, '$') == [''] | setlocal bufhidden=wipe | endif | ||
| 15 | augroup END | ||
| 16 | |||
| 10 | 17 | ||
| 11 | "---------------------------------------------------------------------- | 18 | "---------------------------------------------------------------------- |
| 12 | " 有 tmux 何没有的功能键超时(毫秒) | 19 | " 有 tmux 何没有的功能键超时(毫秒) |
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index e4bdfd4..504d071 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim | |||
| @@ -289,11 +289,11 @@ vnoremap Q <ESC>`<i「<ESC>`>la」<ESC> | |||
| 289 | " :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window | 289 | " :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window |
| 290 | " | 290 | " |
| 291 | function! Redir(cmd) | 291 | function! Redir(cmd) |
| 292 | for win in range(1, winnr('$')) | 292 | " for win in range(1, winnr('$')) |
| 293 | if getwinvar(win, 'scratch') | 293 | " if getwinvar(win, 'scratch') |
| 294 | execute win . 'windo close' | 294 | " execute win . 'windo close' |
| 295 | endif | 295 | " endif |
| 296 | endfor | 296 | " endfor |
| 297 | if a:cmd =~ '^!' | 297 | if a:cmd =~ '^!' |
| 298 | let output = system(matchstr(a:cmd, '^!\zs.*')) | 298 | let output = system(matchstr(a:cmd, '^!\zs.*')) |
| 299 | else | 299 | else |
| @@ -308,7 +308,7 @@ function! Redir(cmd) | |||
| 308 | endfunction | 308 | endfunction |
| 309 | 309 | ||
| 310 | command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) | 310 | command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) |
| 311 | nnoremap <leader>rr :Redir | 311 | nnoremap <leader>rr :Redir<space> |
| 312 | 312 | ||
| 313 | 313 | ||
| 314 | "---------------------------------------------------------------------- | 314 | "---------------------------------------------------------------------- |
diff --git a/vim/lua/chadrc.lua b/vim/lua/chadrc.lua index aa9a78c..4efa204 100644 --- a/vim/lua/chadrc.lua +++ b/vim/lua/chadrc.lua | |||
| @@ -13,19 +13,14 @@ M.ui = { | |||
| 13 | -- }, | 13 | -- }, |
| 14 | tabufline = { | 14 | tabufline = { |
| 15 | enabled = true, | 15 | enabled = true, |
| 16 | order = { "treeOffset", "buffers", "tabs" }, | ||
| 16 | }, | 17 | }, |
| 17 | } | 18 | } |
| 18 | 19 | ||
| 19 | -- For tabufline | 20 | -- For tabufline |
| 20 | if M.ui.tabufline.enabled then | 21 | if M.ui.tabufline.enabled then |
| 21 | vim.keymap.set("n", "<C-c>", function() | 22 | vim.keymap.set("n", "<C-c>", function() |
| 22 | local bufnrs = vim.tbl_filter(function(b) | 23 | local bufnrs = vim.tbl_filter(function(b) return 1 == vim.fn.buflisted(b) end, vim.api.nvim_list_bufs()) |
| 23 | if 1 ~= vim.fn.buflisted(b) then | ||
| 24 | return false | ||
| 25 | else | ||
| 26 | return true | ||
| 27 | end | ||
| 28 | end, vim.api.nvim_list_bufs()) | ||
| 29 | if #bufnrs == 1 then | 24 | if #bufnrs == 1 then |
| 30 | vim.cmd("silent quit!") | 25 | vim.cmd("silent quit!") |
| 31 | else | 26 | else |