-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdevdocs.txt
182 lines (128 loc) · 6.92 KB
/
devdocs.txt
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
*devdocs.txt*
VIM-DEVDOCS DOCUMENTATION by Romain Lafourcade
*devdocs*
*vim-devdocs*
Help on using vim-devdocs
1. Introduction ............................. |devdocs-intro|
2. Installation ............................. |devdocs-installation|
3. Configuration ............................ |devdocs-configuration|
4. Usage .................................... |devdocs-usage|
5. TODO ..................................... |devdocs-todo|
6. DONE ..................................... |devdocs-done|
7. Releases ................................. |devdocs-releases|
==============================================================================
1. Introduction *devdocs-intro*
Vim-devdocs is a very small and trivial plugin with a laser-focused purpose:
looking up keywords on `https://devdocs.io` from Vim.
It does so by providing a single command, |:DD|, that will figure out the
current filetype and point your default browser to the web app with the
correct query.
Even better, |:DD| can be used under the hood by the built-in |K| for maximum
street credibility. See |devdocs-K| below.
To work its magic, vim-devdocs depends on:
* `xdg-open` on various Unix-like systems, part of the `xdg-utils` package,
* `open` on MacOS, it is installed by default,
* `cmd.exe` on WSL, it is also installed by default,
* `explorer` on Windows, it is also installed by default,
but you can tell it to use any external command with |g:devdocs_open_command|.
Vim-devdocs started its life in my config as an experimental snippet circa
2016, then became a clean and reusable Gist in mid-2017, which I decided to
weaponize one year later. If you think a plugin should not be needed for such
a trivial feature be reassured that I totally share that view. If you feel
remix-y, the original Gist is still up in all its 13LOC glory:
`https://gist.github.com/romainl/8d3b73428b4366f75a19be2dad2f0987`
NOTE: vim-devdocs is not affiliated in any way with `devdocs.io` so any
request pertaining to that site should be directed to its operators.
==============================================================================
2. Installation *devdocs-installation*
Method 1, use your favorite runtimepath/plugin manager.
Method 2, if you are using Vim 8.0 or above, move this directory to:
>
# Unix-like systems
~/.vim/pack/{whatever name you want}/start/vim-devdocs
# Windows
%userprofile%\vimfiles\pack\{whatever name you want}\start\vim-devdocs
<
See |package|.
Method 3, if you are using Vim 7.4, move the files in this directory to their standard location:
>
# Unix-like systems
~/.vim/doc/devdocs.txt
~/.vim/plugin/devdocs.vim
# Windows
%userprofile%\vimfiles\doc\devdocs.txt
%userprofile%\vimfiles\plugin\devdocs.vim
<
==============================================================================
3. Configuration *devdocs-configuration*
Options:
g:devdocs_enable_scoping .................... |'g:devdocs_enable_scoping'|
g:devdocs_open_command ...................... |'g:devdocs_open_command'|
------------------------------------------------------------------------------
*g:devdocs_enable_scoping*
Value: numeric ~
Default: 1 ~
Enable or disable automatic scoping.
Add the line below to your vimrc to disable this feature: >
let g:devdocs_enable_scoping = 0
<
------------------------------------------------------------------------------
*g:devdocs_open_command*
Value: string ~
Default: none ~
Tell vim-devdocs what command to use to open the documentation.
Add the line below to your vimrc to tell vim-devdocs to use `my-command`: >
let g:devdocs_open_command = "my-command"
<
==============================================================================
4. Usage *devdocs-usage*
*:DD*
*devdocs-DD*
:DD[!] [filetype] [keyword]
1. Without [!], [filetype], or [keyword], look up the keyword under the
cursor, scoped with the current filetype.
For example, with the cursor on `FuncLit` in a Go buffer: >
:DD
<
would resolve to `https://devdocs.io/go/ast/index#FuncLit` in your
default browser.
With [!], don't do any automatic scoping.
2. Without [!] or [filetype], look up [keyword], scoped with the current
filetype.
For example, if the active buffer is a JavaScript buffer: >
:DD Map
<
would resolve to `https://devdocs.io/javascript/global_objects/map` in
your default browser.
With [!], don't do any automatic scoping.
3. With or without [!], look up [keyword], scoped with [filetype].
For example, no matter what's the filetype of the current buffer: >
:DD scss @mixin
<
would resolve to `https://devdocs.io/sass/index#mixin` in your default
browser.
------------------------------------------------------------------------------
*devdocs-K*
*devdocs-keywordprg*
Vim comes with the built-in and often overlooked |K|, a normal mode command
that looks up the keyword under the cursor with the external command or Ex
command set via the |'keywordprg'| option. |:DD| being a pretty basic Ex
command it is easy and strongly recommended to use it for |K|.
If you want |K| to ALWAYS use |:DD|, put this line in your vimrc: >
set keywordprg=:DD
<
If you want |K| to use |:DD| ONLY for certain filetypes, put this line in the
appropriate `after/ftplugin/<filetype>.vim`: >
setlocal keywordprg=:DD
<
==============================================================================
5. Todo *devdocs-todo*
- Sit back and relax.
==============================================================================
6. Done *devdocs-done*
- All done.
==============================================================================
7. Releases *devdocs-releases*
1.0.0: Andy Montañez ..................................... 09 Jun 2018
First version.
vim:tw=78:ts=8:ft=help:norl: