« Back to Index

VimScript custom function that triggers tmux pane to open specified gem contents within Vim

View original Gist on GitHub

.vimrc

" Open specified gem in a tmux split pane
" e.g. :OpenGem cloby

fun! GemPath(gem)
  let testing = system("bundle show " . a:gem)
  return substitute(testing, "\n", "", "")
endfun

:command -nargs=1 OpenGem execute ":!tmux splitw 'echo " . GemPath(<f-args>) . " | xargs vim'; tmux select-pane -U; tmux send-keys 'C-m'; tmux select-pane -D"