Questions tagged [keymap]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
37 views

How to fix Leader Key Beep in Vim?

I cannot get the leader key working in vim. I have been troubleshooting for quite some time. Stuff I did already: Mapping leader key to another key :PlugInstall --> Already Installed x Plugin ...
3
votes
0answers
36 views

Maps literally read < and > instead of the actual character

Here's the situation: Entire .vimrc: inoremap a <CR> Action: user types ia to enter INSERT mode and type a Expected result: a CARRIAGE RETURN is entered into the document Actual result: the ...
1
vote
1answer
19 views

How do I map multiple replace commands in visual mode

I'm trying to edit my init.vim to allow quick, custom retabbing with one key. My current attempt is as follows (the replace text in the last command is a tab character inputted in insert mode): ...
1
vote
1answer
24 views

How to use the result of a function in a Vim keymap?

I have a function in Vim script that returns a string. " Return first directory with ".git" folder, if none is found " return the current directory function! s:project_root() for vcs in ['.git']...
2
votes
0answers
35 views

How do I delete a block a text using the mouse cursor?

Yes, I know this is unconventional, but I just want to know. When I right click on a chunk of higlighted text, the dropdown doesn't show any option for deleting - just copy, copy as html...show ...
2
votes
1answer
21 views

Auto replace special programming characters

Programming in Javascript and similar syntax languages we use a lot of {} and (), more so than [] and the 90. Therefore we end up using SHIFT a lot. Is there a way to make it so that when I type [ ...
0
votes
0answers
48 views

Change the behavior of CTRL-X submode key bindings

I wanted to change the behavior of some keys in the :h i_CTRL-X submode. For example, I wanted to use the following: inoremap <expr> <C-f> pumvisible() ? "\<C-x>\<C-f>" : "<...
2
votes
1answer
51 views

NERDTreeMenu Remapping

I'm a Colemak keyboard layout user and I recently started to learn and use Vim. I was able to map the arrow keys in the normal mode by putting custom mappings such as noremap u k in .vimrc (because ...
1
vote
1answer
26 views

Differences between tick and quote as jump to mark

I wanted to map ' to " because I think both ` and ' does the same thing. But I don't want to shadow anything without knowing properly. So, any differences between ` and '?
0
votes
1answer
57 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
33 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 ...
2
votes
1answer
61 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
56 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
37 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
42 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
113 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
37 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
34 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
28 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
116 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
56 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
88 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
41 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
43 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
67 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
126 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
44 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
65 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
84 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
93 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
4answers
289 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
113 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?
1
vote
2answers
142 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
126 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
137 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
141 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
339 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
50 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
526 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
547 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
513 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
130 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
167 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
2k 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
847 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
88 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
1k 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
68 views

Remapped keys won't work when combined

I have these lines in my .vimrc: " Remap movement nnoremap j h nnoremap k j ...
4
votes
1answer
915 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