Skip to content

Instantly share code, notes, and snippets.

@Integralist
Forked from sjl/ext.vim
Last active February 11, 2019 10:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Integralist/da169871910f4b55c0ac to your computer and use it in GitHub Desktop.
Save Integralist/da169871910f4b55c0ac to your computer and use it in GitHub Desktop.
Some basic examples of executing external commands within Vim's COMMAND-LINE mode
" run command
" no stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
:!uptime
" run command
" pipe range of text to command on stdin
" output replaces the range in the current buffer
:RANGE!grep foo
" run command
" no stdin
" append output beneath the current line in the buffer
:r!uptime
" run command
" no stdin
" append output beneath the last line in the range
:RANGEr!uptime
" run command
" pipe whole buffer to command on stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
" (the space between w and ! is important)
:w !pbcopy
" run command
" pipe range to command on stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
" (the space between w and ! is important)
:RANGEw !pbcopy
command stdin stdout
:! none press enter to continue
:RANGE! range replace range
:r! none append below curent line
:RANGEr! range append below last line in range
:w ! whole file press enter to continue
:RANGEw ! range press enter to continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment