HN user

atechie

15 karma
Posts9
Comments11
View on HN

>I'm a bit stumped on toggling comments, though. Any ideas?

    " comentify/uncommentify a line or a visual block"
     function! Komment()
     if getline(".") =~ '^[ \t]*#'
             let hls=@/
             s/^\([ \t]*\)#\(.*\)$/\1\2
             let @/=hls
         else
             let hls=@/
             s/^\([ \t]*\)\(.*\)$/\1#\2
             let @/=hls
         endif
     endfunction
     :vnoremap // :call Komment()<CR>
     :nnoremap // :call Komment()<CR>

    If you want to use c style comment : 
    function! Komment()
         if getline(".") =~ '^[ \t]*\/\*'
             let hls=@/
             s/^\(\s*\)\/\*\(.*\)\*\/\(\s*\)$/\1\2\3/
             let @/=hls
         else
             let hls=@/
             s/[ \t]*$//
             s/^\(\s*\)\(.*\)\(\s*\)$/\1\/\* \2 \*\//
             let @/=hls
         endif
     endfunction
     :vnoremap <silent> // :call Komment()<CR>
     :nnoremap  <silent> // :call Komment()<CR>
edited formatting

Darcs is good for personal use, but I moved away primarily because of the exponential merge problem. I think darcs2 takes care of it in most of the cases but NOT always. That is a big question mark for production repository. Darcs is easy to get started with though - to anybody interested I recommend this link - http://blog.interlinked.org/tutorials/darcs.html .

On the other hand if you want to move from darcs to git , use the following - https://github.com/purcell/darcs-to-git