From ea39a52497685c4f6ca89a467fc88c63a6d86bd3 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Wed, 17 Jul 2024 20:56:34 +0800 Subject: Update --- vim/init/keymaps.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'vim/init') diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index aefb337..82c3c07 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim @@ -50,7 +50,7 @@ map pp :setlocal paste! " Copy from system clipboard nnoremap P :r !xsel -ob -vnoremap Y :w !xsel -ib +vnoremap Y "+y " Move one line up and down nnoremap ddp @@ -81,6 +81,8 @@ nnoremap S [s " Show full path by default nnoremap 1 +nnoremap S S + " Translate by Google API vnoremap Tz :!trans -t zh-TW -b vnoremap Te :!trans -t en-US -b @@ -478,14 +480,14 @@ vnoremap ` ``>la` vnoremap Q ``>la」 function! AddSpaceForSelection() - if line("'<") == line("'>") + if line("'<") != line("'>") || (col("'<") == 1 && col("'>") == len(getline('.'))+1) + '< norm! O + '> norm! o + else call cursor('.', col("'<")) execute "norm! i\" call cursor('.', col("'>")+1) execute "norm! a\" - else - '< norm! O - '> norm! o endif endfunction vnoremap :call AddSpaceForSelection() -- cgit v1.2.3-70-g09d2