Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

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
1  
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
1  
Sounds like functionality provided by this: vim.org/scripts/script.php?script_id=1572 –  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 comment

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
add comment

Your Answer

 
discard

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