-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yW (yank WORD) not working properly in normal mode #1448
Comments
@ferdinandyb I think there's a misunderstanding.
So pressing p.s.: I was implementing this based on what I was reading in the vim documentation. However, trying it out right now in vim (and Contour), I noticed a different in vim itself. vim itself behaves differently in marking the range for So not sure how to process on this ticket. If vim and neovim are doing it that way, then we should adapt of course. Because it's meant to be inspired by vim. It should feel the same then. |
@ferdinandyb I think there's a misunderstanding.
- `w` refers to the beginning of the next word (using word delimiters, such as `.`, `,`, `:`, space, etc..
- `W` refers to the beginning of the next word (using whitespace delimiters only)
- `e` refers to the end of the current word (delimiters as in `w`)
- `W` refers to the end of the current word (delimiters as in `W`, i.e. whitespaces only)
So pressing `yW` will yank everything from the current cursor position to the beginning of the next word whereas `yE` (and similarily `ye`) will yank from current position to the end of the current word.
p.s.: I was implementing this based on what I was reading in the vim documentation. However, trying it out right now in vim (and Contour), I noticed a different in vim itself.
vim itself behaves differently in marking the range for `yW` vs `vW`. This is a WTF for me. I may have accidentally skipped reading something in the docs that would describe this, but to me that sounds a bit weird. Not sure sure why `yW` and `vW` in vim (neovim for me) do operate on a different range, that is, `yW` excludes the right boundary whereas `vW` does indeed include it (as we do in Contour, however, for both cases).
So not sure how to process on this ticket. If vim and neovim are doing it that way, then we should adapt of course. Because it's meant to be inspired by vim. It should feel the same then.
Ok, so I agree, this is rather confusing ... I did a little search and found this:
https://vi.stackexchange.com/a/24731/25312:
In Vim motions can be either inclusive ("include the rightmost character"), or exclusive ("exclude rightmost character"). w is made exclusive (so you delete exactly four words: "this" "is" "a" "test"). If you want to make it inclusive add :h o_v to the target command: d4vw.
Now, in Visual mode all motions are governed by a global option called :h 'selection'. By default, it's :set selection=inclusive, so ! gets into the visual selection. Add :set selection=exclusive to your vimrc if you don't like it.
I must say, I am a bit confused now, because also W moves to _next_ WORD, but yW yank until the end of the current WORD. I'm confused enough to make a question on stackexchange: https://vi.stackexchange.com/q/44054/25312.
In general I'd say it's best if contour does "default vim", but I would probably like to understand this a bit better now before I say anything :D
|
Keep me posted, please. :) |
will do :)
|
evil-mode behaves similar to contour, makes selection until the next word |
The vim question is still ongoing, but two comments came to mind:
|
Here's the detailed answer: https://vi.stackexchange.com/a/44056/25312. In short:
I guess the question is, how close you want to copy vim. I personally think, it should be as close to vim defaults as possible, but that does entail some additional complexity right now. |
Contour Terminal version
Contour Terminal Emulator 0.4.2.6408-prerelease
Installer source
Github: CI actions
Operating System
Windows 11
Architecture
x86-64
Other Software
No response
Steps to reproduce
Run something like
echo "hello 1236"
, enter normal mode, search forhello
and then yank WORD withyW
.Expected Behavior
I would expect "hello" to be yanked.
Actual Behavior
"hello 1" is yanked
Additional notes
No response
The text was updated successfully, but these errors were encountered: