commit af6d6f4b6b54c10319042e91c36d4b6fc0156a65 parent d8af34ab6fdbde92107e4d44f7391e4460fb3c25 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Wed, 7 Aug 2019 18:00:07 +0200 vim: run visually selected text as vim commands Former-commit-id: 9eae6b28b96a8f1b7f8c304ab3cf278343901ad7 Diffstat:
M | vim/plugin/strip_trailing_whitespace.vim | | | 7 | ------- |
A | vim/plugin/visualrun.vim | | | 5 | +++++ |
M | vim/vimrc | | | 3 | +++ |
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/vim/plugin/strip_trailing_whitespace.vim b/vim/plugin/strip_trailing_whitespace.vim @@ -1,10 +1,3 @@ -" function s:StripTrailingWhitespace() -" if !&binary && &filetype != 'diff' -" normal m` -" %s/\s\+$//e -" normal `` -" endif -" endfunction function s:StripTrailingWhitespace() if &filetype != 'diff' normal m` diff --git a/vim/plugin/visualrun.vim b/vim/plugin/visualrun.vim @@ -0,0 +1,5 @@ +function s:RunCommands() + exe getline('.') +endfunction +map <Plug>VisualRunCommands + \ :call <SID>RunCommands()<CR> diff --git a/vim/vimrc b/vim/vimrc @@ -643,6 +643,9 @@ nnoremap <leader>f :Lexplore<CR> " Strip trailing whitespace nmap <leader>$ <Plug>StripTrailingWhitespace +" Run selected commands +vmap <leader><CR> <Plug>VisualRunCommands + nnoremap H :bprevious<CR> nnoremap L :bnext<CR>