Yvan Seth's Hole in the Internet

Further Internetual randomness courtesy of Yvan Seth, software developer.
/Entries/Technology/Code/ <rss>

vim: Binding C-i bad for tab

Thu 2007-01-18 09:30

In the unlikely case that anyone made use of the C-i binding I suggested for toggling vim 7.0 spell-checking they may have noticed that it messed with the use of their tab key! So it turns out that tab and C-i are the same thing from vim's point of view!

Choose a different combo. Like C-c for *c*heck, or C-s for *s*pell, that's surely better! Meta maybe?

I'm now using C-a:

" Set spelling language.
set spelllang=en_gb
" Toggle spell checking for the current buffer with Ctrl-i
map <silent> <C-a> :setlocal invspell<CR>
imap <silent> <C-a> <ESC>:setlocal invspell<CR>a

Note 1: The 'i' at the end of the imap is now an 'a' so that the insert position comes back the same.

Note 2: The C-i is only a problem for the imap and if you remove that you can then use C-i or tab in command mode to toggle spelling and live without the ability to toggle spelling when in edit mode. This'll clash with any other command mode binding of tab of course, but I have none. I like to toggle in edit mode though so I'll stick with C-a for now (hrm, what does it clash with?).

Update

Of course, a few minutes later I try to use C-a for it's normal purpose, incrementing a number under the cursor. I use this surprisingly often. *sigh*

No Responses

Name:
Email: (You must register an email address!)
Url: (optional)
Title: (optional)
Response:
All HTML will be escaped. Paragraphs and new-lines are honoured and you can use *word* for bold and _word_ for underline.
Save my Name, URL, and Email for next time
/Entries/Technology/Code/vim: Binding C-i bad for tab

© 2005-2009 Yvan Seth — EMail Yvan | XHTML 1.0 Strict | Add to GoogleSubscribe with Bloglines | Creative Commons License

    follow me on Twitter

    Categories

    Badgers

    Protecting your bits. Open Rights Group