Use vim to edit text anywhere

For people that are used to the superior vim keybindings it may be nice to use their favorite editor on every text input, no matter if its a in another application or on a website. This small script helps so you to never again write text in a non-vim environment.


The script

Save somewhere and assign a hotkey to it. The script opens a new terminal with vim and pastes the output into the currently opened application once the editor is closed.


function setclip {
  xclip -selection c

function getclip {
  xclip -selection clipboard -o

urxvt -e vim "$file" # replace with your favorite terminal

cat $file | setclip
rm $file

xdotool key ctrl+v

Sample i3 configuration:

bindsym $mod+Shift+o exec --no-startup-id ~/bin/


I took the idea from this tool but realized that this simpler approach is enough for me.