Skip to content
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

[editor] Add 'gg' and 'G' to vicmd mode #1502

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

samcv
Copy link
Contributor

@samcv samcv commented Nov 2, 2017

G Moves to the start of the last line if no numeric argument. Otherwise
goes to the line number. 9G goes to the 9th line. 1G to the 1st line.

By default "gg" is bound to beginning-of-buffer-or-history for viins, which
causes inconsistent things to happen (moving to the first history entry).
Bind move-to-buffer-beginning so it acts more like vim

Also: Add additional key combinations

Add ControlUp, ControlDown, ControlHome, ControlEnd, ControlInsert,
ControlDelete and add additional ones for ControlPageUp and
ControlPageDown.

Add ControlUp, ControlDown, ControlHome, ControlEnd, ControlInsert,
ControlDelete and add additional ones for ControlPageUp and
ControlPageDown.
G Moves to the start of the last line if no numeric argument. Otherwise goes
to the line number. 9G goes to the 9th line. 1G to the 1st line.

By default "gg" is bound to beginning-of-buffer-or-history for viins, which
causes inconsistent things to happen (moving to the first history entry).
Bind move-to-buffer-beginning so it acts more like vim
@hlecuanda
Copy link

@belak I've triaged this changes, being a long time user of vi mode in zsh.

The standard behavior zle's widgets, oddly, feels more natural as the outcome depends on what is on your buffer. On an empty buffer, its almost expected to just go and get history. this new widget forgoes that behavior and could even feel as a regression. I guess its a matter of habit or getting used to it. but other widgets with a vertical motion are bound by default to overflow to history (cfr: up-line-or-history down-line-or-history etc) just my $0,02

@belak
Copy link
Collaborator

belak commented Feb 7, 2018

I'm not sure what to do about this... because gg and G in vim are definitely start and end of the buffer in vim. There's ^ and $ for start and end of line which I assume work in zsh as well (I think I use vim-rsi which binds C-a and C-e for this as well). That being said, there isn't the same concept of history in vim - I'd like to see a compromise somewhere. However, since I don't use vi-mode in zsh, it should probably be someone else making this decision.

@samcv
Copy link
Contributor Author

samcv commented Feb 7, 2018

@belak this could be a configuration option then?

@belak
Copy link
Collaborator

belak commented Feb 7, 2018

Personally, I think the change makes sense, now that I understand it... I'm not sure about the history argument, but that can always be changed later.

What about enabling this change by default and providing an option which disables any overriding default vi-mode keybinds? I think that's the method I'd go for.

@samcv
Copy link
Contributor Author

samcv commented Feb 7, 2018

@belak or would it be better to only do the history functions when nothing is in the buffer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants