" Tip: You can use the following to quickly enable / disable table mode in insert mode by using || or __: 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 inoreabbrev \ isAtStartOfLine('\|\|') ? \ ':TableModeEnable' : '' inoreabbrev __ \ isAtStartOfLine('__') ? \ ':silent! TableModeDisable' : '__'