From c17d5895e64bc50498993f91e1bafd373417c528 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 7 Mar 2018 12:44:04 +0100 Subject: [PATCH] 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 --- vimrc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index 4d01ded..b20b578 100644 --- a/vimrc +++ b/vimrc @@ -371,8 +371,8 @@ command! -nargs=? Scratch new | set buftype=nofile | set filetype= let mapleader = "\\" let g:jmp_dist = 8 -nmap :exec "normal ".g:jmp_dist."j" -nmap :exec "normal ".g:jmp_dist."k" +map :exec "normal ".g:jmp_dist."j" +map :exec "normal ".g:jmp_dist."k" " 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 :exec "'<,'>!".g:exe_prg +vnoremap ""y + \ :call setreg("\"", substitute(getreg("\""), "\n", "", ""), "v") + \ :"`< + " --- OTHER --- " Don't exit visual mode when "shifting" vnoremap <