diff --git a/README.md b/README.md index a096e14..4c90a15 100644 --- a/README.md +++ b/README.md @@ -34,19 +34,19 @@ To start using the plugin in the on-the-fly mode use `:TableModeToggle` mapped t > You can use the following to quickly enable / disable table mode in insert > mode by using `||` or `__` : > ```vim -> inoreabbrev -> \ s:isAtStartOfLine('\|\|') ? -> \ ':TableModeEnable' : '' -> inoreabbrev __ -> \ s:isAtStartOfLine('__') ? -> \ ':silent! TableModeDisable' : '__' -> -> fun! s:isAtStartOfLine(mapping) +> 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$') -> endf +> endfunction +> +> inoreabbrev +> \ isAtStartOfLine('\|\|') ? +> \ ':TableModeEnable' : '' +> inoreabbrev __ +> \ isAtStartOfLine('__') ? +> \ ':silent! TableModeDisable' : '__' > ``` Enter the first line, delimiting columns by the `|` symbol. The plugin reacts by inserting spaces between the text and the separator if you omit them: