Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
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.
0
votes
Prevent the cursor from moving to the start of the yanked text?
I have come up with a simpler solution using autocmd event TextYankPost, it works fine for me:
nnoremap y myy
augroup restore_after_yank
autocmd!
autocmd TextYankPost * silent! normal `y
augroup …
1
vote
Other ways to exit Insert mode besides Escape
To overcome the lagging caused by naive mapping inoremap jk <ESC>. I have written a plugin called better-escape.vim. Here is how to use it:
let g:better_escape_shortcut = 'jk'
let g:better_escape_inte …
1
vote
3
answers
1k
views
Easy way to get character before cursor character in insert mode?
I am trying to write a function for insert mode mapping in which I want to get the character before the cursor character. For texts that are purely ASCII, this is easy, since its byte index is the cha …
0
votes
Easy way to get character before cursor character in insert mode?
This is my implementation. First, we find the character index for cursor char, and we can know the character index of pre-cursor char. Then we can use strcharpart() to get that character.
function! Ge …
0
votes
1
answer
259
views
why does vim insert a range when we press a number before pressing colon to go to command li...
I was trying to make a mapping to run a command that takes a count, something like the following:
nnoremap gb :execute('buffer ' . v:count)<CR>
When I run the mapping, I see the following error:
E48 …
2
votes
How can I easily move a line?
The other answers using :move haven't considered the edge case where you are on the first line or last line of the buffer and press the shortcut, you will see error messages saying the address is inva …
3
votes
1
answer
78
views
pressing keys in visual line mode will leave this mode?
I find that in visual line mode, if I press a shortcut to print the current mode, it will print n instead of V. Is this the expected behavior?
My mapping:
xnoremap <a-j> :<c-u>echo mode()<CR>
Then se …
-1
votes
How can I discourage myself from using ':q', ':wq', etc. to quit vim?
I am currently using mapping to quit vim or neovim. The mapping I use is:
" Saves the file if modified and quit
nnoremap <silent> <leader>q :x<CR>
" Quit all opened buffers
nnoremap <silent> <leader> …
0
votes
Move rest of line inside a closed pair?
Maybe you can define another mapping for <M-e> mapping in insert mode. imap <M-e> shows that it is mappped to <C-R>=AutoPairsFastWrap()<CR>. So you can define another key map for that, for example:
…
1
vote
How to map Ctrl-(?
Try inoremap <C-9> ()<Left>. It seems that Vim does not recognize the ( in insert mapping.
3
votes
4
answers
4k
views
How to change word under cursor to upper case in command mode with shortcut?
I want to set up a shortcut to make word under the cursor upper case in the command mode. I know that you can get the word under the cursor with expand("<cword>"). But I am not sure how do I translat …
0
votes
1
answer
120
views
mapping does not work even if I have set it up in config file
I am using Neovim on Windows using Cmder console emulator. I find that using [NUM]<Ctrl-6> to change to buffer [NUM] does not work on Windows. Following discussions here. I have set up a mapping:
nno …