Edit: I turned this into a little plugin. This is my first attempt at writing one and I have no idea what I'm doing, so any help is much appreciated. :)Here it is: https://github.com/danielbmarques/vim-dialect----------I want to keep using zg and zw to add words to the global vim spellfiles, but I want to use zG and zW to add words to a spellfile specific to the file I'm editing. In other words, I want zG and zW to be persistent for each file.Setting the spellfile changes the zg and zw commands, while what I want is to change only the zG and zW commands.So I just did this::au BufNewFile,BufRead * let &l:spellfile = expand('%:p:h') . '/.' .    \ substitute(expand('%:t'), '\(.*\)\..*', '\1', '') . '.utf-8.add'nnoremap zG :call LocalSpell(zG)<cr>nnoremap zW :call LocalSpell(zW)<cr>nnoremap zuG :call LocalSpell(zuG)<cr>nnoremap zuW :call LocalSpell(zuW)<cr>nnoremap zg :call GlobalSpell(zg)<cr>nnoremap zw :call GlobalSpell(zw)<cr>nnoremap zug :call GlobalSpell(zug)<cr>nnoremap zuw :call GlobalSpell(zuw)<cr>vnoremap zG :call LocalSpell(gvzG)<cr>vnoremap zW :call LocalSpell(gvzW)<cr>vnoremap zuG :call LocalSpell(gvzuG)<cr>vnoremap zuW :call LocalSpell(gvzuW)<cr>vnoremap zg :call GlobalSpell(gvzg)<cr>vnoremap zw :call GlobalSpell(gvzw)<cr>vnoremap zug :call GlobalSpell(gvzug)<cr>vnoremap zuw :call GlobalSpell(gvzuw)<cr>function! LocalSpell(cmd)    if &l:spellfile ==         execute normal!  . a:cmd    else        execute normal!  . tolower(a:cmd)    endifendfunctionfunction! GlobalSpell(cmd)    let b:spellfile = &l:spellfile    setlocal spellfile=    execute normal!  . a:cmd    let &l:spellfile = b:spellfileendfunctionAnd it works but it doesn't look like a nice solution to me (edit: it's getting better already :)). So I thought I'd post it here in case anyone has any better ideas or improvements to suggest. What do you think?
Make zG and zW persistent
key bindings;vimscript;spell checking;functions