• beeng@discuss.tchncs.de
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    1 day ago

    Now I have four ways to get to the begining and end of a command line. I can press Escape,^ or Ctrl+a for the begining of the line, and Escape,$ or Ctrl+e for the end of the line.

    Bit suss on the ctrl-A start of line, because vim binding is A for append which is end of line.

    • c10l@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      3 hours ago

      Control-A and E should work in insert mode. That’s why OP mentions pressing escape before issuing the normal mode ^ and $ commands.

      In insert mode, some or most of the EMacs-style shortcuts work.

    • med@sh.itjust.works
      link
      fedilink
      arrow-up
      7
      ·
      1 day ago

      Ctrl +a and Ctrl +e for beginning and end of line are from Emacs.

      GNU Readline is what provides them in the bash. There’s a bunch of shortcuts worth learning in there!

      Most distributions I’ve tried use Emacs as the default shell binding style, some of the bindings are even available in things like appliance cli’s like Cisco IOS and clones.

      Bash supports vi mode too, you just have to switch to it.

      set -o vi
      

      ZSH uses zle (ZSH Line Editor) instead of Readline, but I assume the Emacs style bindings have been copied over to zle for muscle memory portability. You can switch the keymap in zle,

      bindkey -v
      

      or set your own!

    • BananaTrifleViolin@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 day ago

      Maybe I’m misunderstanding, but the commands would apply within the zsh, which is a bash alternative, not within the programmes running themselves?

      Or are you saying its sus because its illogical/confusing to have opposite uses for tgebsame shirt cut? I can see that as people using a terminal and launching vim would constantly be working against “muscle memory” each time they switch which would be annoying! Being familiar with keyboard shortcuts is what can make terminal based workflows so fast.

      • beeng@discuss.tchncs.de
        link
        fedilink
        arrow-up
        1
        arrow-down
        1
        ·
        edit-2
        1 day ago

        It was a little strange in the “line movement” part they were talking about setting vim navigation on the cmd line and then putting Emacs style as aliases, of which I said it’s a bit suss as it’s too close to vim append.