Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Adding '#' in the beginning of each line

by castaway (Parson)
on Aug 16, 2006 at 09:25 UTC ( [id://567643]=note: print w/replies, xml ) Need Help??


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

This seems like a fairly pointless exercise, here's how I'd solve it:
  • Open the file in the emacs editor
  • Hit ctrl-home to get to the top
  • Hit ctrl-space to start marking a region
  • Hit ctrl-end to get to the end
  • Hit ESC-x to enter a command
  • type comment-region and hit return
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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://567643]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found