Created
January 1, 2024 05:56
-
-
Save Janik-Haag/ee03294370e58bd3d670a4b81f3994f6 to your computer and use it in GitHub Desktop.
this makes <leader>sh append the stdout of a command to your cursosrs position in normal mode and replaces your selection in visual mode.
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 GetShellInput() | |
call inputsave() | |
let in = system(input('sh: ')) | return (substitute(in, '\n$', ''', ''')) | |
call inputrestore() | |
endfunction | |
nnoremap <leader>sh :exec 'normal a' . call("GetShellInput",[])<CR> | |
vnoremap <leader>sh c<C-R>=call("GetShellInput",[])<CR><ESC> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment