3

I'd like to be able to create the commands

nmap oo o
nmap oi o<Esc>
nmap OO O
nmap OI O<Esc>

but the problem is that o triggers immediately and the second character ends up in Insert mode. nnoremap o <nop> doesn't fix things.

Can I "disable" the o command while still allowing it to be mapped?

Obviously I could just use a leader mapping, but I figure I might as well try and go ham with it.

3

You can run

nmap o <nop>
nnoremap oo o
nnoremap oi o<Esc>
nnoremap OO O
nnoremap OI O<Esc>
1
  • 1
    Thanks! I had the noremap stuff backwards. Although I'm already getting used to <leader>o and <leader>O... – shadowtalker Oct 5 '15 at 19:21
2

I feel like you mappings are designed to create black lines. This is a common task here are some quick mappings to put in your vimrc file.

nnoremap <silent> [<space> :pu! _<cr>:']+1<cr>
nnoremap <silent> ]<space> :pu _<cr>:'[-1<cr>

If you prefer a plugin then I suggest Tim Pope's unimpaired.vim. Which supplies these mappings, but will also take a count. The plugin also has many other nice mappings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.