README.md 2.24 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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

28
29
30
31
32
33
34
35
36
37
38
39
40
## 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:

    function postCallVim
    {
      osascript -e 'tell application "MacVim" to activate'
    }

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

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
## 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