Created
December 16, 2013 16:34
-
-
Save gimKondo/7989969 to your computer and use it in GitHub Desktop.
substitute text that selected on visual-mode without overriding register
bug: multibyte charactor on line-end cannot be judged well
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! Put_text_without_override_register() | |
let line_len = strlen(getline('.')) | |
execute "normal! `>" | |
let col_loc = col('.') | |
execute 'normal! gv"_x' | |
if line_len == col_loc | |
execute 'normal! p' | |
else | |
execute 'normal! P' | |
endif | |
endfunction | |
xnoremap <silent> p :call Put_text_without_override_register()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment