mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-08 11:03:47 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f23737d5fa | ||
|
|
3cf75f665e | ||
|
|
e6e49e8907 |
18
README.md
18
README.md
@@ -4,13 +4,19 @@ An awesome automatic table creator & formatter allowing one to create neat
|
||||
tables as you type.
|
||||
|
||||
## Change Log
|
||||
### Version 2.1 :
|
||||
* VIM loads plugins in alphabetical order and so table-mode would be loaded
|
||||
before Tabularize which it depends on. Hence Moved plugin into an after
|
||||
plugin. Checking if Tabularize is available and finish immidiately if it's
|
||||
not.
|
||||
|
||||
### Version 2.0 :
|
||||
* Moved bulk of code to autoload for vimscript optimisation.
|
||||
|
||||
### version 1.1 :
|
||||
### Version 1.1 :
|
||||
* Added Tableize command and mapping to convert existing content into a table.
|
||||
|
||||
### version 1.0 :
|
||||
### Version 1.0 :
|
||||
* First stable release, create tables as you type.
|
||||
|
||||
## Getting Started
|
||||
@@ -26,8 +32,10 @@ There are 2 ways to do this
|
||||
$ cd ~/.vim
|
||||
$ git submodule add git@github.com:dhruvasagar/vim-table-mode.git bundle/table-mode
|
||||
```
|
||||
2. Copy table-mode.vim into ~/.vim/plugin/ (Unix) or vimfiles/plugin/ (Windows)
|
||||
as with other plugins.
|
||||
2. Copy autoload/todomode.vim, plugin/todo-mode.vim, doc/todo-mode.txt to
|
||||
respective ~/.vim/autoload/, ~/.vim/plugin and ~/.vim/doc under UNIX or
|
||||
vimfiles/autoload/, vimfiles/plugin/ and vimfiles/doc under WINDOWS and
|
||||
restart VIM
|
||||
|
||||
### Requirements
|
||||
|
||||
@@ -62,7 +70,7 @@ sure Tabular is installed and loaded into your runtime to ensure this works.
|
||||
the mapping `<Leader>T` with a `[count]` to apply it to the next `[count]`
|
||||
lines in usual vim style.
|
||||
|
||||
### Demo:
|
||||
### Demo
|
||||
|
||||
<a href="http://www.youtube.com/watch?v=sK2IH1hiDkw"><img
|
||||
src="https://raw.github.com/dhruvasagar/vim-table-mode/master/youtube.png"/></a>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
" Author: Dhruva Sagar <http://dhruvasagar.com/>
|
||||
" License: MIT (http://www.opensource.org/licenses/MIT)
|
||||
" Website: http://github.com/dhruvasagar/vim-table-mode
|
||||
" Version: 2.0
|
||||
" Version: 2.1
|
||||
" Note: This plugin was heavily inspired by the 'CucumberTables.vim'
|
||||
" (https://gist.github.com/tpope/287147) plugin by Tim Pope and
|
||||
" uses a small amount of code from it.
|
||||
@@ -13,10 +13,10 @@
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" taglist.vim is provided *as is* and comes with no warranty of
|
||||
" any kind, either expressed or implied. In no event will the
|
||||
" copyright holder be liable for any damamges resulting from the
|
||||
" use of this software.
|
||||
" table-mode.vim is provided *as is* and comes with no warranty
|
||||
" of any kind, either expressed or implied. In no event will
|
||||
" the copyright holder be liable for any damamges resulting
|
||||
" from the use of this software.
|
||||
" =============================================================================
|
||||
|
||||
" Finish if already loaded {{{1
|
||||
@@ -25,6 +25,13 @@ if exists('g:table_mode_loaded')
|
||||
endif
|
||||
let g:table_mode_loaded = 1
|
||||
"}}}1
|
||||
"
|
||||
" Finish if Tabularize plugin is not available {{{1
|
||||
if !exists(':Tabularize')
|
||||
echoerr 'Table Mode depends on Tabularize, ensure that is installed first.'
|
||||
finish
|
||||
endif
|
||||
" }}}1
|
||||
|
||||
function! s:SetGlobalOptDefault(opt, val) "{{{1
|
||||
if !exists('g:' . a:opt)
|
||||
@@ -4,7 +4,7 @@
|
||||
" Author: Dhruva Sagar <http://dhruvasagar.com/>
|
||||
" License: MIT (http://www.opensource.org/licenses/MIT)
|
||||
" Website: http://github.com/dhruvasagar/vim-table-mode
|
||||
" Version: 2.0
|
||||
" Version: 2.1
|
||||
" Note: This plugin was heavily inspired by the 'CucumberTables.vim'
|
||||
" (https://gist.github.com/tpope/287147) plugin by Tim Pope and
|
||||
" uses a small amount of code from it.
|
||||
@@ -13,10 +13,10 @@
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" taglist.vim is provided *as is* and comes with no warranty of
|
||||
" any kind, either expressed or implied. In no event will the
|
||||
" copyright holder be liable for any damamges resulting from the
|
||||
" use of this software.
|
||||
" table-mode.vim is provided *as is* and comes with no warranty
|
||||
" of any kind, either expressed or implied. In no event will
|
||||
" the copyright holder be liable for any damamges resulting
|
||||
" from the use of this software.
|
||||
" =============================================================================
|
||||
|
||||
" Private Functions {{{1
|
||||
@@ -75,11 +75,9 @@ endfunction
|
||||
" }}}2
|
||||
|
||||
function! s:Tableizeline(line) "{{{2
|
||||
if exists(':Tabularize')
|
||||
call s:ConvertDelimiterToSeparator(a:line)
|
||||
call s:UpdateLineBorder(a:line)
|
||||
exec 'Tabularize/[' . g:table_mode_separator . g:table_mode_corner . ']/l1'
|
||||
endif
|
||||
call s:ConvertDelimiterToSeparator(a:line)
|
||||
call s:UpdateLineBorder(a:line)
|
||||
exec 'Tabularize/[' . g:table_mode_separator . g:table_mode_corner . ']/l1'
|
||||
endfunction
|
||||
" }}}2
|
||||
|
||||
@@ -97,7 +95,7 @@ endfunction
|
||||
" }}}2
|
||||
|
||||
function! s:Tableize() "{{{2
|
||||
if s:IsTableModeActive() && exists(':Tabularize') && getline('.') =~# ('^\s*' . g:table_mode_separator)
|
||||
if s:IsTableModeActive() && getline('.') =~# ('^\s*' . g:table_mode_separator)
|
||||
let column = s:Strlen(substitute(getline('.')[0:col('.')], '[^' . g:table_mode_separator . ']', '', 'g'))
|
||||
let position = s:Strlen(matchstr(getline('.')[0:col('.')], '.*' . g:table_mode_separator . '\s*\zs.*'))
|
||||
if g:table_mode_border | call s:UpdateLineBorder(line('.')) | endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
*table-mode.txt* Table Mode for easy table formatting. v2.0
|
||||
*table-mode.txt* Table Mode for easy table formatting. v2.1
|
||||
===============================================================================
|
||||
Table Mode, THE AWESOME AUTOMATIC TABLE CREATOR & FORMATTER
|
||||
VERSION 2.0
|
||||
VERSION 2.1
|
||||
|
||||
Author: Dhruva Sagar <http://dhruvasagar.com/>
|
||||
License: MIT <http://opensource.org/licenses/MIT/>
|
||||
|
||||
Reference in New Issue
Block a user