Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [keymap]

The tag has no usage guidance.

0
votes
1answer
14 views

remap esc key introduced remove behave

I'v remapped esc key by double jj for insert mode and command line mode. When I using it in command line mode it removes the word where the cursor is highlighted cnoremap jj <esc> nnoremap rr ...
1
vote
0answers
29 views

Why is <C-S> not remappable? [duplicate]

The vim version on my Mac is 8.1.1000, installed by homebrew: VIM - Vi IMproved 8.1 (2018 May 18, compiled Mar 11 2019 08:36:53) macOS version Included patches: 1-1000 Compiled by Homebrew Huge ...
3
votes
0answers
26 views

Return <motion> character from Python function in <expr> mapping

I am trying to return this :GrepperAck ''<Left> from a Python function and use it in the following mapping def invoke_search_command(): return ":GrepperAck ''<Left>" :nnoremap <expr&...
3
votes
2answers
46 views

Creating a repeatable mapping in Vim

I find myself often aligning certain code blocks by inserting one or more spaces, like in the following situation: case something of Just a▉-> ... Nothing -> ... Here ▉ is the position ...
1
vote
1answer
21 views

Why will my set langmap in my vimrc not actually make the changes in Vim on macOS?

My vimrc is as follows: set langmap='q,\\,w,.e,pr,yt,fy,gu,ci,ro,lp,/[,=],aa,os,ed,uf,ig,dh,hj,tk,nl,s\\;,-',\\;z,qx,jc,kv,xb,bn,mm,w\\,,v.,z/,[-,]=,\"Q,<W,>E,PR,YT,FY,GU,CI,RO,LP,?{,+},AA,OS,...
1
vote
1answer
40 views

Where is the command list for the default keys?

I would like to remapping some of the default keys, where I can find all the command name list used by vim?
1
vote
1answer
23 views

How to do a conditional key mapping dynamically?

I know that I can do a conditional key mapping by map-expression: map [key] [condition] ? [foo] : [bar] But now my situation is somehow awkward. I want to map <C-h> to <C-w>h if I have ...
0
votes
0answers
24 views

How to bind command+s to save file on macOS?

I have a Macbook. I want to save files by pressing command + s (this should happen if it is in insert mode or not, and I want it to go to non-insert mode after it is saved). How do I do this? ...
0
votes
0answers
23 views

“--INSERT--” doesn't go away with a remapped escape key

I remapped the Esc key to jj as follows: inoremap jj <esc>l If I only put <esc> the cursor is always one letter to the right, however once I add the l the notification message --INSERT -...
0
votes
1answer
24 views

Loading UTF keymap file

I need to load a particular keymap file that enables me to write underscore, special characters by typing :set keymap=iast where iast.vim is my keymap file This no longer works. Where should this ...
2
votes
1answer
74 views

Numpad characters don't work in keybindings mappings (but work in general)

For my terminal Vim 8.0, I have downloaded this plugin that makes changing font size on the fly easy: https://github.com/drmikehenry/vim-fontsize Following the instructions, here is how I decided to ...
1
vote
1answer
52 views

remap to a map calling getchar() internally

I want to extend the easymotion Plugin to take some action after the jump. To explain to those who are not familiar with this plugin, I will use the following simplified example. Say in a plugin ...
-2
votes
1answer
42 views

VIM and Carrot L (^L)?

I know when you see ^M you can insert it with Control+Enter; and ^I with Control+Tab. How do you generate a Form Feed ^L for use in :s and /?
2
votes
0answers
34 views

Function keys: won't work with macros (I tried a lot)

Specs: Vim 8.0 patch 500 gnome-terminal 3.18.3 on Ubuntu 16.04 running Unity Function keys in my vim slightly misbehave, however, in an annoying way: I can't completely use them in my macros. After ...
0
votes
1answer
34 views

Make conditional imap to text being enclosed in certain characters

How can I create mappings that work only if the cursor is enclosed by certain characters? As an example, I want to map ja to \alpha if the cursor is enclosed by $$ or by \[\] so as to make This jar ...
0
votes
1answer
66 views

Function Unable to Fail: Breaks Macros

Vim functions do not seem to be able to fail without spitting out 3 unnecessary lines. For example, take this set of functions and maps: " NEXT / PREVIOUS " ~~~~~~~~~~~~~~~ " n and N always search ...
1
vote
0answers
24 views

How can I prevent <CR> from moving the cursor downward? [duplicate]

In the vim help doc, it says: *CTRL-M* *<CR>* [count] lines downward, on the first non-blank character |linewise|. That is, in the normal mode, <CR> has the same ...
2
votes
1answer
79 views

Create remap with variable

How do I remap key combinations with a free variable? For example, let's say I want to be able to insert a single letter without leaving normal mode. I would want something like nnoremap <leader&...
0
votes
1answer
42 views

importing skeleton on keybind

Task: on key press, lets say <C-G> print a basic skeleton, e.g.: 99 control '<++>' do 100 impact '<++>' 101 title '<++>' 102 desc '<++>' 103 describe <++>...
0
votes
2answers
56 views

What key presses/escape codes does vim expect for <ScrollWheelLeft> and <ScrollWheelRight>?

I'm working with a terminal emulator, and want to send the right key presses/escape sequences to vim, so it inteprets them as the left/right scroll wheel buttons. 64/65 works for up/down: <...
1
vote
1answer
65 views

Difference between unmap and mapping to <Nop>

My version is : NVIM v0.3.0-dev I'm trying to replace mappings with w mappings. Initially I came up with nnoremap <leader>w <c-w> nnoremap <leader>wb <c-w>s nnoremap <...
0
votes
1answer
88 views

How to remap :w to :up?

I have a file-watcher system which triggers some compilations upon time-stamp changes in the source file I am editing. I have the obsessive habit of using :w quite a few times during my editing ...
0
votes
0answers
48 views

Why numeric keypad has been treated same as number key in vim?

Noticed this issue with Highlight multiple words. After add highlights.vim and highlights.csv, I can highlight multiple word with different colours by command :Highlight 1 word, but numeric keypad is ...
0
votes
4answers
242 views

How to disable Help menu in insert mode?

I want to map <M-h> to ← in insert mode. I add imap <M-h> <Left> to .vimrc. But if I press <M-h>, Help menu will pop up. How to disable this and force <M-h> to ←...
0
votes
2answers
93 views

how to create a keymap for vim that has a regex argument

This pattern is very useful to me to get the count of a pattern in a vim file: :%s/pattern//gn How can I do a keymap so that I can simply invoke it + pattern while I'm in vim?
0
votes
2answers
98 views

Unmap all combinations starting with certain key

I am experimenting with default key mappings and am considering remapping the g key entirely. But first I would like to turn off all the existing mappings that g has. For now I am using this kind of ...
0
votes
2answers
90 views

Vim stops treating “<Plug>” as a keyword to call functions in insert mode

I have the following configuration in my vimrc file. inoremap <C-A> <Plug>InsertComment And somewhere in my vim folder I defined inoremap <silent> <Plug>InsertComment <...
0
votes
2answers
105 views

Comment and uncomment by the same key strokes

At the moment, my commenting and un-commenting is done by two different strokes listed below: nnoremap <leader>c 0<insert>//<Esc> nnoremap <leader><leader>c :s;^\s*//<...
1
vote
1answer
111 views

shortcut to open definition of variable in a vertical split

I use the vertical split command a lot :vsplit, and I also have click on ctrl] to look at the definition of a variable (after generating the Ctags). I would like to do a keyboard shortcut that does ...
4
votes
1answer
283 views

Map Alt-{ijkl} for tab split navigation

On my previous setup, I used the following binding to move between my splits nmap <silent> <A-Up> :wincmd k<CR> nmap <silent> <A-Down> :wincmd j<CR> nmap <...
1
vote
1answer
44 views

Converting from A to B using mapped key

I've posted a number of times to try and get closer to what I'm trying to do. My problem is I have got the commands I need to make the conversion happen, however I cannot successfully map it to a key. ...
1
vote
1answer
476 views

Map <C-/> on linux and windows [duplicate]

I knew that map / is _ on linux, but it not work on windows. What should I do to map it?
1
vote
1answer
410 views

Can't remap <C-C> in vim

(NB: I've moved this question from another SE site, let me know if thats not ok and I can take this down) I'm having issues remapping Ctrl+Shift+c to copy visually selected text to the + register. ...
3
votes
1answer
391 views

return <Plug> in a <expr> map

I know that in vim, map <expr> allows us to map a key sequence to a new sequence as specified by the return value of an expression. For example: function Wrap() if getline('.') == '' ...
1
vote
1answer
115 views

Is it possible to map one key to two commands, doing 2nd command only if first fails

I want to map the tab key to <c-w>w to switch windows when there is more than one window open. But if there is only one window but multiple tabs, I want it to detect that there is only one ...
5
votes
2answers
152 views

Vim custom key mapping not working in superuser mode

I have a custom key mapping jj to escape, it works for normal file edit but when I open the file as a superuser the key mapping doesn't work anymore, why? I use Antergos os.
0
votes
3answers
1k views

inoremap + nnoremap

I recently wanted to have a mapping that I could trigger from normal mode as well as from insert mode. Writing the same mapping for multiple modes annoyed me as it cluttered my .vimrc and requires me ...
2
votes
3answers
520 views

keymap for open .vimrc, edit, save and reload

I am trying to improve my vim skills lately, and therefore I edit my .vimrc a lot. Following How do I reload my vimrc without leaving Vim?, I wonder if there is a convenient way to define a keymap ...
0
votes
1answer
84 views

Vimscript: fetch list of keymappings containing a prefix?

I'm adding a buffer-local mapping to close netrw windows: " ~/.vim/ftplugin/netrw.vim nnoremap <buffer> q <C-W>c It works, but it hesitates because Netrw has created other mappings with ...
0
votes
1answer
767 views

oneliner map to fold all / unfold all

I'm trying to optimize this solution I came up with. The code bellow do works fine. So feel free to use it as a valid solution to this question. nnoremap <F2> :call ToogleFold()<CR> ...
0
votes
1answer
63 views

Remapped keys won't work when combined

I have these lines in my .vimrc: " Remap movement nnoremap j h nnoremap k j ...
5
votes
1answer
687 views

start vi automatically in hex mode

Once I run vi a.out, I can type :%!xxd, but I'm unable to automate the process like start vi automatically in hex mode create a key mapping from F1 to :%!xxd
1
vote
1answer
572 views

Using Text Objects with vimtex

I am having trouble figuring out how to use the text objects with the vimtex plugin. The mappings with leaders and the commands in normal and insert mode are fine. But to get environments, sections, ...
0
votes
2answers
57 views

Can i map control “b” (b pressed after control not together with it)?

I have this idea of binding b pressed after control (which would preserve original C-b behaviour to Denite buffer and C f to Denite file_rec. But nnoremap <silent> <C>f :Denite file_rec<...
6
votes
1answer
165 views

How do you set no timeout for a specific remap?

The question arise from a problem using a huge remapped configuration so bépo layout is virtually the same as the qwerty in normal mode, at least for single key press commands. Selecting text using ...
1
vote
1answer
119 views

Make mapping repeatable with repeat.vim

I'm trying to make a mapping that inserts an empty line below without moving the cursor and to make this repeatable with repeat.vim. I have modeled this from vimcasts. To get back to the original ...
0
votes
2answers
132 views

How to insert tabs in key remapping?

I wrote the following in my .vimrc file in order to automate getting an HTML file set up. :imap html<tab> \<html><enter> \<tab><head><enter> .... and so on. ...
4
votes
2answers
182 views

How do I swap key bindings without breaking plugins?

I'm thinking about exchanging some keys while in non insert-mode so that the bindings that I use most are easier to reach (i.e. on the home row). How can I swap two keys without breaking the ...
17
votes
1answer
1k views

What is the difference between “mapped key sequences” and “key codes”? (timeoutlen v ttimeoutlen)

The vim manual says we can use timeoutlen to specify the timeout length of mapped key sequences and can use ttimeoutlen to specify the timeout length of key codes: A useful setting would be :set ...
1
vote
2answers
272 views

How to execute xdg-open from NERDTree in Linux?

Netrw able to execute file with xdg-open by pressing x, how about NERDTree ? [Response to downvote] If xdg-open can so easy/direct to work (which is the reason of downvote), then what's the point ...