'Need Clarification on vim leader key

//mapping1

tnoremap <Esc> <C-\\> <C-n>

// mapping2

let localleader = "\\"

tnoremap <Esc> C<localleader> <C-n>

I tried to modify the above mapping by replacing '\' by a localleader;

But it just prints C\ ^N in the terminal. Can anyone help me to find the mistake?



Solution 1:[1]

According to VIM's documentation accessed by the command :help localleader, you should assign the "\\" to a maplocalleader variable, such as:

let maplocalleader = "\\"

tnoremap <Esc> C<LocalLeader> <C-n>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Atalajaka