Skip to content

Instantly share code, notes, and snippets.

@kenny-evitt
Last active December 5, 2019 17:29
Show Gist options
  • Save kenny-evitt/64f2a689f1fdf9688057f1b5ac5608b3 to your computer and use it in GitHub Desktop.
Save kenny-evitt/64f2a689f1fdf9688057f1b5ac5608b3 to your computer and use it in GitHub Desktop.
Bash commands
# Print variables
#
# From [this answer](http://unix.stackexchange.com/a/118050/56148) to the Unix & Linux SE question:
# - [How to print only defined variables (shell and/or environment variables) in bash - Unix & Linux Stack Exchange](http://unix.stackexchange.com/questions/3510/how-to-print-only-defined-variables-shell-and-or-environment-variables-in-bash)
(set -o posix; set)
# Open Vim with a new buffer containing the output of a command
#
# From [this answer](http://askubuntu.com/a/510907/201153) to the Ask Ubuntu SE question:
# - [How do I redirect command output to vim in bash? - Ask Ubuntu](http://askubuntu.com/questions/510890/how-do-i-redirect-command-output-to-vim-in-bash)
vim <(git status)
@kenny-evitt
Copy link
Author

A generally easier way to load the output of a shell command in a Vim buffer is to do so already in Vim, e.g. by running an 'ex' command like :r! git status.

And for Git commands in particular, the 'vim-fugitive' plugin is generally superior to either of those two options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment