0

I am trying to do a key mapping in vim, yet it doesn't appear to be working how I want it to:

In my ~.vimrc file I have:

syntax on
colorscheme delek
nnoremap < gt
nnoremap > gT

(I only include the first two comments to show that I know my .vimrc is working).

Yet, after I save the file, using < or > does not do anything, though gt and gT are still changing tabs as expected. What is wrong with my character mapping? Or do I need to 'refresh vim' or something, the equivalent of $ source ~/.bash_profile ?

1
  • 1
    Just remember that you’re overriding the > and < operators, which indent and dedent respectively
    – D. Ben Knoble
    Commented Apr 12, 2020 at 14:40

1 Answer 1

2

I can confirm that there is nothing wrong with your mapping, and that you are correct about needing to reload/refresh your configuration for it to actually be available. One way to do so is to restart Vim, but we can do it faster with the :so (short for :source) command and the $MYVIMRC environment variable:

:so $MYVIMRC

I originally posted this answer to your question on Stack Overflow, but I will post it here as well for those who only browse this site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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