Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
e652756f
Commit
e652756f
authored
Mar 20, 2012
by
Derek Wyatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A plugin that makes it easier to interact with the (single) running instance of gvim
parent
1120f973
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
136 additions
and
0 deletions
+136
-0
README.md
plugins/vim-interaction/README.md
+69
-0
vim-interaction.plugin.zsh
plugins/vim-interaction/vim-interaction.plugin.zsh
+67
-0
No files found.
plugins/vim-interaction/README.md
0 → 100644
View file @
e652756f
# Vim Interaction #
The plugin presents a function called
`callvim`
whose usage is:
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
-b cmd Run this command in GVIM before editing the first file
-a cmd Run this command in GVIM after editing the first file
file The file to edit
... fileN The other files to add to the argslist
## Rationale ##
The idea for this script is to give you some decent interaction with a running
GVim session. Normally you'll be running around your filesystem doing any
number of amazing things and you'll need to load some files into GVim for
editing, inspecting, destruction, or other bits of mayhem. This script lets you
do that.
## Aliases ##
There are a few aliases presented as well:
*
`v`
A shorthand for
`callvim`
*
`vvsp`
Edits the passed in file but first makes a vertical split
*
`vhsp`
Edits the passed in file but first makes a horizontal split
## Examples ##
This will load
`/tmp/myfile.scala`
into the running GVim session:
> v /tmp/myfile.scala
This will load it after first doing a vertical split:
> vvsp /tmp/myfile.scala
or
> v -b':vsp' /tmp/myfile.scala
This will load it after doing a horizontal split, then moving to the bottom of
the file:
> vhsp -aG /tmp/myfile.scala
or
> v -b':sp' -aG /tmp/myfile.scala
This will load the file and then copy the first line to the end (Why you would
ever want to do this... I dunno):
> v -a':1t$' /tmp/myfile.scala
And this will load all of the
`*.txt`
files into the args list:
> v *.txt
If you want to load files into areas that are already split, use one of the
aliases for that:
# Do a ':wincmd h' first
> vh /tmp/myfile.scala
# Do a ':wincmd j' first
> vj /tmp/myfile.scala
# Do a ':wincmd k' first
> vk /tmp/myfile.scala
# Do a ':wincmd l' first
> vl /tmp/myfile.scala
plugins/vim-interaction/vim-interaction.plugin.zsh
0 → 100644
View file @
e652756f
#
# See README.md
#
# Derek Wyatt (derek@{myfirstnamemylastname}.org
#
function
resolveFile
{
if
[
-f
"
$1
"
]
;
then
echo
$(
readlink
-f
"
$1
"
)
else
echo
"
$1
"
fi
}
function
callvim
{
if
[[
$#
==
0
]]
;
then
cat
<<
EOH
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
-b cmd Run this command in GVIM before editing the first file
-a cmd Run this command in GVIM after editing the first file
file The file to edit
... fileN The other files to add to the argslist
EOH
return
0
fi
local
cmd
=
""
local
before
=
""
local
after
=
""
while
getopts
":b:a:"
option
do
case
$option
in
a
)
after
=
"
$OPTARG
"
;;
b
)
before
=
"
$OPTARG
"
;;
esac
done
shift
$((
OPTIND-1
))
if
[[
${
after
#
:
}
!=
$after
&&
${
after
%<cr>
}
==
$after
]]
;
then
after
=
"
$after
<cr>"
fi
if
[[
${
before
#
:
}
!=
$before
&&
${
before
%<cr>
}
==
$before
]]
;
then
before
=
"
$before
<cr>"
fi
local
files
=
""
for
f
in
$@
do
files
=
"
$files
$(
resolveFile
$f
)
"
done
if
[[
-n
$files
]]
;
then
files
=
':args! '
"
$files
<cr>"
fi
cmd
=
"
$before$files$after
"
gvim
--remote-send
"
$cmd
"
}
alias
v
=
callvim
alias
vvsp
=
"callvim -b':vsp'"
alias
vhsp
=
"callvim -b':sp'"
alias
vk
=
"callvim -b':wincmd k'"
alias
vj
=
"callvim -b':wincmd j'"
alias
vl
=
"callvim -b':wincmd l'"
alias
vh
=
"callvim -b':wincmd h'"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment