From 8489ca0c3b3478bb2766cd18d8566a8006545d57 Mon Sep 17 00:00:00 2001 From: Dhruva Sagar Date: Mon, 8 Apr 2013 21:40:02 +0530 Subject: [PATCH] Refactored for table within inline comments --- autoload/tablemode.vim | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/autoload/tablemode.vim b/autoload/tablemode.vim index 8152206..f02c7f6 100644 --- a/autoload/tablemode.vim +++ b/autoload/tablemode.vim @@ -46,7 +46,12 @@ endfunction " }}}2 function! s:StartExpr() "{{{2 - return '^\s*\(' . s:GetCommentStart() . '\)\?\s*\ze' + return '^\s*\(' . s:GetCommentStart() . '\)\?\s*' +endfunction +" }}}2 + +function! s:StartCommentExpr() "{{{2 + return '^\s*' . s:GetCommentStart() . '\s*' endfunction " }}}2 @@ -90,8 +95,8 @@ function! s:UpdateLineBorder(line) "{{{2 silent! execute 'normal! kA' . repeat(g:table_mode_corner, curr_line_count - prev_line_count) . "\j" endif else - if getline(cline) =~# s:StartExpr() - let indent = matchstr(getline(cline), s:StartExpr()) + if getline(cline) =~# s:StartCommentExpr() + let indent = matchstr(getline(cline), s:StartCommentExpr()) call append(cline-1, indent . repeat(g:table_mode_corner, curr_line_count)) else call append(cline-1, repeat(g:table_mode_corner, curr_line_count)) @@ -105,8 +110,8 @@ function! s:UpdateLineBorder(line) "{{{2 silent! execute 'normal! jA' . repeat(g:table_mode_corner, curr_line_count - next_line_count) . "\k" end else - if getline(cline) =~# s:StartExpr() - let indent = matchstr(getline(cline), s:StartExpr()) + if getline(cline) =~# s:StartCommentExpr() + let indent = matchstr(getline(cline), s:StartCommentExpr()) call append(cline, indent . repeat(g:table_mode_corner, curr_line_count)) else call append(cline, repeat(g:table_mode_corner, curr_line_count))