*table-mode.txt* Table Mode for easy table formatting. v2.4.0 =============================================================================== Table Mode, THE AWESOME AUTOMATIC TABLE CREATOR & FORMATTER VERSION 2.4.0 Author: Dhruva Sagar License: MIT =============================================================================== CONTENTS *table-mode-contents* 1. Introduction .................... |table-mode-introduction| 2. Requirements .................... |table-mode-requirements| 3. Getting Started ................. |table-mode-getting-started| 4. Options ......................... |table-mode-options| 5. Mappings ........................ |table-mode-mappings| 6. Commands ........................ |table-mode-commands| 7. Contributing .................... |table-mode-contributing| 8. Report Issues ................... |table-mode-report-issues| =============================================================================== INTRODUCTION *table-mode-introduction* Table Mode is simple plugin that makes building tables in vim a breeze. It is inspired from tpope's auto aligning script for creating tables in vim - https://gist.github.com/tpope/287147, which in turn utilizes the Tabular Plugin. =============================================================================== REQUIREMENTS *table-mode-requirements* This depends on the Tabular plugin - https://github.com/godlygeek/tabular, make sure it is installed and loaded. =============================================================================== GETTING STARTED *table-mode-getting-started* Create Table on the fly: Using Table Mode is dead simple. You simply start typing on a new line with the table separator - |g:table-mode-separator|, and you just type away! The plugin does the rest automatically for you as you type. With each additional separator you add, it aligns the table properly, without having to do anything else. The table mode is disabled by default and you can enter table mode using |table-mode-toggle-map| or you can also enable it permanently using |g:table-mode-always-active| if you wish. Table Mode allows for creation of tables within comments, it looks at the 'commentstring' setting to identify whether the current line is commented. Tableize content: Table Mode enables conversion of delimited text into tables. Again like table creation, this is also applicable within comments. Manipulation of tables: Tableize provides 3 easy ways to quickly manipulate tables. 1. Cell Text Object : A text object for table cell defined by |table-mode-cell-text-object|. You can use it with an operator (d,c,y) to manipulate it easily. If you delete the cell using this, it will delete the table separator along with it so if you type out some new stuff, you will have to re-add it, which triggers a re-alignment and the table would be formatted again. 2. Delete Column : Delete an entire table column using |table-mode-delete-column-map| . 3. Delete Row : Delete an entire table row using |table-mode-delete-row-map| =============================================================================== OPTIONS *table-mode-options* Overview: |table-mode-loaded| ............. Disable the plugin. |table-mode-border| ............. Enable border. |table-mode-corner| ............. Set corner character. |table-mode-separator| .......... Set separator character. |table-mode-fillchar| ........... Set table fillchar character. |table-mode-toggle-map| ......... Set table mode toggle mapping. |table-mode-always-active| ...... Set table mode to always enabled. |table-mode-delimiter| .......... Set the delimiter for Tableize. |table-mode-tableize-map| ....... Set mapping for Tableize. |table-mode-tableize-op-map| .... Set mapping for Tableize with input. |table-mode-align| .............. Set the text alignment for Tableize. |table-mode-no-border-padding| .. Set for no border padding. |table-mode-realign-map| ........ Set mapping for table realigning. |table-mode-motion-prefix| ...... Set prefix for table mode motions. |table-mode-cell-text-object| ... Set mapping for table cell object. |table-mode-delete-row-map| ..... Set mapping for deleting table row. |table-mode-delete-column-map| .. Set mapping for deleting table column. g:table_mode_loaded *table-mode-loaded* Use this option to disable the plugin: > let g:table_mode_loaded = 1 < g:table_mode_border *table-mode-border* Use this option to enable / disable table border: > let g:table_mode_border = 1 < g:table_mode_corner *table-mode-corner* Use this option to define the table corner character: > let g:table_mode_corner = '+' < g:table_mode_separator *table-mode-separator* Use this option to define the table column separator character: > let g:table_mode_separator = '|' < This option also defines the trigger to be used to start creating a table row in insert mode. g:table_mode_fillchar *table-mode-fillchar* Use this option to define the table border fill character: > let g:table_mode_fillchar = '-' < g:table_mode_toggle_map *table-mode-toggle-map* Use this option to define the mapping for toggling the table mode: > let g:table_mode_toggle_map = 'tm' < Read |table-mode-mappings-toggle| for more info. g:table_mode_always_active *table-mode-always-active* Use this option to permanently enable the table mode: > let g:table_mode_always_active = 0 < This will trigger table creation once you type the |table-mode-separator| as long as it's the first character on the line, which can be annoying. I recommend you to instead use the |table-mode-mappings-toggle| or |table-mode-commands-toggle| to toggle the table mode or |table-mode-commands-enable| to enable and |table-mode-commands-disable| to disable mode when needed. g:table_mode_delimiter *table-mode-delimiter* Use this option to define the delimiter which used by |table-mode-commands-tableize| > let g:table_mode_delimiter = ',' < g:table_mode_tableize_map *table-mode-tableize-map* Use this option to define the mapping to invoke |:Tableize| with default delimiter, i.e. |:Tableize| without input. > let g:table_mode_tableize_map = 'tt' < g:table_mode_tableize_op_map *table-mode-tableize-op-map* Use this option to define the mapping to invoke |:Tableize| with input parameter. This option will ask for command-line input {pattern} that defines the delimiter. > let g:table_mode_tableize_op_map = 'T' < g:table_mode_align *table-mode-align* Use this option to define the format for text alignment to be used for the tables. Go through |tabular-walkthrough| for details on how to set the format options for alignment. > let g:table_mode_align = 'l1' < g:table_mode_no_border_padding *table-mode-no-border-padding* Use this option to remove the border padding (extra spaces around the |table-mode-fillchar|). > let g:table_mode_no_border_padding = 0 < NOTE this option changes |table-mode-align| to 'c0', so that there is no extra padding around the contents. g:table_mode_realign_map *table-mode-realign-map* Use this option to define the mapping for realigning table columns. This is useful in case you make edits to an existing table. > let g:table_mode_realign_map = 'tr' < g:table_mode_motion_prefix *table-mode-motion-prefix* Use this option to define the prefix for table mode motion commands. > let g:table_mode_motion_prefix = 't' < You can move to the next / previous row / column using the motion commands. The motions 'hjkl' follow the prefix are in accordance to standard vim character motions to make them easier to remember. They may also be preceeded with a [count]. The 'h', 'l' (left and right motions) wrap around the table row and move to the previous rows last column, next rows first column respectively if one exists. g:table_mode_cell_text_object *table-mode-cell-text-object* Use this option to define the table mode cell text object. > let g:table_mode_cell_text_object = 'tc' < This text object automatically selects different text depending on the context. If you delete the cell using either the 'd' or the 'c' operator, it will delete cell contents along with the table separator. In case you do it with 'c' while you add new content for the cell, you will have to re-add the |table-mode-separator|, which will trigger the re-alignment of the table again and format it correctly. If you simply want to yank the table content, this text object will select only the table cell contents, without the padding (extra space around the text) or the |table-mode-separator|. g:table_mode_delete_row_map *table-mode-delete-row-map* Use this option to define the mapping for deletion of the entire table row. You can delete multiple rows by preceeding this with a [count]. > let g:table_mode_delete_column_map = 'tdd' g:table_mode_delete_column_map *table-mode-delete-column-map* USe this option to define the mapping for deletion of the entire table column. You can delete multiple columns to the right by preceeding this with a [count] > let g:table_mode_delete_column_map = 'tdc' < =============================================================================== MAPPINGS *table-mode-mappings* *table-mode-mappings-toggle* tm Toggle table mode for the current buffer. You can change this using the |toggle-mode-options-toggle-map| option. NOTE This is applicable only if |table-mode-always-active| is not set. *table-mode-mappings-trigger* | Trigger table creation in table mode. You can change this using the |toggle-mode-options-separator| option. tt Triggers |table-mode-commands-tableize| on the visually selected content. *table-mode-mappings-op-trigger* T Triggers |table-mode-commands-tableize| on the visually selected asking for user to input the delimiter. *table-mode-mappings-realign* tr Realigns table columns *table-mode-mappings-motions* t[hjkl] Move to previous | below | above | right cell in the table. *table-mode-mappings-delete-row* tdd Delete the entire table row you are on or multiple rows using a [count]. You can change this using |table-mode-delete-row-map| option. *table-mode-mappings-delete-column* tdc Delete entire table column you are within. You can preceed it with a [count] to delete multiple columns to the right. You can change this using |table-mode-delete-column-map| option. =============================================================================== COMMANDS *table-mode-commands* *:TableModeToggle* *table-mode-:TableModeToggle* :TableModeToggle Toggles the table mode. Same effect as |toggle-mode-mappings-toggle|. NOTE this is applicable only if |table-mode-always-active| is not set. *:TableModeEnable* *table-mode-:TableModeEnable* :TableModeEnable Enables Table Mode. NOTE this is applicable only if |table-mode-always-active| is not set. *:TableModeDisable* *table-mode-:TableModeDisable* :TableModeDisable Disables Table Mode. NOTE this is applicable only if |table-mode-always-active| is not set. *:Tableize* *table-mode-:Tableize* :Tableize This converts the current line into a table if it consists of |table-mode-delimiter|. This accepts a range, without which it applies on the current line. This accepts a {pattern} similar to Tabular which defines the delimiter. eg.) > :Tableize/; < The above command will Tableize using ';' as the delimiter. NOTE this is optional, by default without the expression it will tableize the content using |g:table-mode-delimiter| as the delimiter. =============================================================================== CONTRIBUTING *table-mode-contributing* If you want to take a stab at it, by all means, send me a pull request on Github (http://github.com/dhruvasagar/table-mode) or get in touch with me directly via e-mail at dhruva 'dot' sagar 'at' gmail.com. =============================================================================== REPORT ISSUES *table-mode-report-issues* If you discover any issues, please report them at http://github.com/dhruvasagar/table-mode/issues. vim:tw=78:ts=8:ft=help:norl:ai