Browse files

Smarter indentation handling

  • Loading branch information...
1 parent 30451e8 commit 044078560a3903b85e790249719937aade489f0f @tpope committed Aug 21, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 plugin/commentary.vim
View
2 plugin/commentary.vim
@@ -30,7 +30,7 @@ function! s:go(type)
if uncomment
let line = substitute(getline(lnum),'\S.*\s\@<!','\=submatch(0)[strlen(before):-strlen(after)-1]','')
else
- let line = substitute(getline(lnum),'\S.*\s\@<!','\=printf(&commentstring,submatch(0))','')
+ let line = substitute(getline(lnum),'^\%('.matchstr(getline(lnum1),'^\s*').'\|\s*\)\zs.*\s\@<!','\=before.submatch(0).after','')
endif
call setline(lnum,line)
endfor

0 comments on commit 0440785

Please sign in to comment.