Vim shell: Difference between revisions
From wikinotes
(Created page with "You can interact with the commandline from vim's command mode. = Piping to Commandline = <blockquote> <source lang="vim"> :w !sh " execute the current file using /bin/sh :w !less " pipe entire file to less :'<,'>!less " pipe visual-selection to less system('xclip', @") " pipe register '@"' to xclip executable's stdin " pipe register '@"' to xclip (preserving NULLs if binary data) let formatted = getreg('r', 0, 1) + (getregtype('r') isnot# 'v' ? [''] : [])...") |
|||
Line 8: | Line 8: | ||
:'<,'>!less " pipe visual-selection to less | :'<,'>!less " pipe visual-selection to less | ||
" pipe register '@+' to xclip executable's stdin | |||
system('xclip', @+) | |||
" pipe register '@ | " pipe register '@+' to xclip (preserving NULLs if binary data) | ||
let formatted = getreg(' | let formatted = getreg('+', 0, 1) + (getregtype('+') isnot# 'v' ? [''] : []) | ||
call system('some_command', formatted) | call system('some_command', formatted) | ||
</source> | </source> | ||
</blockquote><!-- piping to commandline --> | </blockquote><!-- piping to commandline --> |
Latest revision as of 15:51, 10 February 2024
You can interact with the commandline from vim's command mode.
Piping to Commandline
:w !sh " execute the current file using /bin/sh :w !less " pipe entire file to less :'<,'>!less " pipe visual-selection to less " pipe register '@+' to xclip executable's stdin system('xclip', @+) " pipe register '@+' to xclip (preserving NULLs if binary data) let formatted = getreg('+', 0, 1) + (getregtype('+') isnot# 'v' ? [''] : []) call system('some_command', formatted)