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
-1
votes
0answers
22 views

Mapping to <Esc> and <Return> not registering

I have this set of maps: nnoremap <C-s> :^[:w snoremap <C-s> <Esc>:w<Return>v<C-o> xnoremap <C-s> <Esc>:w<Return>v inoremap <C-s> <Esc>:w&...
0
votes
1answer
25 views

VIM: How to call a vimscript function after press a shortcut or execute a command?

I want to know how to call a function after a normal or Ex command. Examples: bind a function to search command. When I input /xxxx to search xxxx, also call the function. press * to highlight ...
0
votes
1answer
23 views

How to jump to specific line of a file when file path and line number is given?

I have a filename and its line provided in this format, e.g.: ./my_dir/my_filename.py:20: When I move on the filename and press gf I jump to that file, however the cursor stands on line number 1, ...
0
votes
1answer
21 views

How do I enable mouse in netrw only (terminal vim)?

I would like to be able to use my mouse to scroll and click on directories to expand them in netrw. I don't want the mouse to be on for any other filetype/buffertype, so that I can still highlight/...
1
vote
1answer
22 views

How to map UTF-8 symbols to numbers in command-line mode?

Sometimes I change input source (keyboard language) and my number buttons get mapped to rarely used UTF-8 symbols, e.g. 1 gets changed to ą, 2 to č, 3 to ę, etc. I have managed to map them in normal ...
0
votes
2answers
48 views

Mapping with motion ip

I'm trying to create my own mapping with motion in Vim after reading this stackexchange question. I'm using the plugin vimtux to send code to specific tmux instances and I now want to be able to do ...
0
votes
1answer
17 views

Sending two keys in series during autocompletion confirmation

I have the following mapping: inoremap <expr><CR> pumvisible() && complete_info().selected != -1? "\<C-y>" : "\<CR>" inoremap <expr><Space&...
0
votes
0answers
23 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 ...
-1
votes
1answer
37 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
35 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
1answer
46 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
25 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> ...
-1
votes
0answers
18 views

hot key enter into ex mode from terminal mode in multiple window

I split left-right window , left is a python terminal window, right is a vim window,when cursor locate in the left, move cursor into right and type : to enter into ex mode; or ctrl+w w to enter into ...
0
votes
0answers
24 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
34 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
33 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
41 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
32 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
36 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
25 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
27 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+]...
0
votes
1answer
12 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
14 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 ...
-1
votes
0answers
16 views

Find localleader mapping [duplicate]

I have both leader and localleader mapped to space. If I type space + t, the fzf file browser opens (it's using the leader). If I'm however in a clojure file, there is a small delay, which I assume is ...
0
votes
1answer
16 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
41 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
47 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
27 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
72 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
48 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
23 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
46 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
38 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
32 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
27 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
51 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
32 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
23 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
19 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
34 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
44 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
42 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
28 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
33 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
44 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
22 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
23 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
49 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
2 3 4 5
24