Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions zsh_custom/plugins/vim-interaction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,31 @@ There are a few aliases presented as well:
* `vvsp` Edits the passed in file but first makes a vertical split
* `vhsp` Edits the passed in file but first makes a horizontal split

## Pre Callout ##

At the start of the `callvim` function we invoke the `preCallVim` function if it
exists. You could define a function that starts GVim/MacVim if not started yet

function preCallVim
{
PID=`ps -A | grep gvim`
if [ -z $PID ]; then
gvim
# wait until gvim starts so --remote-send works
while [ -z "`ps -A | grep gvim`" ]; do; done;
fi
}

## Post Callout ##

At the end of the `callvim` function we invoke the `postCallVim` function if it
exists. If you're using MacVim, for example, you could define a function that
brings window focus to it after the file is loaded:
exists. You could define a function that brings window focus after the file is loaded:

function postCallVim
{
osascript -e 'tell application "MacVim" to activate'
gvim --remote-send ":call foreground()<CR>"
}

This'll be different depending on your OS / Window Manager.

## Examples ##

This will load `/tmp/myfile.scala` into the running GVim session:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ usage: callvim [-b cmd] [-a cmd] [file ... fileN]
EOH
return 0
fi

if typeset -f preCallVim > /dev/null; then
preCallVim
fi
local cmd=""
local toNormal="<c-\\><c-n>"
local before=""
Expand Down