Added visual-execute

- (visual)Enter to run the selected text as a vim command
- (visual)C+Enter to run the selected text with g:exe_prg
- g:exe_prg should be defined in a local vimrc
This commit is contained in:
Talia 2018-03-07 12:44:04 +01:00
parent 05c6716944
commit c17d5895e6
1 changed files with 8 additions and 2 deletions

10
vimrc
View File

@ -371,8 +371,8 @@ command! -nargs=? Scratch new | set buftype=nofile | set filetype=<args>
let mapleader = "\\"
let g:jmp_dist = 8
nmap <C-j> :exec "normal ".g:jmp_dist."j"<CR>
nmap <C-k> :exec "normal ".g:jmp_dist."k"<CR>
map <C-j> :exec "normal ".g:jmp_dist."j"<CR>
map <C-k> :exec "normal ".g:jmp_dist."k"<CR>
" Yes, not 'noremap', do whatever is mapped to J and K assuming
" it is some sort of custom up-down motion, but g:jmp_dist times
@ -402,6 +402,12 @@ noremap gk k
" --- CLIPBOARD ---
nnoremap Y y$
" --- VISUAL EXECUTE ---
vnoremap <C-CR> :<C-U>exec "'<,'>!".g:exe_prg<CR>
vnoremap <CR> ""y<CR>
\ :call setreg("\"", substitute(getreg("\""), "\n", "", ""), "v")<CR>
\ :<C-r>"<CR>`<
" --- OTHER ---
" Don't exit visual mode when "shifting"
vnoremap < <gv