This is actually your terminal doing something weird, not Vim. Terminals have two sets of control sequences associated with cursor keys, for historical reasons: one for full-screen applications, often called “application cursor keys mode”, and one for read-eval-print applications (e.g. shells).
In the old days, read-eval-print applications didn't have any line-editing features, and it was intended that the terminal, or the OS terminal driver, would eventually become more sophisticated. So the terminal sent control sequences intended for the terminal driver. Somehow the Unix terminal drivers never gained decent line-editing features; these were added to applications instead (e.g. through the readline library).
Your terminal is sending ␛OD
for Ctrl+Left in line edition cursor keys mode, and ␛[D
in application cursor keys mode. You have two options:
- Configure your terminal not to make a difference between the two modes. How to do this is entirely dependent on your terminal emulator.
- Live with it. Since any given application always sets the terminal in the same mode, just configure its key bindings according to the mode it uses.
I'm afraid I don't understand.
[deleted some rambling I babbled on with before I figured out the root cause]
What are you trying to accomplish? Your noremap list there doesn't make sense to me anyways.
Aha! Got it!
You're using a DVORAK keyboard layout, aren't you? NOW the mappings begin to make sense. (Forgot to mention that.. didn't we!)
Looking at the source of the NETRW plugin, it looks like the netrw buffer is setting up BUFFER ONLY nnoremaps... which, of course, override yours. I'm looking for a solution.
From what I can tell, you'd have to do some major surgery to the $VIMRUNTIME/autoload/netrw.vim file, which would make upgrading a pain, and would spew netrw mappings all over your nice clean floor. But another idea struck me:
The netrw plugin sets the filetype to 'netrw' when it opens the buffer, so you could set up an autocommand in your .vimrc to set your needed key conversions as needed in the netrw window.
augroup netrw_dvorak_fix
autocmd!
autocmd filetype netrw call Fix_netrw_maps_for_dvorak()
augroup END
function! Fix_netrw_maps_for_dvorak()
noremap <buffer> d h
noremap <buffer> h gj
noremap <buffer> t gk
noremap <buffer> n l
noremap <buffer> e d
noremap <buffer> l n
" and any others...
endfunction
Sort of has to be done like that since you can't concatenate map commands. Should work for you.
I suppose if you're using the dvorak noremap's throughout, then you could remove the <buffer> modifier.
Best Answer
How about
:e .
? This opens the current directory in Vim, i.e. it opens the file explorer. Because I haveautochdir
setting set, this shows the directory that the currently edited file is in.