VIM: disabling the cursor/arrow keys, but only for navigation
Solution 1:
Add the following in your .vimrc
file:
" Disable Arrow keys in Normal mode
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" Disable Arrow keys in Insert mode
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
Solution 2:
You can cycle through the history using C-n
and C-p
(Ctrl+n and Ctrl+p, respectively).
Solution 3:
The code you have posted should not disable history navigation in command line mode, are you sure you don't have cnoremap <Up> <Nop>
or noremap! <Up> <Nop>
somewhere? Try verbose cmap <Up>
it should show you whether <Up>
key is redefined for command line mode.
If when saying «command bar» you meant command-line window, you could try the following:
nnoremap <expr> <Up> ((bufname("%") is# "[Command Line]")?("\<Up>"):(""))