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

vi-mode: ^D logs you out. #2219

Closed
newhook opened this issue Jul 17, 2015 · 8 comments
Closed

vi-mode: ^D logs you out. #2219

newhook opened this issue Jul 17, 2015 · 8 comments
Assignees
Milestone

Comments

@newhook
Copy link

newhook commented Jul 17, 2015

It should erase to the end of line.

@faho
Copy link
Member

faho commented Jul 17, 2015

It logs out, yes, but why should it "erase to the end of line"? That's what "D" (i.e. shift and "d") should do, in normal mode, and it does.

What ^D (i.e. "\cd" in fish's notation and "C-d" in emacs') does in vim (with an empty vimrc) is in normal mode scroll down a page/screen, keeping the cursor at the beginning of the line. In insert mode, it shifts the current line to the left. Neither of which is particularly applicable to a shell.

What does it do in e.g. zsh's vi mode?

@newhook
Copy link
Author

newhook commented Jul 17, 2015

Yes, sorry you are completely correctly. However, what ^D does in bash is not boot you out :) It tries to run the current command.

@faho
Copy link
Member

faho commented Jul 17, 2015

Okay, in zsh, after bindkey -v, in both input and normal mode ^D lists options for what's at the cursor (though I can't figure out how to use it). bindkey calls it "list-choices".

In bash's vi-mode (set -o vi), in both ^D is essentially the same as return/enter - it executes the current line. (Edit: readline calls it "vi-eof-maybe", though I can't find documentation)

(All this is through trial with bash 4.3.39, readline 6.3.008, zsh 5.0.8 on archlinux)

So now that we've found out that apparently there's no standard way to handle "^D" in a shell vi-mode, we should think about what it should do. What's a nice thing to have bound to ^D?

@newhook
Copy link
Author

newhook commented Jul 28, 2015

Not log you out! :)

@faho
Copy link
Member

faho commented Aug 4, 2015

How about just doing the same thing it does in emacs mode? ("delete-or-exit", though I can only get it to do the "or-exit" part, it does nothing instead of deleting if the line isn't empty)

See #2255 - if we don't have a compelling alternative, the vi bindings should do what the default bindings do.

@onnodb
Copy link

onnodb commented Aug 6, 2015

Personally, I really like ^D for logging out. For completeness: ^D actually inserts an "end-of-file" character, which is interpreted by some shells as an exit or logout command. In Bash, it's actually also a known behavior, albeit a behavior that's disabled in most default configurations by setting set -o ignoreeof in BASHRC.

@pickfire
Copy link
Contributor

^D in zsh vi-mode:

  • Logs you out if no command is given.
  • Complete the command if a command is given.

^D in bash vi-mode:

  • Logs you out if no command is given .
  • Execute the command if a command is given.

@floam floam modified the milestone: fish-future Jul 5, 2016
@krader1961 krader1961 added this to the 2.6.0 milestone Mar 17, 2017
@krader1961 krader1961 self-assigned this Mar 17, 2017
@krader1961
Copy link
Contributor

Yes, [ctrl-D] should only cause the shell to exit in vi normal (i.e., command rather than insert) mode if the command line is empty. Why aren't we fixing such trivial issues sooner?

@faho faho closed this as completed in b651725 Mar 17, 2017
develop7 pushed a commit to develop7/fish-shell that referenced this issue Apr 17, 2017
This just removes the special vi binding and hence falls back upon the
shared one.

Fixes fish-shell#2219.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants