in reply to [Golfing] Uncommenting a block

With vim it's easy to insert blocks of text, I usually comment out stuff with a # and then a blank.

You can mark the block with Ctrl+v, then go to the first column, type I#<blank><escape> and be happy. Deleting is just as easy: again mark with Ctrl+v, and delete with d (or x, for that matter).

Replies are listed 'Best First'.
Re^2: [Golfing] Uncommenting a block
by LanX (Saint) on Apr 14, 2010 at 12:49 UTC
    Well it wasn't an editor question ...¹

    In this use case I had to comment out org-mode syntax which only works at the beginning of the line and unfortunately doesn't tolerate any leading "#" ...

    Cheers Rolf

    (1)comment-region in emacs is even easier, I bound a macro to a key which (un)comments the marked region or the current line, chunks, paragraphs or function depending on repetition! And if I miss a vi-feature I switch to viper-mode ...

      Well it wasn't an editor question ...
      Which can still be answered by "use the appropriate tool for the job", which in this case happens to be an editor.

      Abusing language features is an ugly hack, and going to hurt you in the long run. One drawback of using a heredoc is that you don't see if you're inside a comment without knowing the context.

      Not seeing the context happens quite often, for example when reviewing diffs/patches.

      Perl 6 - links to (nearly) everything that is Perl 6.
        >Which can still be answered by "use the appropriate tool for the job", which in this case happens to be an editor.

        LOL, I don't have the impression that you really read my posts...

        I already use the right tool, and apparently you have little knowledge of emacs or org-mode¹.

        Furthermore this thread is already flagged as "[Golfing]".

        Amen Rolf

        (¹) which is no code which needs extra marks when using diff!

        UPDATE: killed last line.