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
0answers
27 views

Modifying 'showcmd' output

The documentation for g@ shows an example where <F4> is remapped to count spaces corresponding to the subsequent motion, using 'operatorfunc' and g@. The usage of g@ in the mapping results in ...
0
votes
1answer
270 views

Neovim: Select an autocomplete option with <tab> instead of <return>

In the example below, how do I use <tab> to select HttpResponse the item instead of <enter>? I'd like to make this change permanent. This is using Kite within vim in case it matters.
1
vote
1answer
87 views

Mapping multiple commands to `inoremap`

I'm trying to map a function to <CR> but the problem is, that another plugin already mapped something to it. So that's the code from me: function Test() echom "Test succeeded!" ...
0
votes
2answers
100 views

Can I replace multiple lines with a single line break?

A common operation for me is V <movement commands> d k o ESC to delete a bunch of lines and add a newline. Is there a quicker vim way to do this?
0
votes
1answer
53 views

noremap in .vimrc for YouCompleteMe does not work

noremap <leader>gdf :YcmCompleter\ GoToDefinition<cr> noremap <leader>gdc :YcmCompleter\ GoToDeClaration<cr> noremap <leader>gi :YcmCompleter\ GoToInclude<cr> ...
0
votes
0answers
25 views

the meaning: 'termwinkey' CTRL-\ send a CTRL-\ to the job in the terminal

In the manual: 'termwinkey' CTRL-\ send a CTRL-\ to the job in the terminal It don't explain what CTRL-\ mean for the job in the terminal,it means stop the job or something else?
0
votes
1answer
49 views

How to delete a WORD in insert mode?

I know that I can press Ctrl-W to delete a word in insert mode, but how would I delete a WORD? For example, with this text foo.bar.baz ^ (cursor position) the command should delete all the ...
0
votes
1answer
95 views

What keys on my keyboard is <M-n>?

Stupid I know, but I can't find for the life of me what keycombination the <M-n> mapping is. :bn<CR> is mapped to <C-n> wich is ctrl+n :bp<CR> is mapped to <M-n> wich is ...
1
vote
1answer
43 views

Running pdflatex using a key mapping

I have a latex file which includes multiple figures. These figures are kept in different directories whose path is given in the latex file using the graphicx package: \usepackage{graphicx} \...
0
votes
1answer
43 views

Determine if there is a matching character on the current line past the cursor

I am trying to make a mapping that performs what f would normally do if there is a character match on the line, and to do something else if no such character exists. For example, suppose if I had the ...
1
vote
1answer
152 views

How to escape pipe (|) in mapped substitution?

I wanted to define a mapping for flipping the texts on both sides of a pipe (|) character. For example, substitute dům|Haus with Hause|dům The substitution command :s/\([^|]\+\)|\([^|]\+\)/\2|\1/ ...
-1
votes
1answer
35 views

mapping to delete and yank multiple lines e.g. d4y instead of d4d

In my vimrc I have nnoremap d "_d nnoremap yd dd to not save lines when I delete. Is it possible to create a mapping that when I press e.g. d4y it will cut 4 lines and save them into buffers? I ...
1
vote
0answers
34 views

Can't remap to <C-)>

I'm using a French keyboard, and <C-]> to access to a tag definition is cumbersome. You need AltGr+] to access the ] character, so the whole thing is 3 keys pressed at the same time: Ctrl+AltGr+]...
1
vote
1answer
25 views

Synchronize the scroll offset of a vertical split

Set up Left (L) and right (R) are two vertically split windows displaying the same file. No other windows exist in the tab. The uppermost displayed line in L is x (Lx) and the uppermost line in R is ...
0
votes
0answers
19 views

placeholder after every & in tex.snippets

This is a snippet from tex.snippet of honza/vim-snippets/Ultisnips. As per the number of items inserted in $2, I will get & in 2nd line. But, I am looking for & $i so that I can jump to that ...
0
votes
1answer
17 views

Make j and k act character-wise when used with operators

When I use j or k with operators, they make the operator act line-wise - acting over two whole lines, as if I had used Vj/Vk. I want them to act character-wise so that they act until the current ...
0
votes
0answers
77 views

inoremap doesn't work

Question summary Currently I'm writing a pull request for this vim plugin which should set commas and semicolons automatically. At the moment it looks if it should set a comma/semicolon/double point ...
0
votes
0answers
58 views

Why C-0(zero) in insert mode is not working?

I have mapped some shortcuts to help me in insert mode and one of them is not working. " Go to end of line on insert mode inoremap <C-e> <C-o>$ " Go to beggining of line on ...
1
vote
1answer
140 views

imap <expr> call multiple functions

I want to map <CR> to call multiple functions e.g. Func1() Func2() Func3() I tried: imap <expr> <CR> Func1() Func2() Func3() But I got "E15:Invalid expression" How can I ...
0
votes
1answer
84 views

Listen to specifique key pressing

I'd like to call a (vimscript-) function, if I'm pressing the return key. Is it possible to do that in vim? Because currently this doesn't work: function Test() echom "test" endfunction ...
2
votes
1answer
112 views

Mapping specific for diff mode and vimdiff

My idea is that whenever &diff is true for a buffer, I would like some mappings to be active when that buffer is the current buffer. The following attempt works for when I open a session in diff ...
1
vote
1answer
28 views

Create mapping that works both with a motion and a count

I'd like to have a mapping that separates words, like this: noremap RJ :s/\>\s*\</\r/g<CR>='' I can do 3RJ with that. I can also create opfunc, so I can do RJ}: noremap RJ :set opfunc=...
0
votes
1answer
188 views

Run a command every time any key is pressed

I want to run a function every time the user presses any key. I have already looked through the autocommand documentation and there does not seem to be one for this. Is there any function I do not ...
0
votes
2answers
44 views

Inserting a future time

I would like to create a simple pomodoro timer I can insert into text files. Something like: Current Time - 10:15 End Time - 10:40 However I have not been able to find a good way to insert a future ...
0
votes
0answers
17 views

How to open terminal in split in vimrc with keybinding [duplicate]

I am trying to open a new terminal (size of 10) inside of neovim. I use the command, :split|resize20|term. It works well, but I want to make a hotkey to do this in my init.vim nnoremap <C-P> :...
1
vote
1answer
33 views

How do I find the mapping that is overriding Control-W =?

I am currently running a few plugins (git gutter, fugitive), and it appears that one of them has overridden the behavior of Control-W,= so that instead of making vertically split windows have equal ...
0
votes
0answers
33 views

Can Vim detect whether a key is being held down?

Triggered by this question on stackoverflow, I'm asking this question mostly for curiosity. Is there a way for Vim to detect if a key is being held down? I have the feeling that stuff is know to the ...
0
votes
2answers
103 views

What's the best way to swap words?

I'm familiar with ddp to swap lines, but what if I want to swap words on the same line? I found a Reddit post that linked to this wiki page that suggests dawbP as a word swap method, but this seems ...
0
votes
0answers
38 views

Why some shortcuts aren't listed on index.txt ? Is there a complete list?

The file index.txt is claiming to be a list of all commands, but some keyboard shortcuts are listed on other files and not here. And sometimes, the definition is a bit different in other files. Are ...
1
vote
0answers
83 views

What are the acceptable values for termwinkey?

What are the acceptable values for termwinkey? From VIM's documentation, it appears that any single keystroke (multi-byte or not) should be valid. However, setting it to <D-'> (my first choice) ...
1
vote
1answer
21 views

Simple way to store additionnal config in the scope of the actual directory [duplicate]

I have my .vimrc with some global/local configurations, but when I am working in a project, I know that I often create configs (settings, mapping, command, abbreviations, etc.) specifically for this ...
1
vote
1answer
38 views

Type into two places at once [duplicate]

I am working in macvim with a latex file where I have an index where terminology is being stored (using \usepackage{imakeidx} and \makeindex). I have a command for inserting terminology with emphasis ...
-1
votes
1answer
52 views

What is 3kA in this mapping?

I'm trying to understand how to make mappings in vim (particularly neovim). Searching, I’ve managed to do some of the things that I want, but I can't learn what everything means. Example: a latex ...
0
votes
1answer
47 views

How to return keybinding from a function?

I want the below function to return keybindings but all it returns is a string. nmap <expr> <space>t ManageTerminal() function ManageTerminal() if bufname('terminal') ==# 'terminal' ...
0
votes
0answers
43 views

How to bind <C-U> to <Cmd><BS> in vimrc?

I understand that <C-W> is backward-kill-word and I have bound this to shiftBS and it works. But now I want to bind <C-U> to cmdBS. Is this possible? If so, how can I do this?
1
vote
2answers
53 views

When using a recursive mapping, why is there no infinite recursion when RHS starts with LHS?

I noticed that the following mapping does not cause an infinite recursion (when pressing x). :map x x I didn't see anything in Vim's documentation that would explain this. Further experimentation ...
0
votes
2answers
123 views

How to backward-kill-word in Vim insert mode like zsh?

I'm re-learning Vim. My question is that I want to option + ⌫ to backward-delete a word in INSERT MODE. I've spent some days to achieve this (and succeeded) to my zsh shell through bindkey in .zshrc ...
0
votes
0answers
24 views

Command + Delete inserts a tab at the start of the line for some reasons

I want to delete everything from the point of the cursor to the front of line with Command + Delete on insert mode. So I wrote the following on ~/.vimrc. inoremap <D-Bs> <C-u> But this ...
-1
votes
1answer
37 views

Delete word or whole line part after cursor in colon-command mode with keybinding

I would like my NeoVim to have Emacs-style keybindings in all "direct input" modes, in particular - Alt+d and Ctrl+k for forward word and line part deleting. I've done it for insert mode as ...
3
votes
1answer
50 views

Skip to next batch of search results (or find next non-match)?

So you search /needle, and end up trapped in a haystack of result lines. Is there a quick way to skip to the first non-matching line (and then the next batch of results)? E.g. I'm viewing the results ...
0
votes
0answers
18 views

Shift+AnyLetter and Forward Slash Not Working on wsltty [duplicate]

I'm noticing errant behaviour with some standard key sequences with Vim 8.1 on wsltty. The correct behaviour is displayed when inside wsltty's standard terminal, so until proven otherwise I'm assuming ...
1
vote
0answers
67 views

Why is this mapping NOT working? [closed]

My long term goal is to swap the ` and \ keys on my keyboard. Everything else is fine. I am calling vim with vim -u NONE Gives me these maps: I do :map ` \ and get so the mapping has definitely ...
2
votes
2answers
36 views

Concatenate mapping with zt mapping

I'm using CoC and coc-python, and there is the gd mapping, which goes to the definition of a symbol. The mapping is defined as: nmap <silent> gd <Plug>(doc-definition) Now, I want to ...
1
vote
2answers
75 views

How can I turn these mappings into a vim function?

I use the following mappings to toggle relative numbers in visual mode: nnoremap <silent> v v:<c-u>set nonu rnu<cr>gv nnoremap <silent> V V0:<c-u>set nonu rnu<cr>gv ...
2
votes
1answer
90 views

langmap and maps from plugin

I have set up some langmaps, notably ü< and ó> on my Hungarian keyboard. I also installed machakann/vim-swap which binds g< and g> to swap arguments in a function. The plugin works with g&...
2
votes
1answer
64 views

nmap ú ] doesn't work as expected

The default keybinding of vim were quite obviously created with the US keyboard layout in mind, which make some of the default ones rather awkward on non-US keyboards. For example on my Hungarian ...
0
votes
0answers
24 views

Why can't map ctrl+. with <C-X><C-O>?

I map . with <C-X><C-O> in .vimrc: inoremap . <C-X><C-O> The map command inoremap . <C-X><C-O> take effect ,i want to map ctrl + . with <C-X><C-O>, ...
1
vote
0answers
35 views

Terminal window interprets quick initial q as macro record

I have a function that opens a terminal window running some program. The program is quit by pressing q. But when I press q in the terminal window shortly after (within 1-2 seconds) of it being opened, ...
0
votes
2answers
56 views

Bind a specific search to a map in normal mode

Specifically, I'm looking to bind the search /\(<<<<\|====\|>>>>\)/ (i.e. "find the next git merge boundary"). Ideally to <C-/> or <A-/>, but that part I'...
0
votes
1answer
195 views

When would I use append and when would I use insert?

I already know that a and i makes the cursor one space to the right and left respectively, but when would I use i to edit a file? Is there some special circumstance that makes insertion mode more ...

1 2
3
4 5
26