I have a strange problem with completion and my cursor movement redefinitions and the excellent jedi-vim
plugin with supertab
. I have in my .vimrc
these maps for vertical movement in visual lines:
" Visual movement with the arrows and End-Home
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
"
" these create problems with completions...
"
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
inoremap <Home> <C-o>g<Home>
inoremap <End> <C-o>g<End>
...and the second group is almost always ok, but it creates problems with completions only in python files, using jed-vim
. The effect is that if I have the expansion suggestions on:
and press one of the up/down arrow keys I have the literal "gj" added:
...but this thing does not happen for example with latex
completions:
which is ok after a <Up>
selection (although with a "bip" which is suspicious...).
So my question is: it is possible to have the aforementioned inoremap
definition in normal insert mode, but automatically removed/ignored when in supertab
completion mode?
inoremap <expr> <Down> pumvisible() ? '<C-N>' : '<C-O>gj'
andinoremap <expr> <Up> pumvisible() ? '<C-P>' : '<C-O>gk'