Thursday, June 14, 2007

[updated] Some life changing (g)VI(M) scripts

Ok first I need to say that I use gvim for both text, using LaTeX, and code, mainlly C/C++, writting. So the focus is on both aspects.


. LaTeX-Suite: here and here

- ~/vimrc:
filetype plugin on
set grepprg=grep\ -nH\ $*

- Comments: it works only if you start vim with a ".tex" file.

. Instead of vimspell use the native VIM spell-checker (for VIM 7.0 or greater, Fedora 8 or greater).

- ~/vimrc:
nmap <F10> :setl spell spl=de_de<CR>
nmap <F11> :setl spell spl=en_gb<CR>
nmap <F12> :setl spell spl=<CR>

- Comments: the out-of-the-box VIM come just with the English US dictionary, so to add more dictionaries, with your special flavour, just execute manually (once per language) the fallowing command in VIM:

:setl spell spl=xx_xx

Where "xx_xx" is the language you want to use, for instance: pt_br, es_es, es_mx, en_gb, en_ca, de_de, de_ch, for Brazilian Portuguese, Spanish Spanish, Mexican Spanish, British English, Canadian English, German German, Switzer German.

The languages supported are all languages present in OpenOffice.

. vimspell: here

- ~/vimrc:
" VimSpell settings
highlight SpellErrors ctermfg=Red guifg=Red
\ cterm=underline gui=underline term=reverse
au VimEnter * SpellAutoEnable
let spell_update_time = 2000
" file types to allow correction on
let spell_auto_type = "all"
" on-the-fly type correction
let spell_insert_mode = 0
" which corrector to use
let spell_executable = "aspell"
" languages
let spell_language_list = "en_GB,de_DE,pt_BR"
let spell_auto_jump = 0

- Comments: It is a must for every one that writes something besides code without comments :-)


. csupport: here, but usually already on vim/gvim package.

- ~/vimrc:
let g:C_AuthorName = 'Your name'
let g:C_Email = ''

- Comments: It helps, A LOT!

. Tags menu: here

- ~/vimrc:
let Tmenu_ctags_cmd = '/usr/bin/ctags'
let Tmenu_max_submenu_items = 20
let Tmenu_max_tag_length = 10
let Tmenu_sort_type = "name"

- Comments: it creates, using gvim, a menu item called "Tags" with the current file tags.

. taglist: here

- ~/.vimrc:
nnoremap <silent> <F8> :TlistToggle<CR>

- Comments: This is THE killer tag browser and that map above makes it reachable by pressing <F8>. Check it out.

Related posts: gVim revisited.

No comments: