diff options
| author | nsfisis <nsfisis@gmail.com> | 2020-09-28 01:50:14 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2020-09-28 01:50:14 +0900 |
| commit | 58920da73489a5a4da37d4082aee4b762983c402 (patch) | |
| tree | 1dc13427926ae1d9e90c46f5593906163f98c56d | |
| parent | 7b2324d80fb6bb3606e4f27229dd91133f53805f (diff) | |
| download | dotfiles-58920da73489a5a4da37d4082aee4b762983c402.tar.gz dotfiles-58920da73489a5a4da37d4082aee4b762983c402.tar.zst dotfiles-58920da73489a5a4da37d4082aee4b762983c402.zip | |
Update .vimrc: simplify :Reverse
| -rw-r--r-- | .vimrc | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -1067,20 +1067,13 @@ command! -bang -bar -nargs=* \ make<bang> <args> -" The current search pattern will not changed by :global in a user function. -" See :Reverse's comment below. -function! s:reverse_lines(from, to) abort - execute printf("%d,%dg/^/m%d", a:from, a:to, a:from - 1) -endfunction - " Reverse a selected range in line-wise. " Note: directly calling `g/^/m` will overwrite the current search pattern with " '^' and highlight it, which is not expected. -" :h autocmd-searchpat -" :h :nohlsearch +" :h :keeppatterns command! -bar -range=% \ Reverse - \ call <SID>reverse_lines(<line1>, <line2>) + \ keeppatterns <line1>,<line2>g/^/m<line1>-1 |
