I like CMD + D to select the next identical selection, OPT + DOWN/UP to move the selections down or up a line, SHIFT + OPT + DOWN/UP to duplicate the selection, and CMD + / to turn the line into a comment. How bout you?

  • spartanatreyu@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    For awesome shortcuts, you need to look at emacs.

    What do you mean?

    Every example you went through is already there without emacs.

    (P.S. Jump to Matching Bracket is actually Cmd-Shift-\)

    • tgv@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Obviously every example is for vscode. It’s what the poster asked.

      Emacs has better shortcuts, hands down. And you can record them into a macro, which you then can assign to another shortcut. You can also write functions in lisp, and assign those to shortcuts. And you can pass arguments to shortcuts. E.g. ^I means indent selection, but if you add ^U plus a number before it, it’ll indent the selection with that number of spaces.

      • spartanatreyu@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Ah I misread your comment. I thought you were suggesting that vscode users turn on emacs shortcuts to gain shortcuts that were already in vscode.

        I’m not familiar with any emacs macros, they seem like a more quick-and-dirty version of what vscode has going on with it’s extensions.

        Your indent example would be easier in vscode, since in vscode land you only need to make a selection then press Tab, and the LSP will automatically indent it to the correct level. And if you have a formatter installed, simply saving the file will format the file (indentation included).

        But I’m guessing you included the indent example to show how to pass in an argument.

        VSCode can do similar things, but it’s not exactly the same. I use the following

        • Emmet
        • Find (with regex)
        • Fold Level “n”
        • Snippets with tab-stops
        • tgv@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          Emacs is completely programmable. Everything is written in LISP, and everything can be overruled. You can make the ‘a’ key insert the character ‘a’, but 1 in a 100 times insert ‘b’. Emacs is the originator of incremental regex search, it had auto-complete long before even Visual Studio, and it has more than one way to use snippets. It doesn’t simply have levels of indent and regions, but an extensive org-mode that can do the weirdest things wit them. You can select a piece of text, pipe it through a shell command, and have it replace the original. It has a symbolic expression solver! But that comes at a price: emacs is complex. But if you want to have an idea of how flexible an editor can be, take a look. It’s still going strong, despite its age.