-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
73 lines (49 loc) · 1.99 KB
/
README
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
28
29
30
31
32
33
34
35
36
37
38
39
40
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
Overview
========
Ever since I discovered CDPATH last year I've been thinking wouldn't it
be great if Vim could access files using CDPATH without having to chdir
anywhere first. In other words, why can't Vim understand that it has to
look for tklbam/restore.py in the CDPATH instead of telling me that it
doesn't exist in the current working directory?
I started experimenting with Vim hooks and eventually figured out how to
implement this as a generic mechanism that defines a more useful way for
Vim to access the filesystem.
Throw in a Python implemented autocomplete algorithm, and in a nutshell, thats
how smart open works.
Configuration
=============
In your bashrc file:;
export _CDPATH=$CDPATH
Path lookup algorithm
=====================
1. Try to lookup path in cdpath
2. If no such file exists, try looking up path as a tag
3. If no such tag exists, assume its a new file
Lookup the path of this new file by trying to find its parent directory in
the cdpath. If it doesn't have a parent directory, assume the new file
should be created in the current working directory.
Special cases::
/path path is absolute (not looked up)
./path path is relative to the current working directory (not looked up)
Usage
=====
commands::
:O[pen] [ <path> ]
:Ta[bOpen] [ <path> ]
:Sp[litOpen] [ <path> ]
if no <path> argument provided:
defaults to taking <path> from word under cursor
Note: shell-style autocomplete is supported, but only for filesystem paths,
not tags.
key bindings::
gf open file or tag (under cursor)
CTRL-] open file or tag (under cursor)
<C-W>f open file (under cursor) in split window
<C-T> go back
Note: overloaded vim native keybindings, with new enhanced functionality.
mouse bindings (browser-inspired)::
left double click to open link
doubleclick open
shift-doubleclick split open
ctrl-doubleclick tab open (like in a browser)
ctrl-rightclick go back