map something to the action of the leader key?

2018-06-05 22:07:09

I have this in my vimrc:

let g:mapleader = ","

nnoremap # ,

so I use , as my leader, and want to use # for backwards search after f,t...But my # mapping does not work, so something is amiss

thanks

To set your leader key, you must use let mapleader = "," not let g:mapleader = ",".

From :h

** *mapleader*

To define a mapping which uses the "mapleader" variable, the special string

"" can be used. It is replaced with the string value of "mapleader".

If "mapleader" is not set or empty, a backslash is used instead. Example: >

:map A oanother line

Works like: >

:map \A oanother line

But after: >

:let mapleader = ","

It works like: >

:map ,A oanother line

As for using nnoremap like you did, this causes no issues for me. Make sure you don't have some other mapping by running the command: nnoremap ,. It should print No mapping found.

  • To set your leader key, you must use let mapleader = "," not let g:mapleader = ",".

    From :h

    ** *mapleader*

    To define a mapping which uses the "mapleader" variable, the special string

    "" can be used. It is replaced with the string value of "mapleader".

    If "mapleader" is not set or empty, a backslash is used instead. Example: >

    :map A oanother line

    Works like: >

    :map \A oanother line

    But after: >

    :let mapleader = ","

    It works like: >

    :map ,A oanother line

    As for using nnoremap like you did, this causes no issues for me. Make sure you don't have some other mapping by running the command: nnoremap ,. It should print No mapping found.

    2018-06-05 22:55:22