From 79fe8f59f3062d7489c14ba0421704ff0b85e8f0 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 20 Sep 2023 23:50:49 +0200 Subject: On the fly table mode --- autoload/utils.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'autoload') diff --git a/autoload/utils.vim b/autoload/utils.vim index f11a769..1eeba25 100644 --- a/autoload/utils.vim +++ b/autoload/utils.vim @@ -208,4 +208,16 @@ function! utils#BeforeWrite() endif endfunction + +"------------------------------------------------- + +" On The Fly Table mode + function! s:isAtStartOfLine(mapping) + let text_before_cursor = getline('.')[0 : col('.')-1] + let mapping_pattern = '\V' . escape(a:mapping, '\') + let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') + return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') + endfunction + + "------------------------------------------------- -- cgit v1.2.3