23

Selecting lines in nano can be achieved using Esc+A. With multiple lines selected, how do I then indent all those lines at once?

  • 1
    Highlighting is working now by just using Shift + Arrow-Up or Arrow-Down at least since Nano version: 2.9.1 – nath Jan 9 '18 at 12:08
22

Once you have selected the block, you can indent it using Alt + } (not the key, but whatever key combination is necessary to produce a closing curly bracket).

  • 1
    I am trying this without success on OSX Mavericks. Instead pressing alt+} results in an opening (or closing depending on whether shift is held down at the same time) quote character being inserted. – Ben Dec 22 '13 at 15:56
  • @Ben It works for me, perhaps your terminal emulator or window manager is eating the meta key? I don't know about how the OSX terminal works, though. – Chris Down Dec 22 '13 at 15:58
  • 1
    @Ben From a quick Google it seems that the Mac terminal is the culprit, see here: blog.remibergsma.com/2012/01/30/… (for future readers, the solution: Terminal > Preferences > Settings > Keyboard > Check "Use option as meta key") – Chris Down Dec 22 '13 at 16:00
  • 8
    Alt + } didn't work for me, could be my putty settings, however Alt + Shift + { did! – jtzero Jun 12 '14 at 14:15
  • 2
    @David Alt + { :-) – Chris Down Aug 3 '15 at 7:22
2

If you're using macOS and haven't reset your meta key in the terminal, the command for this will be Esc+}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.