[vim] Translation using \t

This commit is contained in:
Mathieu Maret 2010-11-30 16:30:39 +01:00
parent 939cf96569
commit 09be6c6412

41
.vimrc
View File

@ -27,13 +27,6 @@
"""""""""""
" disable vi-compatible mode
set nocompatible
" to enable spellchecking :set speell"
" c.f. :help spell
" ]s search next misspelled
" [s search previous misspelled
" z= suggestion
" trad files should be under /usr/share/vim/vimfiles/spell
set spell spelllang=fr
""""""""
" SAVE "
""""""""
@ -179,7 +172,7 @@ if has("autocmd")
" enable file type detection and do language-dependent indenting
filetype plugin indent on
" detect indentation see http://www.freehackers.org/Indent_Finder
autocmd BufReadPost * execute system ('python ~/.vim/plugin/indent_finder.py --vim-output "' . expand('%') . '"' )
autocmd BufReadPost * execute system ('python2 ~/.vim/plugin/indent_finder.py --vim-output "' . expand('%') . '"' )
else
" auto-indent
@ -233,6 +226,8 @@ set incsearch
set showmatch
" tenths of a second before blink matching brackets
set mat=5
" % match if/then/else/...
runtime macros/matchit.vim
" search word and list lines to jump with F3
map <F3> [I:let nr = input("Which one: ") <Bar>execute "normal " . nr ."[\t"<CR>
" go to declaration with F5
@ -492,6 +487,7 @@ nmap <S-F10> zo<CR><CR>
" Autoload folding
"au BufWinEnter * silent loadview
""""""""""""""""""""""""""""""""""""""""""""""""""
"Omni-completion par CTRL-X_CTRL-O
"""""""""""""""""""""""""""""""""""""""""""""""""""
@ -606,3 +602,32 @@ function! WhatFunction()
endfunction
set statusline=%<%f\ %h%w%m%r%3.(\ %)%{fugitive#statusline()}%=%([%{Tlist_Get_Tagname_By_Line()}%{WhatFunction()}]%)%3.(\ %)%-14.(%l,%c%V%)\ %P
"""""""""""""""""""""""""""""""""""""""""""
" Language
"""""""""""""""""""""""""""""""""""""""""""
" Using dictd
function! Translate()
let word = expand("<cword>")
let output = system("echo -n $(dict -d eng-fra -f " .word. " 2> /dev/null | tail -n +3 | head -n -1 | sed '1s/$/:/;2,$s/$/;/')")
if output != ""
echohl WarningMsg
echo output
echohl None
else
echohl WarningMsg
echo "No translation found"
echohl None
endif
endfunction
"default Leader is \
nnoremap <silent> <Leader>t :call Translate()<cr>
" to enable spellchecking :set spell"
" c.f. :help spell
" ]s search next misspelled
" [s search previous misspelled
" z= suggestion
" trad files should be under /usr/share/vim/vimfiles/spell
set spell spelllang=en
set nospell