简体   繁体   中英

How do I press “<C-L> <C-W>l<C-W>_” in Vim?

In one of the vim config files I have noticed this keyboard mapping map <CL> <CW>l<CW>_ supposedly for easier moving in tabs and windows. What does that translate to keyboard presses? What is that underscore at the end for?

The command map <CL> <CW>l<CW>_ maps Ctrl-L to Ctrl-W , l , Ctrl-W , _ .

You invoke this binding by just pressing Ctrl-L . To invoke what it binds to you would type Ctrl-W , then l , followed by Ctrl-W again, and finally _ (which on a US keyboard is shift-hyphen). This is two separate bindings, <CW>l moves the cursor to the window to the right, and <CW>_ resizes current window to the maximum possible vertical size.

The Ctrl + w l Ctrl + w _ keys sequence is somewhat too long so someone has created a shortcut (" map ping" in Vim-speak): Ctrl + L for it.

<Cw>l<Cw>_ moves the the cursor to the window on the right ( <Cw>l ) and maximizes it vertically ( <Cw>_ ).

Mappings always follow the same structure:

  1. map (or imap for insert mode mapping, nmap for normal mode mapping, etc.)

  2. some whitespace

  3. the shortcut you want, here <CL>

  4. some whitespace

  5. the sequence of commands triggered by the shortcut

See :help windows for more info on window management and :help mapping for more info on mappings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM