in reply to Adding '#' in the beginning of each line

This seems like a fairly pointless exercise, here's how I'd solve it: I bet someone'll tell me theres a "comment-buffer" now!

Caveat, only works on modes where emacs thinks the comment-char is "#".

C.

  • Comment on Re: Adding '#' in the beginning of each line

Replies are listed 'Best First'.
Re^2: Adding '#' in the beginning of each line
by GrandFather (Saint) on Aug 16, 2006 at 09:56 UTC

    Using Komodo I'd:

    • ctrl-a
    • ctrl-3

    although that may not place the # as the first character of each line - it tends to follow indentation and will be the first non-whitespace character on each line

    Update Actually ctrl-3 does place a comment character at the start of each selected line. I was confusing the behaviour with Visual Studio which tends to follow indentation when you use ctrl-k ctrl-c.


    DWIM is Perl's answer to Gödel
      In /g?vim/:
      :%s//#/

      s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
Re^2: Adding '#' in the beginning of each line
by lidden (Curate) on Aug 16, 2006 at 19:29 UTC
    ctrl-x h # marks the whole buffer
    ctrl-x r t # runs the command string-rectangle. Useful when you want to insert something thats not starts a comment
      I've not used the string-rectangle command before - thanks for a great tip in an unexpected place!