27b9aed87f2c05e0c7e18716741ec3381e27f889

Author
Pierre Barbier de Reuille <pierre.barbierdereuille@gmail.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Added "-n name" option to vim-interaction plugin (#4522)

Diff

 1diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh
 2index b774be342745ade466098e3158c0c3ccc5631524..010f998d356abf1df0a8d8817a887abd45401637 100644
 3--- a/plugins/vim-interaction/vim-interaction.plugin.zsh
 4+++ b/plugins/vim-interaction/vim-interaction.plugin.zsh
 5@@ -8,10 +8,11 @@ function callvim
 6 {
 7   if [[ $# == 0 ]]; then
 8     cat <<EOH
 9-usage: callvim [-b cmd] [-a cmd] [file ... fileN]
10+usage: callvim [-b cmd] [-a cmd] [-n name] [file ... fileN]
11 
12   -b cmd     Run this command in GVIM before editing the first file
13   -a cmd     Run this command in GVIM after editing the first file
14+  -n name    Name of the GVIM server to connect to
15   file       The file to edit
16   ... fileN  The other files to add to the argslist
17 EOH
18@@ -21,13 +22,16 @@ EOH
19   local cmd=""
20   local before="<esc>"
21   local after=""
22-  while getopts ":b:a:" option
23+  local name="GVIM"
24+  while getopts ":b:a:n:" option
25   do
26     case $option in
27       a) after="$OPTARG"
28          ;;
29       b) before="$OPTARG"
30          ;;
31+      n) name="$OPTARG"
32+         ;;
33     esac
34   done
35   shift $((OPTIND-1))
36@@ -43,7 +47,7 @@ EOH
37     files=':args! '"${@:A:q}<cr>"
38   fi
39   cmd="$before$files$after"
40-  gvim --remote-send "$cmd"
41+  gvim --servername "$name" --remote-send "$cmd"
42   if typeset -f postCallVim > /dev/null; then
43     postCallVim
44   fi