visual mode: gj/gk not working in wrapped lines
See original GitHub issueThis is based on issue #90 but for visual mode instead of normal mode. Currently it is not possible to jump over wrapped lines with gj/gk when visual mode is on.
I tried to copy these lines: https://github.com/asvetliakov/vscode-neovim/blob/6469c216f30c4bf29d5718f6d3fe99d517a33db0/vim/vscode-motion.vim#L15-L16
and changed them to vnoremap:
vnoremap gk <Cmd>call VSCodeNotify('cursorMove', { 'to': 'up', 'by': 'wrappedLine', 'value': v:count ? v:count : 1 })<CR>
vnoremap gj <Cmd>call VSCodeNotify('cursorMove', { 'to': 'down', 'by': 'wrappedLine', 'value': v:count ? v:count : 1 })<CR>
Afterwards the movement works but it doesn’t update the selection. Here the cursor is in line 17 but the selection is still stuck in line 18.
I checked the API and there is the select
argument for cursorMove.
vnoremap gk <Cmd>call VSCodeNotify('cursorMove', { 'to': 'up', 'by': 'wrappedLine', 'value': v:count ? v:count : 1, 'select': true})<CR>
vnoremap gj <Cmd>call VSCodeNotify('cursorMove', { 'to': 'down', 'by': 'wrappedLine', 'value': v:count ? v:count : 1, 'select': true})<CR
But i get an error that the variable true
is undefined: emsg: E121: Undefined variable: true
Any ideas how i can use the select
argument?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
visual mode: gj/gk not working in wrapped lines #576 - GitHub
This is based on issue #90 but for visual mode instead of normal mode. Currently it is not possible to jump over wrapped...
Read more >how can i intuitively move cursor in vim?(not by line)
If you want to navigate wrapped lines use gk or gj , or just as some like it, map it to for example,...
Read more >neovim - Wrapping comment in visual mode not working with gq
I'm using neovim. When I visually select a comment in Python that is longer than my textwidth setting, and press gq , it...
Read more >Visual Line Mode (GNU Emacs Manual)
This makes the text easier to read, as wrapping does not occur in the middle of words. Word wrap is enabled by Visual...
Read more >Wrap text in a cell - Microsoft Support
Microsoft Excel can wrap text so it appears on multiple lines in a cell. ... If all wrapped text is not visible, it...
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
That’s too bad. Would love to see this functionality added into VSCode Neovim.
Not a priority, but the problem is that vscode moves the cursor but then does not tell nvim about the new cursor position to extend the visual selection. Either the gj/gk hack could be removed, or there needs to be some code that extends the visual selection.