mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 15:53:22 +01:00
Added "-n name" option to vim-interaction plugin (#4522)
This commit is contained in:
parent
c7d8ad1e75
commit
27b9aed87f
@ -8,10 +8,11 @@ function callvim
|
|||||||
{
|
{
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
cat <<EOH
|
cat <<EOH
|
||||||
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
|
usage: callvim [-b cmd] [-a cmd] [-n name] [file ... fileN]
|
||||||
|
|
||||||
-b cmd Run this command in GVIM before editing the first file
|
-b cmd Run this command in GVIM before editing the first file
|
||||||
-a cmd Run this command in GVIM after editing the first file
|
-a cmd Run this command in GVIM after editing the first file
|
||||||
|
-n name Name of the GVIM server to connect to
|
||||||
file The file to edit
|
file The file to edit
|
||||||
... fileN The other files to add to the argslist
|
... fileN The other files to add to the argslist
|
||||||
EOH
|
EOH
|
||||||
@ -21,13 +22,16 @@ EOH
|
|||||||
local cmd=""
|
local cmd=""
|
||||||
local before="<esc>"
|
local before="<esc>"
|
||||||
local after=""
|
local after=""
|
||||||
while getopts ":b:a:" option
|
local name="GVIM"
|
||||||
|
while getopts ":b:a:n:" option
|
||||||
do
|
do
|
||||||
case $option in
|
case $option in
|
||||||
a) after="$OPTARG"
|
a) after="$OPTARG"
|
||||||
;;
|
;;
|
||||||
b) before="$OPTARG"
|
b) before="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
n) name="$OPTARG"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
@ -43,7 +47,7 @@ EOH
|
|||||||
files=':args! '"${@:A:q}<cr>"
|
files=':args! '"${@:A:q}<cr>"
|
||||||
fi
|
fi
|
||||||
cmd="$before$files$after"
|
cmd="$before$files$after"
|
||||||
gvim --remote-send "$cmd"
|
gvim --servername "$name" --remote-send "$cmd"
|
||||||
if typeset -f postCallVim > /dev/null; then
|
if typeset -f postCallVim > /dev/null; then
|
||||||
postCallVim
|
postCallVim
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user