Lost left/right cursor keys in VIM insert mode?

8

4

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 ?!

user7385

Posted 2010-05-10T15:31:54.487

Reputation:

Answers

6

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.

Ignacio Vazquez-Abrams

Posted 2010-05-10T15:31:54.487

Reputation: 100 516

1Both 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. – None – 2010-05-10T16:49:47.040

1

Sounds like functionality provided by this: http://www.vim.org/scripts/script.php?script_id=1572

– Ignacio Vazquez-Abrams – 2010-05-10T16:57:45.320

@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 – 2010-05-10T17:09:29.147

@Herbert: I have no idea about this "SQLComplete" plugin - never installed it, never wanted. Probably came with vim installation in ubuntu. – None – 2010-05-10T18:52:59.000

15

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

let g:omni_sql_no_default_maps = 1

Bryan C. Geraghty

Posted 2010-05-10T15:31:54.487

Reputation: 151

This solved it for me. The accepted answer correctly answers the question, but this actually fixes the problem. :) – oalders – 2013-07-18T19:36:40.490