Hi,
I have a my tab key mapped to a function which should react different
depending on the situation
1. If I am in a comment, the current word is completet from dictonary
2. If I am in code, curstom completions is called (elim sits behind it here)
Now I want a third thing:
3. If I am in a comment and the current word is misspelled, spell correct
it.
The function works for the first 2 things, but the last thing I do not know
how to do:
This is the function:
function TabDo()
let col = col('.') == col('$') ? col('.') - 1 : col('.')
let syntax = synIDattr(synID(line('.'), col, 1), "name")
if syntax =~ 'Comment' || syntax =~ 'String'
" let badword = spellbadword()
" if badword =~ ''
return "\<c-x>\<c-k>"
" endif
" return 'z='
endif
return "\<c-x>\<c-u>"
endfunction
The commented part are my tries for adding the extra option. What am I doing
wrong?
Thanks!
Nathan
--
View this message in context:
http://www.nabble.com/Checking-if-the-current-word-is-spelled-wrong-and-correct-it-in-script-tp24410540p24410540.html
Sent from the Vim - General mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---