Questions tagged [key-bindings]

Doing an action when pressing a key. These are also called key mappings or mappings. For questions about default key bindings, as well as creating or redefining key bindings.

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

understanding and modifying an include-search map command

I found a useful map at the include-search ([I) help. map <leader>1 [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR> This opens the ...
8 votes
1 answer
447 views

ci) - also delete the surrounding parens?

I use ci) and ci] quite a lot to change what happens in between the parens or brackets. Is there a way to remove everything including the parens or brackets?
0 votes
1 answer
35 views

Some Normal mode mappings not working in vim9 anymore

I have the following in my configuration: nnoremap µ iii nnoremap ° ioo I'm using gvim, on Windows 10, using an azerty keyboard (so µ is <S-*> and ° is <S-)). The mappings work in vim8, but ...
0 votes
1 answer
150 views

Unable to map C-/ in visual mode with Neovim and kitty

I am unable to map <C-/> in Neovim. In particular, it does not work for visual mode. I have created the mappings below: vim.keymap.set('i', '<C-/>', '<Esc>:Commentary<CR>') ...
1 vote
0 answers
25 views

Is there a way to map remap 0<C-d> in insert mode

I'm doing a plugin which modify how shift works and remap <C-d> in insert mode. Every thing works well but I have a problem with 0<C-d>. It is a built-in mapping which reset the ...
  • 156
1 vote
0 answers
65 views

Is there a way to map the uppercase Z key alone?

I was trying to map the Z and X keys like this: nnoremap Z v"-yjv"-pkv"-pj nnoremap X v"-ykv"-pjv"-pk But, of course, the Z mapping didn't work because Z is a key that ...
0 votes
2 answers
48 views

<HOME> key is unwanted set to "toggle upercase"

During insert mode my Home key is set to toggle case of character which is very annoying. I tried this command to search for any settings, but failed to solve the problem. I would like to set it to go ...
  • 131
0 votes
0 answers
91 views

coc-snippets tab to next placeholder

I'm currently trying to setup coc-snippets and have quite some problems with it. I'm currently using the snippets directory (I think they are interpreted as snipmate snippets). I have set as key for ...
0 votes
1 answer
61 views

Create keybindings for a specific buffer(s)

I'd like to create keybindings that would only work in fugitive buffer, e.g. gp to run :G pull and gP to run :G push (frankly, it's kind of strange that there are no default shortcuts for this in ...
  • 165
1 vote
1 answer
44 views

Remove all leader mappings before creating my own

The question pretty much sums it up: Is there a way to clear all of the <leader> mappings set by plugin authors before proceeding to set my own custom mappings? The only way I've seen to do this ...
0 votes
1 answer
16 views

Why does this Plug search from the beginning of the line?

I'm trying to use vim-repeat with a <Plug> that camel cases text: nnoremap <silent> <Plug>CamelCase _ f_x~ \:call repeat#set("\<Plug>CamelCase")<CR> nmap _ <...
  • 103
0 votes
1 answer
22 views

How to map <C-z> to act like <C-y> in completion menu?

My keyboard has z and y switched compared to US keyboards, which makes pressing C-y for completions pretty awkward. I tried adding imap <expr> <C-z> pumvisible() ? "<C-y>" :...
  • 543
2 votes
2 answers
46 views

How could I make this mapping to a function repeatable? [duplicate]

I have a mapping that comments/uncomments lines like 5gc to comment/uncomment five lines, and I would like to make it repeatable with .. Here is my mapping and the function it uses: function! Comment()...
  • 31
0 votes
0 answers
23 views

How to map key code sequences without delay?

Neovim doesn't recognize Ctrl+Left or Ctrl+Right for me in urxvt, so for ages I've had the key code sequences urxvt produces mapped like so: map <Esc>Od <C-Left> map! <Esc>Od <C-...
  • 31
0 votes
1 answer
27 views

in normal mode, How to place the cursor at the end of the line just like how insert mode behaves?

Is there a way to set the cursor in normal mode to the end of the line? for example, |abcdefg to abcdefg| not abcdef|g Cursor moves one character backwards on exiting insert mode https://stackoverflow....
  • 3
0 votes
1 answer
43 views

How do I call a user-defined command from a function, and wait until it finishes?

The two functions in the script below can be called independently via key mappings <leader>1 and <leader>2. In a perfect world, <leader>1 will always be called first. If the user ...
  • 381
0 votes
0 answers
19 views

Cancel external command

I am running a make command in a function silent exec '!make command' Sometimes, it fails and then I can not abort the command. Ctrl-c does not work.
  • 162
1 vote
2 answers
41 views

Set mappings dependent of file type

To execute and debug different kind of programs, I mapped the function keys in the .vimrc-file. E.g. " save and execute perl :noremap <F5> :w<CR>:!./%<CR> " save and ...
  • 207
0 votes
3 answers
118 views

Autocmd and key mapping with a conditional expression

I am currently running the following configuration for latex: NVim 0.9, Vmitex and Evince. I have been trying to map a key to open <current-file>.log, while the current-file is a name taken ...
  • 148
0 votes
1 answer
26 views

Key mapping across different Tabs

I have mapped F10 key to execute different programs (pdflatex, python) depending on the file extension. autocmd Filetype tex map <F10> :lcd %:p:h<CR> :bel ter pdflatex % <CR> autocmd ...
0 votes
3 answers
37 views

Mapping: Automatic placement of cursor into (<>) when I press <space> twice

For my Latex setup in VIM I want to map different text modules where the cursor is automatic placed in between (<>), when I press twice <space> and when the cursor arrives there the (<&...
  • 3
0 votes
0 answers
13 views

How can I backspace over a specific sequence of characters in search mode?

I'm working on a autocmd CmdLineEnter / that should map backspace to delete a specific sequence of characters, say FOO, as unit. For instance, if the current command line is This is a text with a FOO ...
  • 2,014
3 votes
2 answers
83 views

How can I reuse parts of the last command / history

I'm looking for a fast and efficient way to re-use the parameters of the last command in a new command. For example, in a Bash shell you can use the $1 placeholder to reuse the 1st argument of the ...
  • 130
1 vote
1 answer
22 views

How to list all keybinding include two combine key binding?

https://stackoverflow.com/questions/35580505/how-to-find-all-vim-mappings-starting-with-control-key I check this link. use the way like this: :redir @a redirect output of next command to register a ...
  • 127
2 votes
0 answers
90 views

CTRL-^ work in Vim but not in Neovim

I'm reading Neovim's usr_07.txt. When I start Neovim like neovim t1.txt t2.txt t3.txt, and then issue :next, the shortcut CTRL+^ is supposed to bring me to the previous file (i.e., the alternate file)....
0 votes
1 answer
19 views

:map <c-n> showing multiple maps when not being set in .vimrc

I have this added to my vimrc map <C-n> :cnext<CR> map <C-m> :cprevious<CR> nnoremap <leader>a :cclose<CR> This is from vim-go-tutorial here. While after running a ...
1 vote
2 answers
43 views

Change level of manual fold?

How do you increase or decrease the level of the current, manual fold? And what is the keyboard shortcut to do it? I cannot see anything in the manual about this. Foldlevel seems to concern not the ...
  • 309
3 votes
1 answer
42 views

mapping to toggle whether a vowel in Unicode has a macron and whether a consonant has a dot

When writing transliterated Arabic (which looks like this: lammā aktub naṣṣan ʿarabiyyan bi-ḥurūfin lātīniyyah) I sometimes leave off a macron that should go on a vowel (e.g., ā ē ī ō ū), or a dot ...
1 vote
1 answer
20 views

Why rhs of cnoremap (used as a rhs of another cnoremap) can be <c-s> but not <space>?

If you execute this cnoremap <expr> <silent> <C-S> execute(':cnoremap <c-s> ctrl-s') and then hit /Ctrl-sCtrl-sCtrl-sCtrl-s, you'll see the search command be populated by /...
  • 2,014
1 vote
0 answers
107 views

`gx` on visual selection in keymap in NeoVim

I would like to map gp to open the file name inside the current set of parentheses. I have: vim.api.nvim_set_keymap('n', 'gp', 'vi(gx', {noremap=true}) However, this just selects the text inside ...
1 vote
1 answer
36 views

How to paste a string into specific line using nmap for key-binding?

Basically what I want to do is running this key-binding: nmap <Leader>= :[x digits]pu<CR> My mapleader Leader is a space. With the code above I want to paste the current string I have in ...
1 vote
2 answers
34 views

lnoremap doesn't seem to apply to insert mode when mapping an unwanted key combo to nop

This is a follow up to this question of mine. I found out that having :noremap ^[[29^ <Nop> in my vimrc is not enough to disable the unwanted effect of Ctrl+Menu in insert mode, so I looked at :...
  • 2,014
0 votes
0 answers
222 views

Add mapping to switch between keymaps

(Neo)VIM comes with a built in binding set in insert and command modes as CTRL-^ that can be used to toggle the use of :lmap mappings (see :help keymaps). I've been using this for years and it works ...
  • 2,185
0 votes
0 answers
23 views

From terminal to normal mode and run a command

I have the following mapping tnoremap <F8> <c-w>N :Vista!!<CR> but the command after <c-w>N (in my case :Vista!!) is not executed. How should I fix it?
  • 241
0 votes
1 answer
47 views

E488: Trailing characters in keymapping [duplicate]

Here is my command: nnoremap <Leader>pwd :!pwd | tr -d '\n' | xclip<CR> And I get error like this how to fix it? I havent found something useful to my issue Error detected while processing ...
  • 127
2 votes
1 answer
649 views

How can I map Ctrl-Alt-<letter> mappings in vim?

My keybindings are consistent and work across different operating systems, terminal emulators, browsers, tmux, etc. There are no clashes, but this sometimes means remapping things in some instances. ...
  • 229
0 votes
1 answer
28 views

Using the same key, move to the beginning of wrapped line, then to end of whitespace (soft BoL), then to beginning (hard BoL). And also for EoL

This is a feature that notepad++ has: when in a wrapped line, the first press of <Home> sends you to the beginning of the wrapped line. The second press sends you to the beginning of the text (...
  • 11
0 votes
2 answers
86 views

How to use <c-i><c-o> in terminal mode to jump to/from next/previous cursor position?

When in terminal mode, I would like that <c-i> and <c-o> work like in insert mode, i.e. the cursor jumps to its next/previous position in accordance with the jumplist. How to make this to ...
  • 241
0 votes
1 answer
24 views

MacVim: <Delete> key does not work in a terminal window

I happened to find that we may open 'Terminal windows' in Vim and am happy to stop using terminal app. (It's available in v8 and v9) However, when I have a typing mistake, pressing Delete key does not ...
1 vote
1 answer
307 views

What's the reverse action of ctrl-y?

As title. Just like the case where <C-n> and <C-p> is a pair. I would like to know how to scroll down one line at a time.
  • 1,131
0 votes
2 answers
111 views

Remap line completion to Ctrl-X

I am trying to remap the line-completion command (^X^L) to the simpler ^L (or Ctrl-L, or <C-L>). VIM's help (see :h ins-completion) suggests the following : :inoremap ^L ^X^L I tried adding ...
  • 1,739
0 votes
1 answer
29 views

How to make % motion work with quotes?

Is it possible to have % motion work with matching quote " or '? For example if we have text: "Lorem ipsum is placeholder text (commonly used in the graphic), 'print, and publishing ...
  • 1,355
1 vote
1 answer
298 views

Change the keys for accepting coc dropdown?

When I type in Vim, I get autocomplete from coc. To accept one of the items on the list I need to press Ctrly. I would like to change this button to Enter but I cannot figure out how to do so. I do ...
0 votes
1 answer
73 views

How to remap default vim text-object keys to different keys like ' to n

I use ci', va" pretty often, I would like to map text-object keys like " ' to more accessible keys like m, n since writing cin, vam is much easier than ci' va". I tried the following ...
2 votes
1 answer
150 views

Mappings that work in nvim not working in vim [duplicate]

I have these key mappings that I use a lot in nvim, but they don't work in vim: " Move lines with Alt+Shift+j/k nnoremap <A-S-j> :m .+1<CR>== ...
  • 229
1 vote
1 answer
76 views

Small issue when running Python code straight from VIM

I want to be able to set up the hot key \\ to be able to write and run python script from VIM without each time having to type in :w :! python3 file.py What I have done so far is pasted the following ...
  • 115
1 vote
1 answer
91 views

Mapping snippet trigger in visual mode

I'm using the UltiSnips plugin. When selecting text, you can press the trigger key to enter Insert mode, and the deleted text can then be used in a subsequent snippet. The snippet I'm using is as ...
  • 33
2 votes
1 answer
100 views

How can I have <C-E> and <C-Y>'s normal mode functionalities also work in insert mode?

Once I've asked a general question about special characters, but I've not really pulled anything out of it. So now I'm asking a very specific question. I want to have Ctrl+e and Ctrl+y behave in ...
  • 2,014
0 votes
1 answer
28 views

Remap 'diffget' and disable the binding to 'do'

Since the keys o and p are close and sometimes I mistype them. I would like to remap diffget and disable do.
0 votes
2 answers
31 views

How to put a text object under the cursor into an cmdline-mode command?

I'm using neovim v0.8.0 (nightly build) on Arch Linux. When in my plugins.lua where I have all my nvim plugins listed, I want to be able to use gX to open user/repo in my browser as https://github.com/...

1
2
3 4 5
29