Keyboard shortcut to “Comment” a line in NANO?

The simplest workaround I’ve found:

  • Comment-out:
    set the cursor at the first row that should be commented-out
    hit twice ‘M-R’ (or ‘Alt-r’; in order to Replace a RegExp)
    Search for: ‘^’
    Replace with: ‘# ‘
    Replace this instance?: ‘y’
    press ‘y’ for each row to be commented-out

  • Comment-in:
    The same procedure, replacing ‘# ‘ by ”

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)