Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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

by castaway (Parson)
on Aug 16, 2006 at 09:25 UTC ( #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 "#".


  • 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 (Sage) 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/:

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?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2020-06-01 14:28 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (2 votes). Check out past polls.