I'm trying to add a simple mapping to visually select recently pasted text. However, even though
`[v`] is working correctly in a vim session, when I try to use it in my .vimrc file, it doesn't work. Other mappings work correctly, though.
This is the mapping as described here:
nnoremap gV `[v`]
What could be causing this issue? I tried to disable the plugins but the issue still occurs.
By the way, the keyboard I'm using was configured to include a dead tilde. I just changed it to type backtick
` instead of
I also tried to change the encoding using
set encoding=utf-8 but didn't help.
Since I can't escape backticks in the comments, I will be answering here.
@Nobe4 I'm just adding
nnoremap gV `[v`] at the end of my .vimrc file and then after pasting some text, I press gV. As I said, other mappings are working but this one doesn't do anything noticeable. I also tried to use gp as a replacement, but then vim listens to the p command and simply pastes again the same text.
@Christian Brabandt The thing that doesn't work is the mapping from gV to
`[v`]. If I type
`[v`] in some file, it does visually select the pasted text as intended.
@Nobe4 helped me to figure this out. The issue was that vim wasn't responding to mappings containing two (or more) characters. The issue was caused by the timeoutlen option. I'm using set timeoutlen=50 to remove a delay after pressing escape in order to change to normal mode. In the meanwhile, I change it to timeoutlen=300 but this has a noticeable delay in the status bar. Any suggestions are welcomed.
Okay. I'm using
set timeoutlen=1000 ttimeoutlen=10 and now the delay is fixed and mappings are working correctly. Hopefully, this won't have unintended effects down the road.