diff --git a/etc/soft/vim/vim/+plugins/look-up b/etc/soft/vim/vim/+plugins/look-up deleted file mode 160000 index f036b1e..0000000 --- a/etc/soft/vim/vim/+plugins/look-up +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f036b1e99dbba6f8e06c8eedad29f13d15cb2207 diff --git a/etc/soft/vim/vim/+plugins/look-up/README.md b/etc/soft/vim/vim/+plugins/look-up/README.md new file mode 100644 index 0000000..df9e35a --- /dev/null +++ b/etc/soft/vim/vim/+plugins/look-up/README.md @@ -0,0 +1,48 @@ +**look-up** - vim-plugin for sdcv + +##Licence + Copyright (C) 2009-2015, Maksim Likhachev, + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public Licence as published by + the Free Software Foundation, either version 3 of the Licence, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public Licence for more details. + + You should have received a copy of the GNU General Public Licence + along with this program. If not, see . + +##Description + This script looks up a word under cursor in a dictionary using custom utility + such as sdcv (console version of StarDict program) and store the word into + text file with extension ".dict" in current directory (optionally). + +##Installation + Put this file into your $HOME/.vim/plugin directory (our use + Pathogen/Vundle/etc) and configure your own keymaps. + + For example: + + > nmap fw :call Dict(expand("")) + > vnoremap fw :call Dict(@*) + + The next two option set sdcv's command line and enables saving the words + into file: + + > let g:sdcv_cmd = "sdcv -n " + > let g:sdcv_save = 1 + +##Usage + :Dict() + +##Version + 1.0 + +##Screenshot +![][structure] +[structure]:look-up.png + diff --git a/etc/soft/vim/vim/+plugins/look-up/look-up.png b/etc/soft/vim/vim/+plugins/look-up/look-up.png new file mode 100644 index 0000000..1271ee7 Binary files /dev/null and b/etc/soft/vim/vim/+plugins/look-up/look-up.png differ diff --git a/etc/soft/vim/vim/+plugins/look-up/plugin/look-up.vim b/etc/soft/vim/vim/+plugins/look-up/plugin/look-up.vim new file mode 100644 index 0000000..0d9021d --- /dev/null +++ b/etc/soft/vim/vim/+plugins/look-up/plugin/look-up.vim @@ -0,0 +1,82 @@ +" File: look-up.vim +" Author: Maksim Likhachev +" Version: 1.0 +" License: GPL3 +" +" Description: +" This script looks up a word under cursor in a dictionary using custom utility +" such as sdcv (console version of StarDict program) and store the word into +" text file with extension ".dict" in current directory (optionally). +" +" Installation: +" Put this file into your $HOME/.vim/plugin directory and configure your own +" keymaps. +" +" For example: +" nmap fw :call Dict(expand("")) +" vnoremap fw :call Dict(@*) +" +" The next two option set sdcv's command line and enables saving the words +" into file: +" let g:sdcv_cmd = "sdcv -n " +" let g:sdcv_save = 1 + +if !exists("g:sdcv_cmd") + let g:sdcv_cmd = "sdcv -n " +endif + +if !exists("g:sdcv_save") + let g:sdcv_save = 1 +endif + +fun! OpenDictionary(cmd, ...) + if a:0 + let buf_name = a:1 + else + let buf_name = 'Dictionary' + endif + + exe 'silent new' escape(buf_name, '\ ') + setlocal modifiable buftype=nofile noswapfile + + let &ft = 'dict' + + exe "silent 0r!".a:cmd." \"".a:1."\"" + + let helpsize = line('$') + if helpsize > &helpheight + let helpsize = &helpheight + endif + set nomod + + if winheight(2) != -1 + exe 'resize' helpsize + endif + + noremap + noremap + noremap q :bdel + if has("gui_running") + noremap :bdel + endif + + setlocal foldmethod=indent + setlocal nohlsearch + setlocal nomodifiable + + hi Error ctermfg=NONE ctermbg=NONE +endfun + +fun! Dict(word) + echo a:word + if g:sdcv_save == 1 + if filereadable(expand('%:p')) + let dict = expand('%:p') . ".dict" + call writefile(readfile(dict)+[a:word], dict) + endif + endif + + call OpenDictionary(g:sdcv_cmd, a:word) + normal gg +endfun + diff --git a/etc/soft/vim/vim/+plugins/look-up/syntax/dict.vim b/etc/soft/vim/vim/+plugins/look-up/syntax/dict.vim new file mode 100644 index 0000000..aa4439e --- /dev/null +++ b/etc/soft/vim/vim/+plugins/look-up/syntax/dict.vim @@ -0,0 +1,35 @@ +" Vim syntax file +" Language: stardict +" Author: Lihachev Maxim +" Created: Th 16 Apr 2009 10:18:10 +" Modified: Вс 29 ноя 2015 20:20:45 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn region article start=/-->/ end=/$/ +syn region transcription start=/\[/ end=/\]/ +syn match category /_.*/ +syn match list /^\s*[0-9a-zа-я]\()\|>\|\.\)/ + +if !exists("did_dict_syntax_inits") + let did_dict_syntax_inits = 1 + + hi link article hArticle + hi default hArticle ctermfg=lightblue + + hi link category hCategory + hi default hCategory ctermfg=lightgreen + + hi link list hList + hi default hList ctermfg=brown + + hi link transcription hTranscription + hi default hTranscription ctermfg=lightyellow +endif + +let b:current_syntax="dict" +