-
Notifications
You must be signed in to change notification settings - Fork 4
/
vim-stardict.txt
344 lines (244 loc) · 13.5 KB
/
vim-stardict.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
*stardict.txt* A Vim plugin for quick word-lookup using StarDict Command-Line
Version (SDCV) dictionary program
*Version:* *0.2.0* - Released on 02/26/2015
==============================================================================
CONTENTS *vim-stardict-contents*
1. Introduction ....................... |vim-stardict-introduction|
2. Install ............................ |vim-stardict-install|
3. Usage .............................. |vim-stardict-usage|
4. Configuration ...................... |vim-stardict-configuration|
5. Mappings ........................... |vim-stardict-mappings|
6. License ............................ |vim-stardict-license|
7. Credits ............................ |vim-stardict-credits|
8. Bugs ............................... |vim-stardict-bugs|
9. Contributing ....................... |vim-stardict-contributing|
10. FAQ ................................ |vim-stardict-faq|
==============================================================================
*1.INTRODUCTION* *vim-stardict-introduction*
*vim-stardict* is a Vim plugin that helps users lookup for meaning of words right
inside Vim and through *StarDict* *Command-Line* *Version* |SDCV|
(http://sdcv.sourceforge.net/) - the console version of the popular |StarDict|
program (http://www.stardict.org/).
When the users invoke vim-stardict 's commands to search for words,
vim-stardict opens either a |:vsplit| or |:split| and fill the buffer with
well-highlighted and nicely-formatted definitions pulled out from the |StarDict|
dictionaries located at |/usr/share/stardict/dic| (with the help of |SDCV|, of
course).
==============================================================================
*2.INSTALL* *vim-stardict-install*
Before installing vim-stardict , the following applications need to be
already installed in your computer:
* |SDCV| : http://sdcv.sourceforge.net/
* |Vim| : http://www.vim.org/
There are several ways to install vim-stardict :
* |Pathogen|:
git clone https://github.com/phongvcao/vim-stardict.git
* |NeoBundle|:
NeoBundle 'phongvcao/vim-stardict'
* |Vundle|:
Plugin 'phongvcao/vim-stardict'
* Manually copy all of the files into your |~/.vim| or
|/usr/share/vim/vimfiles| directories
==============================================================================
*3.USAGE* *vim-stardict-usage*
------------------------------------------------------------------------------
*3.1* *Vim-Usage* *vim-usage*
To lookup the meaning of a word with |no-space-in-between|:
:StarDict random_word_with_no_spaces
To lookup the meaning of a word with |spaces-in-between|, put it inside
quotation marks (both double and single quotes are acceptable):
:StarDict "random word with spaces"
:StarDict 'random word with spaces'
To look up the meaning of several words (either |no-spaces-in-between| or
|spaces-in-between|):
:StarDict first_word second_word "third word" 'fourth word'
:StarDict "first word" 'second word'
To lookup the meaning of a word |under-the-cursor|:
:StarDictCursor
------------------------------------------------------------------------------
*3.2* *Bash-Zsh-Usage* *bash-zsh-usage*
To lookup the meaning of a word with |no-space-in-between|:
stardict random_word_with_no_spaces
To lookup the meaning of a word with |spaces-in-between|, put it inside
quotation marks (both double and single quotes are acceptable):
stardict "random word with spaces"
stardict 'random word with spaces'
To look up the meaning of several words (either |no-spaces-in-between| or
|spaces-in-between|):
stardict first_word second_word "third word" 'fourth word'
stardict "first word" 'second word'
To view the meaning of word in Vim from Bash or Zsh:
vstardict first_word second_word "third word" 'fourth word'
==============================================================================
*4.CONFIGURATION* *vim-stardict-configuration*
*4.1* *Vim-Configuration* *vim-configuration*
You can tweak the behavior of vim-stardict by setting a few variables in your
|.vimrc| file. For example:
let g:stardict_split_size = 20
let g:stardict_split_horizontal = 1
" OPTIONAL: You can change the colors of output of vim-stardict inside Vim
" as follow (see below for the comprehensive list of highlight group):
highlight link stardictResult Special " Default value
highlight link stardictWord PreProc " Default value
highlight link stardictWordType Statement " Default value
highlight link stardictWordMeaning Identifier " Default value
highlight link stardictWordExample Type " Default value
highlight link stardictDictName Underlined " Default value
For the full list of highlight groups in Vim, you can consult ':help group-name'
------------------------------------------------------------------------------
*4.1.1* *g:stardict_split_size* *stardict_split_size*
This is the size of the vim-stardict split. The value of g:stardict_split_size
can be either a number or an empty string ''.
* If a number is specified, the vim-stardict |:split| (or |:vsplit|) will
have its |height| (or |width|) set accordingly to the number.
* If an emptry string (default value) is specified, the vim-stardict
|:split| (or |:vsplit|) will occupy half of the current window's |height|
(or |width|).
Default: '' (empty string)
------------------------------------------------------------------------------
*4.1.2* *g:stardict_split_horizontal* *stardict_split_horizontal*
This option specify whether to use a |:split| or a |:vsplit| for the
vim-stardict split.
* If set to 1, vim-stardict will be opened in a |:split|
* If set to 0, vim-stardict will be opened in a |:vplit|
Default: 1
-----------------------------------------------------------------------------
*4.2* *Bash-Zsh-Configuration* *bash-zsh-configuration*
In order to use this plugin for Bash and Zsh also, you need to configure your
|.bashrc| (or |.zshrc|) similar to the following (supposed you use |Vundle| to
manage your plugins):
# Export vim-stardict installation directory
# NOTE: Only do this if your vim-stardict installation directory is other
# than ${HOME}/.vim/bundle/vim-stardict. In other words, uncomment these
# lines if you are not using Vundle, Pathogen or NeoBundle to manage your
# Vim plugins:
export STARDICT_DIR="{HOME}/.vim/bundle/vim-stardict"
# For Bash: Source the stardict.sh file in the vim-stardict installation
# directory.
# For Zsh: The path to the stardict.zsh file is
# "${HOME}"/.vim/bundle/vim-stardict/bindings/zsh/stardict.zsh
if [[ -f "${HOME}"/.vim/bundle/vim-stardict/bindings/bash/stardict.sh ]]; then
source "${HOME}"/.vim/bundle/vim-stardict/bindings/bash/stardict.sh
fi
# To avoid typing the long & daunting 'stardict' & 'vstardict' commands,
# you can alias it to something else
alias whatis="stardict"
alias whatvim="vstardict"
# OPTIONAL: You can change the colors of output of vim-stardict inside Bash
# (see below for the comprehensive list of color codes in Bash):
# export STARDICT_RESULT="\033[0;31m" # Defaut value
# export STARDICT_WORD="\033[0;91m" # Defaut value
# export STARDICT_WORD_TYPE="\033[0;32m" # Defaut value
# export STARDICT_WORD_MEANING="\033[0;34m" # Defaut value
# export STARDICT_WORD_EXAMPLE="\033[0;33m" # Defaut value
# export STARDICT_DICT_NAME="\033[0;95m" # Defaut value
# OPTIONAL: You can change the path to the python executable that
# vim-stardict uses for Bash/Zsh lookup (which is "/usr/bin/python"
# by default)
# export STARDICT_PYTHON_PATH="/usr/bin/python" # Defaut value
For the full list of color codes in Bash and Zsh, you can consult this link:
http://vimdoc.sourceforge.net/htmldoc/syntax.html#group-name
You can change 'whatis' and 'whatvim' to whatever aliases you like. Also, you
can also change the path to source the |stardict.sh| file above, if your Vim
plugin directory is different.
With the above configuration, you can issue these commands to find meaning of
words:
whatis first_word second_word "third word" 'fourth word'
whatvim first_word second_word "third word" 'fourth word'
==============================================================================
*5.MAPPINGS* *vim-stardict-mappings*
To save some keystrokes, instead of typing in the many vim-stardict commands
directly, you can map them into Vim keymappings:
nnoremap <leader>sw :StarDict<Space> " Ready for typing the word in
nnoremap <leader>sc :StarDictCursor<CR> " Lookup the word under cursor
==============================================================================
*6.LICENSE* *vim-stardict-license*
Version: 0.1.0
Author : Phong V. Cao <phongvcao@phongvcao.com>
Documentation Author: Phong V. Cao <phongvcao@phongvcao.com>
License: MIT license {{{
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}}}
==============================================================================
*7.Credits* *vim-stardict-credits*
I would like to say special thanks and appreciation for the ideas, codes and
inspirations from the following developers. Without them, I would never be so
motivated (and have the idea/skeleton codes) to finish vim-stardict :
* Chu-Siang Lai <chusiang.lai@gmail.com>
* Yunt <http://my.opera.com/yunt/blog/show.dml/304842>
Note: vim-stardict was actually started as a fork of |chusiang/vim-sdcv| on
Github: https://github.com/chusiang/vim-sdcv, but due to so many extra codes and
editation that I put in that I decided to go ahead and detach vim-stardict to a
separate project instead of a fork. However, credits should still be due to
where it is supposed to be due.
==============================================================================
*8.Bugs* *vim-stardict-bugs*
If you find a bug please do not hesitate to post it on our Github issue
tracker:
https://github.com/phongvcao/vim-stardict/issues/new
==============================================================================
*9.Contributing* *vim-stardict-contributing*
Think you can make this plugin better? Fork it on Github and send us a pull
request:
* |Github|: https://github.com/phongvcao/vim-stardict
==============================================================================
*10.Changelog* *vim-stardict-changelog*
|v0.5.0|
* :StarDict command now accepts --data-dir & -u arguments
* stardict & vstardict commands for Bash/Zsh now accepts all arguments of
sdcv
|v0.4.4|
* Fixed stardict.py Python piping issue that prevents sdcv -u from getting
the definition
|v0.4.3|
* Switched back to /usr/bin/python instead of /usr/bin/env python
|v0.4.2|
* Replaced /usr/bin/python with /usr/bin/env python for stardict.py
* Added STARDICT_PYTHON_PATH variable to let users specify the python
executable they want to use to execute stardict.py
* Added CONTRIBUTING.md
|v0.4.1|
* Fixed default Python 3 option
* Removed syntax file sourcing
* Removed g:stardict_prefer_python3 option
|v0.4.0|
* Added support for Zsh
* Added custom $STARDICT_DIR variable to let users specify vim-stardict
installation directory
|v0.3.3|
* Fixed wrong highlighting of words' examples
|v0.3.2|
* Fixed :split and :vsplit opening delay
* Fixed multiple :split open at a time
* Reuse last 'stardict' buffer if there is one
* Hide 'vim-stardict' buffer from buffer list
* Removed buffer cache of old word meaning history
* Added Report Bugs section on README.md
|v0.3.1|
* Restored mouse cursor after viewing definition
* Added LICENSE.txt
|v0.3.0|
* Added output colors customization for Vim and Bash
* Fixed extra split in Vim
|v0.2.0|
* Added support for Bash
* Added output redirection from Bash to Vim
* Fixed some highlight errors on Vim and Bash
* Changed highlighting color for "Found ... items"
|v0.1.0|:
* Initial stable release