Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I edit .sql file in VIM, I can't use left/right cursor keys while in insert mode. In normal mode they work just fine. In another file types - they work fine as well. in ~/.vim/ftplugin/sql.vim there is bunch of "iab"s, but not much more.

I found out that when running vim with standard vimrc, not-customized, the problem is not existing.

What could be wrong? Is there any option that could have been set, that disables some (up and down work) cursor keys in insert mode ?!

share|improve this question
up vote 6 down vote accepted

It may be that somehow the keys have become mapped to a command. Type :mapCtrlV to see if the right arrow has been mapped, and the same for left arrow after.

share|improve this answer
Both show "No mapping found". But, after doing :imap, I saw: i <Left> @<C-R>=sqlcomplete#DrillOutOfColumns()<CR> and i <Right> @<C-R>=sqlcomplete#DrillIntoTable()<CR> I was able to trace it back to filetype plugin indent on in my .vimrc, so i disabled it, but I have no idea what this sqlcomplete#... stuff is, and why it broke my left and right cursors. – user7385 May 10 '10 at 16:49
Sounds like functionality provided by this: – Ignacio Vazquez-Abrams May 10 '10 at 16:57
@depesz: enabling 'filetype plugin' basically means special functionality may be loaded in buffers for files that have a filename extension that's linked to an available "plugin". The special plugin kay mappings would be loaded only when editing a file of that type, i.e., with that extension in the filename. Disabling all plugins (i.e., what you did) would fix the "problem", or you could also likely avoid the problem by renaming the problematic files to have a different extension. (Or you could uninstall just the SQLComplete plugin, assuming that's the one that's causing the problem.) – Herbert Sitz May 10 '10 at 17:09
@Herbert: I have no idea about this "SQLComplete" plugin - never installed it, never wanted. Probably came with vim installation in ubuntu. – user7385 May 10 '10 at 18:52

Add the following to your ~/.vimrc or ~/.vim/ftplugin/sql.vim file:

let g:omni_sql_no_default_maps = 1
share|improve this answer
This solved it for me. The accepted answer correctly answers the question, but this actually fixes the problem. :) – oalders Jul 18 '13 at 19:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.