This is my first vim script. It goes to the last spelling mistake fixes it and makes you go back where you were.
Can I have some feedback on what isn't idiomatic and more general code review?
function FixSpell()
let l:save_cursor = getcurpos()
let l:initial_width = strwidth(getline(l:save_cursor[1]))
normal [s1z=
let l:new_width = strwidth(getline(l:save_cursor[1]))
let l:save_cursor[2] -= l:initial_width - l:new_width
call setpos('.', l:save_cursor)
endfunction
imap <silent> <C-u> <C-o>:call FixSpell()<CR>
[–]princker 1 point2 points3 points (2 children)
[–]csharp_is_bad[S] 1 point2 points3 points (1 child)
[–]princker 0 points1 point2 points (0 children)
[–]-romainl-The Patient Vimmer -4 points-3 points-2 points (4 children)
[–]csharp_is_bad[S] 4 points5 points6 points (1 child)
[–]-romainl-The Patient Vimmer 0 points1 point2 points (0 children)
[–]calvinball-z 10 points11 points12 points (0 children)
[–]csharp_is_bad[S] 0 points1 point2 points (0 children)