From e490373435ab5c55c818637ff9062366d6bb2027 Mon Sep 17 00:00:00 2001 From: Dhruva Sagar Date: Mon, 11 Jul 2016 13:22:12 +0530 Subject: [PATCH] Fix #88 Added the iabbrevs to README --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index b964cfc..a096e14 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,25 @@ $ git submodule add git@github.com:dhruvasagar/vim-table-mode.git bundle/table-m To start using the plugin in the on-the-fly mode use `:TableModeToggle` mapped to \tm by default (which means \\ t m if you didn't override the by `:let mapleader = ","` to have , t m). +> Tip : +> 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) +> 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 +> ``` + 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: | name | address | phone |