motion does not work properly in visual mode
See original GitHub issueSteps to reproduce:
- Open a new file with neovim plugin enabled
- type
iabc<Esc>yy99p
to insert 100 lines ofabc
- type
V
- type
M
, orL
, or<ctrl-f>
, or<ctrl-d>
Expected behavior: Lines from line 2 to the middle or last line of the screen should be selected.
Actual behavior: Only line 2 is selected, while the cursor is at the middle or the last line of the screen.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:12
- Comments:5 (3 by maintainers)
Top Results From Across the Web
motion does not work properly in visual mode #580 - GitHub
It's causing the cursor to move to the top/bottom/middle of the file and not the viewport. All reactions.
Read more >visual line mode is ended by inner block motion
Because, text-objects are supposed to work with visual-mode and after an operator, see :h text-objects .
Read more >What's causing this weird movement behavior in visual mode?
The problem is in visual mode. If I enter visual mode, then press w , the cursor moves down three lines, like expected....
Read more >:action commands don't work in Visual mode : VIM-958
You can see that it recognizes normal mode motion, but doesn't set visual mode one. upd, it seems that's not the case. for...
Read more >Mastering Visual Mode in Vim - DEV Community
To use visual mode operators, first visually select an area of text ( v/V/Ctrl-v + motion), then press a visual-mode operator key. That's...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1, I use
shift+V
(visual line) withctrl+d
orctrl+u
for half page selection most of the times.Only the viewport is moving, not the cursor.
It looks like this is because vscode intercepts these commands and does not update neovim after scrolling. The reason vscode intercepts these commands instead of delegating to neovim is, according to @asvetliakov, “cursor jitter” and other problems.
However, when I disable the interceptions, it actually seems to work alright.
Here is how you can do this:
Disabling H/M/L is a bit trickier, because it is defined here: https://github.com/asvetliakov/vscode-neovim/blob/ba50a353ee5b188d963be7561803f96a587b733f/vim/vscode-scrolling.vim#L25-L30
Adding this to the bottom of my init.vim seems to have solved it:
However, I’m not sure if that works 100% of the time, because it seems like in some cases unmapping does not seem to have an effect (#631). Let me know if it works for you.