Sometimes, you edit text outside of Vim. These are sad times. Enter vim-anywhere!

Once invoked, vim-anywhere will open a buffer. Close it and its contents are copied to your clipboard and your previous application is refocused.
macOS:
brew install --cask macvim)Linux:
curl -fsSL https://raw.github.com/cknadler/vim-anywhere/master/install | bash
~/.vim-anywhere/update
~/.vim-anywhere/uninstall
macOS: ( default = ctrl+cmd+v )
You can adjust the shortcut via System Settings.
System Settings > Keyboard > Keyboard Shortcuts > Services > Vim Anywhere
Linux: ( default = ctrl+alt+v )
Gnome
$ gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/vim-anywhere/ binding '<Primary><Alt>v'
I3WM
$ echo 'bindsym $mod+Alt+v exec ~/.vim-anywhere/bin/run' >> ~/.i3/config # remember to reload your config after
Adjust in case $mod is not set to ctrl.
vim-anywhere creates a temporary file in $TMPDIR/vim-anywhere (macOS) or
/tmp/vim-anywhere (Linux) when invoked. These files stick around until you
restart your system, giving you a temporary history.
View your history:
$ ls ${TMPDIR:-/tmp}/vim-anywhere
Reopen your most recent file:
$ vim $( ls ${TMPDIR:-/tmp}/vim-anywhere | sort -r | head -n 1 )
I use Vim for almost everything. I wish I didn't have to say almost. My usual workflow is to open Vim, write, copy the text out of my current buffer and paste it into whatever application I was just using. vim-anywhere attempts to automate this process as much as possible, reducing the friction of using Vim to do more than just edit code.
First, make sure to read the FAQ. If you don't find the answer you're looking for there, feel free to open an issue.
Pull requests, suggestions and issues of any kind are welcome. Make sure to check out the contribution guidelines before you submit a pull request.
MIT.
(top 24 of 52)
103 followers · starred Feb 2018
297 followers · starred Mar 2025
2,130 followers · starred Jan 2014
32 followers · starred Sep 2020
Sometimes, you edit text outside of Vim. These are sad times. Enter vim-anywhere!

Once invoked, vim-anywhere will open a buffer. Close it and its contents are copied to your clipboard and your previous application is refocused.
macOS:
brew install --cask macvim)Linux:
curl -fsSL https://raw.github.com/cknadler/vim-anywhere/master/install | bash
~/.vim-anywhere/update
~/.vim-anywhere/uninstall
macOS: ( default = ctrl+cmd+v )
You can adjust the shortcut via System Settings.
System Settings > Keyboard > Keyboard Shortcuts > Services > Vim Anywhere
Linux: ( default = ctrl+alt+v )
Gnome
$ gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/vim-anywhere/ binding '<Primary><Alt>v'
I3WM
$ echo 'bindsym $mod+Alt+v exec ~/.vim-anywhere/bin/run' >> ~/.i3/config # remember to reload your config after
Adjust in case $mod is not set to ctrl.
vim-anywhere creates a temporary file in $TMPDIR/vim-anywhere (macOS) or
/tmp/vim-anywhere (Linux) when invoked. These files stick around until you
restart your system, giving you a temporary history.
View your history:
$ ls ${TMPDIR:-/tmp}/vim-anywhere
Reopen your most recent file:
$ vim $( ls ${TMPDIR:-/tmp}/vim-anywhere | sort -r | head -n 1 )
I use Vim for almost everything. I wish I didn't have to say almost. My usual workflow is to open Vim, write, copy the text out of my current buffer and paste it into whatever application I was just using. vim-anywhere attempts to automate this process as much as possible, reducing the friction of using Vim to do more than just edit code.
First, make sure to read the FAQ. If you don't find the answer you're looking for there, feel free to open an issue.
Pull requests, suggestions and issues of any kind are welcome. Make sure to check out the contribution guidelines before you submit a pull request.
MIT.
(top 24 of 52)
103 followers · starred Feb 2018
297 followers · starred Mar 2025
2,130 followers · starred Jan 2014
32 followers · starred Sep 2020