4

Is there a way to get insert mode emacs style meta counts in neovim (which has support for the meta key)?

Such that, for instance, <m-3>- produces 3 hyphens.

PS. I mean is it possible to produce the exact same behaviour. In this case, <m-3>- is better than <esc>3a-<esc>a.

6

Yep. {count}i{text}<esc>.

For example: 80i-<esc> will insert 80 equal signs. Great as a markdown horizontal rule.

And mappable in your ~/.vimrc

nnoremap <Leader>hr 80i-<esc>

Reference

:help insert

  • 3
    I knew that i took a count, but it never occurred to me that I could actually use it for something useful. Thanks! It should be noted that this is repeatable using ., in which case, it may be better to use 80a-<esc> to keep the cursor at the end of the inserted text. – Tommy A May 17 '16 at 15:03
  • Nice. I like a even more! I almost always want my cursor at the end a change (like every other non-vim-editor). – ddrscott May 17 '16 at 21:29

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.