Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I can edit the terminal input line with full vim-mode in my shell (zsh). In fact, in normal mode I can even hit 'v' and edit the line in a full vim session to zip around however I want, do completions, etc. It's pretty close to the platonic ideal method of input I could imagine.


This is also available in bash. In emacs input mode (aka the default) one can press C-x C-e to edit the current command in an editor.

`v` is also available in vi input mode.


The biggest problem with zsh's vim mode is it's actually vi mode. I constantly want "])" and "aw" motions but they're not implemented :(

But, like, this is obviously an entirely different class of problem from TFA, which is a skill issue.


I’m also using vim mode in zsh with simply "bindkey -v". I’m interested by your "v" as full vim session shortcut. Do you mind sharing the config?


It's this section of my .zshrc here:

  # edit long commands
  autoload -U edit-command-line
  bindkey -M vicmd v edit-command-line
That `edit-command-line` autoload script is part of zshcontrib and should be installed by default on any recent zsh distribution. I've never encountered a server I've ssh'ed into that didn't have it. Enjoy :)


If someone from the future read this, I needed to add one more line to make it work:

autoload -U edit-command-line

zle -N edit-command-line

bindkey -M vicmd v edit-command-line


Thanks. Also learned about "fc" to edit the last command entered.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: