Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the Leader in MacVim?

Tags:

I'm trying to change <Leader> in MacVim to be something less carpal-tunnel inducing. I have added this line

let mapleader="," 

to my .gvimrc, but "\" is still the only key that works. Am I missing something?

like image 281
Paul Wicks Avatar asked Sep 16 '09 22:09

Paul Wicks


People also ask

What is leader key in NVIM?

The leader key provides a facility for creating customized shortcuts that can be further restricted to apply only in certain modes, such as normal, insert, visual, terminal (neovim-specific), etc. The leader key is normally defined by the mapleader variable as \ .

How do I remap a key in vim?

To map a sequence of keys to execute another sequence of keys, use the ':map' command. For example, the following command maps the <F2> key to display the current date and time. The ':map' command creates a key map that works in normal, visual, select and operator pending modes.

What is the vim local leader?

Vim has a second "leader" key called "local leader". This is meant to be a prefix for mappings that only take effect for certain types of files, like Python files or HTML files. Notice that we have to use \\ and not just \ because \ is the escape character in Vimscript strings.

What is silent vim?

<silent> tells vim to show no message when this key sequence is used. <leader> means the key sequence starts with the character assigned to variable mapleader -- a backslash, if no let mapleader = statement has executed yet at the point nmap executes.


1 Answers

The line needs to go into your normal .vimrc (instead of .gvimrc). .gvimrc is not read until all plugins have been loaded, by which time all the mappings have already been created with the default map leader.

.gvimrc is intended only for GUI-specific options, everything else should be in .vimrc.

like image 166
too much php Avatar answered Sep 21 '22 04:09

too much php