aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init/keymaps.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/init/keymaps.vim')
-rw-r--r--vim/init/keymaps.vim15
1 files changed, 9 insertions, 6 deletions
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
494endfunction 496endfunction
495function! Bye() 497function! 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>
706nnoremap <leader>cw :cw 10<CR> 709nnoremap <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