vimwiki/autoload/vimwiki/tbl.vim

862 lines
19 KiB
VimL
Raw Normal View History

2019-03-14 11:36:51 +01:00
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
2019-03-14 11:36:51 +01:00
" Description: Tables
" | Easily | manageable | text | tables | ! |
" |--------|------------|-------|--------|---------|
" | Have | fun! | Drink | tea | Period. |
"
2019-03-14 11:36:51 +01:00
" Home: https://github.com/vimwiki/vimwiki/
if exists('g:loaded_vimwiki_tbl_auto') || &compatible
finish
endif
let g:loaded_vimwiki_tbl_auto = 1
2019-03-14 11:36:51 +01:00
let s:textwidth = &textwidth
function! s:rxSep() abort
2019-03-14 11:36:51 +01:00
return vimwiki#vars#get_syntaxlocal('rxTableSep')
endfunction
2013-04-19 05:46:58 +02:00
function! s:wide_len(str) abort
Version 1.1 * NEW: Issue 57: Make it possible to have pre block inside list item. * NEW: Issue 82: Add quick goto command. See |:VimwikiGoto|. * NEW: Issue 83: Quick switch in diary. See |:VimwikiDiaryNextDay| and |:VimwikiDiaryPrevDay| commands. * FIX: Issue 84: Vimwiki rename removed the WikiWord display name. * FIX: Issue 85: Errors if you have '~' subdirectory in a wiki directory. * FIX: Issue 86: Existed links '[[WikiLink1|Alias1]] | [[WikiLink2]]' are highlighted as a single link. * FIX: Issue 88: Underline text. See |g:vimwiki_valid_html_tags|. * FIX: Issue 92: Wikies in a subdir could be renamed to an empty file. * FIX: Issue 93: Use alias name in html title. See |vimwiki-title|. * FIX: Issue 94: Relative links to PHP files are broken. See |g:vimwiki_file_exts| for details. * FIX: Issue 96: Closing bracket at the end of weblink shouldn't be a part of that link. * FIX: Issue 97: Error opening weblink in a browser if it has # inside. * FIX: Issue 99: Vim is not responing while opening arbitrary wiki file. * FIX: Issue 100: Additional content on diary index page could be corrupted. * NEW: Issue 101: Customized HTML tags. See |g:vimwiki_valid_html_tags| * NEW: Issue 102: Conceal feature usage. See |g:vimwiki_conceallevel|. * FIX: Issue 103: Always highlight links to non-wiki files as existed. * FIX: Issue 104: vimwiki#nested_syntax needs 'keepend' to avoid contained language syntax eat needed '}}}'. * FIX: Issue 105: <i_CR> on a todo list item with [ ] doesn't create new todo list item. * FIX: Issue 106: With MediaWiki syntax <C-Space> on a child todo list item produce errors. * FIX: Issue 107: With MediaWiki syntax <C-Space> on a list item creates todo list item without space between * and [ ]. * FIX: Issue 110: Syntax highlighting doesn't work for indented codeblock. * FIX: Issue 115: Nested Perl syntax highlighting differs from regular one. * MISC: Many vimwiki commands were renamed from Vimwiki.*Word to Vimwiki.*Link. VimwikiGoHome is renamed to VimwikiIndex, VimwikiTabGoHome to VimwikiTabIndex. * MISC: vimwiki-option-gohome is removed.
2010-08-24 02:00:00 +02:00
" vim73 has new function that gives correct string width.
if exists('*strdisplaywidth')
Version 1.1 * NEW: Issue 57: Make it possible to have pre block inside list item. * NEW: Issue 82: Add quick goto command. See |:VimwikiGoto|. * NEW: Issue 83: Quick switch in diary. See |:VimwikiDiaryNextDay| and |:VimwikiDiaryPrevDay| commands. * FIX: Issue 84: Vimwiki rename removed the WikiWord display name. * FIX: Issue 85: Errors if you have '~' subdirectory in a wiki directory. * FIX: Issue 86: Existed links '[[WikiLink1|Alias1]] | [[WikiLink2]]' are highlighted as a single link. * FIX: Issue 88: Underline text. See |g:vimwiki_valid_html_tags|. * FIX: Issue 92: Wikies in a subdir could be renamed to an empty file. * FIX: Issue 93: Use alias name in html title. See |vimwiki-title|. * FIX: Issue 94: Relative links to PHP files are broken. See |g:vimwiki_file_exts| for details. * FIX: Issue 96: Closing bracket at the end of weblink shouldn't be a part of that link. * FIX: Issue 97: Error opening weblink in a browser if it has # inside. * FIX: Issue 99: Vim is not responing while opening arbitrary wiki file. * FIX: Issue 100: Additional content on diary index page could be corrupted. * NEW: Issue 101: Customized HTML tags. See |g:vimwiki_valid_html_tags| * NEW: Issue 102: Conceal feature usage. See |g:vimwiki_conceallevel|. * FIX: Issue 103: Always highlight links to non-wiki files as existed. * FIX: Issue 104: vimwiki#nested_syntax needs 'keepend' to avoid contained language syntax eat needed '}}}'. * FIX: Issue 105: <i_CR> on a todo list item with [ ] doesn't create new todo list item. * FIX: Issue 106: With MediaWiki syntax <C-Space> on a child todo list item produce errors. * FIX: Issue 107: With MediaWiki syntax <C-Space> on a list item creates todo list item without space between * and [ ]. * FIX: Issue 110: Syntax highlighting doesn't work for indented codeblock. * FIX: Issue 115: Nested Perl syntax highlighting differs from regular one. * MISC: Many vimwiki commands were renamed from Vimwiki.*Word to Vimwiki.*Link. VimwikiGoHome is renamed to VimwikiIndex, VimwikiTabGoHome to VimwikiTabIndex. * MISC: vimwiki-option-gohome is removed.
2010-08-24 02:00:00 +02:00
return strdisplaywidth(a:str)
endif
" get str display width in vim ver < 7.2
2019-03-14 11:36:51 +01:00
if !vimwiki#vars#get_global('CJK_length')
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let ret = strlen(substitute(a:str, '.', 'x', 'g'))
else
let savemodified = &modified
let save_cursor = getpos('.')
exe "norm! o\<esc>"
call setline(line('.'), a:str)
let ret = virtcol('$') - 1
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
d
call setpos('.', save_cursor)
let &modified = savemodified
endif
return ret
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
function! s:cell_splitter() abort
2013-04-19 05:46:58 +02:00
return '\s*'.s:rxSep().'\s*'
2019-03-14 11:36:51 +01:00
endfunction
function! s:sep_splitter() abort
2013-04-19 05:46:58 +02:00
return '-'.s:rxSep().'-'
2019-03-14 11:36:51 +01:00
endfunction
function! s:is_table(line) abort
2019-03-14 11:36:51 +01:00
return s:is_separator(a:line) ||
\ (a:line !~# s:rxSep().s:rxSep() && a:line =~# '^\s*'.s:rxSep().'.\+'.s:rxSep().'\s*$')
endfunction
function! s:is_separator(line) abort
2017-08-17 15:59:04 +02:00
return a:line =~# '^\s*'.s:rxSep().'\(:\=--\+:\='.s:rxSep().'\)\+\s*$'
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
function! s:is_separator_tail(line) abort
2019-03-14 11:36:51 +01:00
return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$'
endfunction
function! s:is_last_column(lnum, cnum) abort
let line = strpart(getline(a:lnum), a:cnum - 1)
2019-03-14 11:36:51 +01:00
return line =~# s:rxSep().'\s*$' && line !~# s:rxSep().'.*'.s:rxSep().'\s*$'
endfunction
2019-03-14 11:36:51 +01:00
function! s:is_first_column(lnum, cnum) abort
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let line = strpart(getline(a:lnum), 0, a:cnum - 1)
2019-03-14 11:36:51 +01:00
return line =~# '^\s*$' ||
\ (line =~# '^\s*'.s:rxSep() && line !~# '^\s*'.s:rxSep().'.*'.s:rxSep())
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
function! s:count_separators_up(lnum) abort
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let lnum = a:lnum - 1
while lnum > 1
if !s:is_separator(getline(lnum))
break
endif
let lnum -= 1
endwhile
return (a:lnum-lnum)
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
function! s:count_separators_down(lnum) abort
let lnum = a:lnum + 1
while lnum < line('$')
if !s:is_separator(getline(lnum))
break
endif
let lnum += 1
endwhile
return (lnum-a:lnum)
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
function! s:create_empty_row(cols) abort
2013-04-19 05:46:58 +02:00
let row = s:rxSep()
let cell = ' '.s:rxSep()
for c in range(a:cols)
let row .= cell
endfor
return row
2019-03-14 11:36:51 +01:00
endfunction
function! s:create_row_sep(cols) abort
2013-04-19 05:46:58 +02:00
let row = s:rxSep()
let cell = '---'.s:rxSep()
for c in range(a:cols)
let row .= cell
endfor
return row
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#get_cells(line, ...) abort
let result = []
let state = 'NONE'
let cell_start = 0
let quote_start = 0
let len = strlen(a:line) - 1
" 'Simple' FSM
while state !=# 'CELL'
if quote_start != 0 && state !=# 'CELL'
let state = 'CELL'
endif
for idx in range(quote_start, len)
" The only way I know Vim can do Unicode...
let ch = a:line[idx]
2019-03-14 11:36:51 +01:00
if state ==# 'NONE'
if ch ==# '|'
let cell_start = idx + 1
let state = 'CELL'
endif
2019-03-14 11:36:51 +01:00
elseif state ==# 'CELL'
if ch ==# '[' || ch ==# '{'
let state = 'BEFORE_QUOTE_START'
let quote_start = idx
elseif ch ==# '|'
let cell = strpart(a:line, cell_start, idx - cell_start)
if a:0 && a:1
let cell = substitute(cell, '^ \(.*\) $', '\1', '')
else
let cell = vimwiki#u#trim(cell)
endif
call add(result, cell)
let cell_start = idx + 1
endif
2019-03-14 11:36:51 +01:00
elseif state ==# 'BEFORE_QUOTE_START'
if ch ==# '[' || ch ==# '{'
let state = 'QUOTE'
let quote_start = idx
else
let state = 'CELL'
endif
2019-03-14 11:36:51 +01:00
elseif state ==# 'QUOTE'
if ch ==# ']' || ch ==# '}'
let state = 'BEFORE_QUOTE_END'
endif
2019-03-14 11:36:51 +01:00
elseif state ==# 'BEFORE_QUOTE_END'
if ch ==# ']' || ch ==# '}'
let state = 'CELL'
endif
endif
endfor
if state ==# 'NONE'
break
endif
endwhile
return result
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
2019-03-14 11:36:51 +01:00
function! s:col_count(lnum) abort
return len(vimwiki#tbl#get_cells(getline(a:lnum)))
2019-03-14 11:36:51 +01:00
endfunction
function! s:get_indent(lnum, depth) abort
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
if !s:is_table(getline(a:lnum))
return
endif
let indent = 0
let lnum = a:lnum - 1
while lnum > 1
let line = getline(lnum)
if !s:is_table(line)
let indent = indent(lnum+1)
break
endif
let lnum -= 1
if a:depth > 0 && lnum < a:lnum - a:depth
break
endif
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
endwhile
return indent
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
function! s:get_rows(lnum, ...) abort
if !s:is_table(getline(a:lnum))
return
endif
let rows = []
let lnum = a:lnum - 1
let depth = a:0 > 0 ? a:1 : 0
let ldepth = 0
while lnum >= 1 && (depth == 0 || ldepth < depth)
let line = getline(lnum)
if s:is_table(line)
call insert(rows, [lnum, line])
else
break
endif
let lnum -= 1
let ldepth += 1
endwhile
let lnum = a:lnum
while lnum <= line('$')
let line = getline(lnum)
if s:is_table(line)
call add(rows, [lnum, line])
else
break
endif
if depth > 0
break
endif
let lnum += 1
endwhile
return rows
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
function! s:get_cell_aligns(lnum, ...) abort
2017-08-17 15:59:04 +02:00
let aligns = {}
let depth = a:0 > 0 ? a:1 : 0
for [lnum, row] in s:get_rows(a:lnum, depth)
if s:is_separator(row)
2017-08-17 15:59:04 +02:00
let cells = vimwiki#tbl#get_cells(row)
for idx in range(len(cells))
let cell = cells[idx]
if cell =~# '^--\+:'
let aligns[idx] = 'right'
elseif cell =~# '^:--\+:'
let aligns[idx] = 'center'
else
let aligns[idx] = 'left'
endif
endfor
else
let cells = vimwiki#tbl#get_cells(row)
for idx in range(len(cells))
if !has_key(aligns, idx)
let aligns[idx] = 'left'
endif
endfor
2017-08-17 15:59:04 +02:00
endif
endfor
return aligns
2018-07-09 19:51:18 +02:00
endfunction
2017-08-17 15:59:04 +02:00
function! s:get_cell_aligns_fast(rows) abort
let aligns = {}
let clen = 0
for [lnum, row] in a:rows
if s:is_separator(row)
return s:get_cell_aligns(lnum, 1)
endif
let cells = vimwiki#tbl#get_cells(row, 1)
let clen = len(cells)
for idx in range(clen)
let cell = cells[idx]
if !has_key(aligns, idx)
let cs = matchlist(cell, '^\(\s*\)[^[:space:]].\{-}\(\s*\)$')
if !empty(cs)
let lstart = len(cs[1])
let lend = len(cs[2])
if lstart > 0 && lend > 0
let aligns[idx] = 'center'
elseif lend > 0
let aligns[idx] = 'left'
elseif lstart > 0
let aligns[idx] = 'right'
endif
endif
endif
endfor
endfor
for idx in range(clen)
if !has_key(aligns, idx)
return {}
endif
endfor
return aligns
endfunction
function! s:get_cell_max_lens(lnum, ...) abort
let max_lens = {}
let rows = a:0 > 2 ? a:3 : s:get_rows(a:lnum)
for [lnum, row] in rows
if s:is_separator(row)
continue
endif
let cells = a:0 > 1 ? a:1[lnum - a:2] : vimwiki#tbl#get_cells(row)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
for idx in range(len(cells))
let value = cells[idx]
if has_key(max_lens, idx)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let max_lens[idx] = max([s:wide_len(value), max_lens[idx]])
else
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let max_lens[idx] = s:wide_len(value)
endif
endfor
endfor
return max_lens
2019-03-14 11:36:51 +01:00
endfunction
function! s:get_aligned_rows(lnum, col1, col2, depth) abort
let rows = []
let aligns = {}
let startlnum = 0
let cells = []
let max_lens = {}
2014-05-04 16:42:00 +02:00
let check_all = 1
if a:depth > 0
let rows = s:get_rows(a:lnum, a:depth)
let startlnum = rows[0][0]
let lrows = len(rows)
if lrows == a:depth + 1
let line = rows[-1][1]
if !s:is_separator(line)
let lcells = vimwiki#tbl#get_cells(line)
let lclen = len(lcells)
let lmax_lens = repeat([0], lclen)
let laligns = repeat(['left'], lclen)
let rows[-1][1] = s:fmt_row(lcells, lmax_lens, laligns, 0, 0)
endif
let i = 1
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, i != lrows - 1))
let i += 1
endfor
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
" user option not to expand last call
if vimwiki#vars#get_global('table_reduce_last_col')
let last_index = keys(max_lens)[-1]
let max_lens[last_index] = 1
endif
let fst_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows[0:0])
let check_all = max_lens != fst_lens
let aligns = s:get_cell_aligns_fast(rows[0:-2])
let rows[-1][1] = line
endif
2014-05-04 16:42:00 +02:00
endif
if check_all
" all the table must be re-formatted
let rows = s:get_rows(a:lnum)
let startlnum = rows[0][0]
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row))
endfor
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
" user option not to expand last call
if vimwiki#vars#get_global('table_reduce_last_col')
let last_index = keys(max_lens)[-1]
let max_lens[last_index] = 1
endif
endif
if empty(aligns)
let aligns = s:get_cell_aligns(a:lnum)
endif
let result = []
for [lnum, row] in rows
if s:is_separator(row)
2017-08-17 15:59:04 +02:00
let new_row = s:fmt_sep(max_lens, aligns, a:col1, a:col2)
else
2017-08-17 15:59:04 +02:00
let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, aligns, a:col1, a:col2)
endif
call add(result, [lnum, new_row])
endfor
return result
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
" Number of the current column. Starts from 0.
function! s:cur_column() abort
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let line = getline('.')
if !s:is_table(line)
return -1
endif
" TODO: do we need conditional: if s:is_separator(line)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let curs_pos = col('.')
2013-04-19 05:46:58 +02:00
let mpos = match(line, s:rxSep(), 0)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let col = -1
while mpos < curs_pos && mpos != -1
2013-04-19 05:46:58 +02:00
let mpos = match(line, s:rxSep(), mpos+1)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
if mpos != -1
let col += 1
endif
endwhile
return col
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
function! s:fmt_cell(cell, max_len, align) abort
let cell = ' '.a:cell.' '
let diff = a:max_len - s:wide_len(a:cell)
if diff == 0 && empty(a:cell)
let diff = 1
endif
if a:align ==# 'left'
2017-08-17 15:59:04 +02:00
let cell .= repeat(' ', diff)
elseif a:align ==# 'right'
2017-08-17 15:59:04 +02:00
let cell = repeat(' ',diff).cell
2018-07-09 19:51:18 +02:00
else
2017-08-17 15:59:04 +02:00
let cell = repeat(' ',diff/2).cell.repeat(' ',diff-diff/2)
endif
return cell
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
function! s:fmt_row(cells, max_lens, aligns, col1, col2) abort
2013-04-19 05:46:58 +02:00
let new_line = s:rxSep()
for idx in range(len(a:cells))
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
let value = a:cells[idx]
2017-08-17 15:59:04 +02:00
let new_line .= s:fmt_cell(value, a:max_lens[idx], a:aligns[idx]).s:rxSep()
endfor
let idx = len(a:cells)
while idx < len(a:max_lens)
2017-08-17 15:59:04 +02:00
let new_line .= s:fmt_cell('', a:max_lens[idx], a:aligns[idx]).s:rxSep()
let idx += 1
endwhile
return new_line
2019-03-14 11:36:51 +01:00
endfunction
function! s:fmt_cell_sep(max_len, align) abort
2017-08-17 15:59:04 +02:00
let cell = ''
if a:max_len == 0
2017-08-17 15:59:04 +02:00
let cell .= '-'
else
let cell .= repeat('-', a:max_len)
endif
if a:align ==# 'right'
2017-08-17 15:59:04 +02:00
return cell.'-:'
elseif a:align ==# 'left'
2017-08-17 15:59:04 +02:00
return cell.'--'
else
2017-08-17 15:59:04 +02:00
return ':'.cell.':'
endif
2019-03-14 11:36:51 +01:00
endfunction
function! s:fmt_sep(max_lens, aligns, col1, col2) abort
2013-04-19 05:46:58 +02:00
let new_line = s:rxSep()
for idx in range(len(a:max_lens))
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
2017-08-17 15:59:04 +02:00
let new_line .= s:fmt_cell_sep(a:max_lens[idx], a:aligns[idx]).s:rxSep()
endfor
return new_line
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
function! s:kbd_create_new_row(cols, goto_first) abort
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'), 2)\<CR>"
let cmd .= "\<ESC>0"
if a:goto_first
2013-04-19 05:46:58 +02:00
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
else
let cmd .= (col('.')-1).'l'
2013-04-19 05:46:58 +02:00
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
endif
let cmd .= 'a'
return cmd
2019-03-14 11:36:51 +01:00
endfunction
function! s:kbd_goto_next_row() abort
let cmd = "\<ESC>j"
2013-04-19 05:46:58 +02:00
let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= 'a'
return cmd
2019-03-14 11:36:51 +01:00
endfunction
function! s:kbd_goto_prev_row() abort
let cmd = "\<ESC>k"
2013-04-19 05:46:58 +02:00
let cmd .= ":call search('.\\(".s:rxSep()."\\)', 'c', line('.'))\<CR>"
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
let cmd .= 'a'
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
return cmd
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
" Used in s:kbd_goto_next_col
function! vimwiki#tbl#goto_next_col() abort
let curcol = virtcol('.')
let lnum = line('.')
let depth = 2
let newcol = s:get_indent(lnum, depth)
let rows = s:get_rows(lnum, depth)
let startlnum = rows[0][0]
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, 1))
endfor
let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows)
for cell_len in values(max_lens)
if newcol >= curcol-1
break
endif
let newcol += cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
endfor
let newcol += 2 " +2 == 1 separator + 1 space |<space
call vimwiki#u#cursor(lnum, newcol)
2019-03-14 11:36:51 +01:00
endfunction
function! s:kbd_goto_next_col(jumpdown) abort
let cmd = "\<ESC>"
if a:jumpdown
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let seps = s:count_separators_down(line('.'))
let cmd .= seps.'j0'
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
endif
let cmd .= ":call vimwiki#tbl#goto_next_col()\<CR>a"
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
return cmd
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
" Used in s:kbd_goto_prev_col
function! vimwiki#tbl#goto_prev_col() abort
let curcol = virtcol('.')
let lnum = line('.')
let depth = 2
let newcol = s:get_indent(lnum, depth)
let rows = s:get_rows(lnum, depth)
let startlnum = rows[0][0]
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, 1))
endfor
let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows)
let prev_cell_len = 0
for cell_len in values(max_lens)
let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
if newcol + delta > curcol-1
let newcol -= (prev_cell_len + 3) " +3 == 2 spaces + 1 separator |<space>...<space>
break
elseif newcol + delta == curcol-1
break
endif
let prev_cell_len = cell_len
let newcol += delta
endfor
let newcol += 2 " +2 == 1 separator + 1 space |<space
call vimwiki#u#cursor(lnum, newcol)
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
function! s:kbd_goto_prev_col(jumpup) abort
let cmd = "\<ESC>"
if a:jumpup
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let seps = s:count_separators_up(line('.'))
let cmd .= seps.'k'
let cmd .= '$'
endif
let cmd .= ":call vimwiki#tbl#goto_prev_col()\<CR>a"
2013-04-19 05:46:58 +02:00
" let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'b', line('.'))\<CR>"
" let cmd .= "a"
"echomsg "DEBUG kbd_goto_prev_col> ".cmd
return cmd
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#kbd_cr() abort
let lnum = line('.')
if !s:is_table(getline(lnum))
return ''
endif
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
return s:kbd_create_new_row(cols, 0)
else
return s:kbd_goto_next_row()
endif
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#kbd_tab() abort
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<Tab>"
endif
let last = s:is_last_column(lnum, col('.'))
let is_sep = s:is_separator_tail(getline(lnum))
"echomsg "DEBUG kbd_tab> last=".last.", is_sep=".is_sep
if (is_sep || last) && !s:is_table(getline(lnum+1))
let cols = len(vimwiki#tbl#get_cells(getline(lnum)))
return s:kbd_create_new_row(cols, 1)
endif
return s:kbd_goto_next_col(is_sep || last)
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#kbd_shift_tab() abort
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<S-Tab>"
endif
let first = s:is_first_column(lnum, col('.'))
let is_sep = s:is_separator_tail(getline(lnum))
"echomsg "DEBUG kbd_tab> ".first
if (is_sep || first) && !s:is_table(getline(lnum-1))
return ''
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
endif
return s:kbd_goto_prev_col(is_sep || first)
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
2019-03-14 11:36:51 +01:00
function! vimwiki#tbl#format(lnum, ...) abort
if !vimwiki#u#ft_is_vw()
2013-04-19 05:46:58 +02:00
return
endif
let line = getline(a:lnum)
if !s:is_table(line)
return
endif
let depth = a:0 == 1 ? a:1 : 0
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
if a:0 == 2
let col1 = a:1
let col2 = a:2
else
let col1 = 0
let col2 = 0
endif
let indent = s:get_indent(a:lnum, depth)
if &expandtab
let indentstring = repeat(' ', indent)
else
2019-07-17 15:15:06 +02:00
execute "let indentstring = repeat('\<TAB>', indent / &tabstop) . repeat(' ', indent % &tabstop)"
endif
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
" getting N = depth last rows is enough for having been formatted tables
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2, depth)
let row = indentstring.row
if getline(lnum) != row
call setline(lnum, row)
endif
endfor
2019-03-14 11:36:51 +01:00
let &textwidth = s:textwidth
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#create(...) abort
if a:0 > 1
let cols = a:1
let rows = a:2
elseif a:0 == 1
let cols = a:1
let rows = 2
elseif a:0 == 0
let cols = 5
let rows = 2
endif
if cols < 1
let cols = 5
endif
if rows < 1
let rows = 2
endif
let lines = []
let row = s:create_empty_row(cols)
call add(lines, row)
if rows > 1
call add(lines, s:create_row_sep(cols))
endif
for r in range(rows - 1)
call add(lines, row)
endfor
2019-03-14 11:36:51 +01:00
call append(line('.'), lines)
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#align_or_cmd(cmd, ...) abort
if s:is_table(getline('.'))
call call('vimwiki#tbl#format', [line('.')] + a:000)
else
exe 'normal! '.a:cmd
endif
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#reset_tw(lnum) abort
if !vimwiki#u#ft_is_vw()
2013-04-19 05:46:58 +02:00
return
endif
let line = getline(a:lnum)
if !s:is_table(line)
return
endif
2019-03-14 11:36:51 +01:00
let s:textwidth = &textwidth
let &textwidth = 0
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
" TODO: move_column_left and move_column_right are good candidates to be refactored.
function! vimwiki#tbl#move_column_left() abort
"echomsg "DEBUG move_column_left: "
let line = getline('.')
if !s:is_table(line)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col > 0
2019-03-14 11:36:51 +01:00
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
call cursor(line('.'), 1)
2013-04-19 05:46:58 +02:00
let sep = '\('.s:rxSep().'\).\zs'
let mpos = -1
let col = -1
while col < cur_col-1
let mpos = match(line, sep, mpos+1)
if mpos != -1
let col += 1
2019-03-14 11:36:51 +01:00
else
break
endif
endwhile
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
endif
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
function! vimwiki#tbl#move_column_right() abort
let line = getline('.')
if !s:is_table(line)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col < s:col_count(line('.'))-1
2019-03-14 11:36:51 +01:00
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
call cursor(line('.'), 1)
2013-04-19 05:46:58 +02:00
let sep = '\('.s:rxSep().'\).\zs'
let mpos = -1
let col = -1
while col < cur_col+1
let mpos = match(line, sep, mpos+1)
if mpos != -1
let col += 1
2019-03-14 11:36:51 +01:00
else
break
endif
endwhile
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
endif
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
function! vimwiki#tbl#get_rows(lnum) abort
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
return s:get_rows(a:lnum)
2019-03-14 11:36:51 +01:00
endfunction
Version 1.0 * NEW: Issue 41: Table cell and column text objects. See `vimwiki-text-objects`. * NEW: Issue 42: Commands to move table columns left and right. See `:VimwikiTableMoveColumnLeft` and `:VimwikiTableMoveColumnRight`. * NEW: Issue 44: `<S-Tab>` should move cursor to the previous table cell. * NEW: Issue 45: It should be possible to indent tables. Indented tables are centered in html. * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New placeholder is added: `%nohtml`. See `vimwiki-nohtml`. * FIX: Issue 47: Lists aren't HTMLized properly. * FIX: Issue 48: With autochdir it is impossible to have path_html such as `d:\vimwiki\html\` * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. * FIX: Issue 50: Inline formatting is not performed in table cells. * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first column. * FIX: Issue 52: Table cell width is incorrect when double wide characters are used (ie. Chinese). Check `g:vimwiki_CJK_length`. * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup in Headers). * NEW: Issue 54: Highlight for placeholders. * NEW: Issue 56: Directory indexes. See `g:vimwiki_dir_link` option and `:VimwikiGenerateLinks` command. * NEW: Issue 58: Html new lines with `<br />`. Could be inserted with `<S-CR>` in insert mode. * FIX: Issue 59: List item's text can't be started from `*`. * NEW: Issue 60: Links inside completed gtd-items. * NEW: Issue 61: Headers numbering. See `g:vimwiki_html_header_numbering` and `g:vimwiki_html_header_numbering_sym` options. * FIX: Issue 63: Table cannot have leading empty cells in html. * FIX: Issue 65: Table separator is not htmlized right if on top of the table. * FIX: Issue 66: Table empty cells are very small in html. * FIX: Issue 67: Wrong html conversion of multilined list item with bold text on the start of next line. * FIX: Issue 68: auto-indent problem with langmap. * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be skipped for navigation with `<tab>`. * FIX: Issue 75: `code` syntax doesn't display correctly in toc. * FIX: Issue 77: Diary index only showing link to today's diary entry file for extensions other than '.wiki'. * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar date if it has corresponding diary page. * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner todo list items. * FIX: Issue 81: Don't convert `WikiWord` as a link in html when `let g:vimwiki_camel_case = 0`
2010-05-12 02:00:00 +02:00
function! vimwiki#tbl#is_table(line) abort
return s:is_table(a:line)
2019-03-14 11:36:51 +01:00
endfunction
2019-03-14 11:36:51 +01:00
function! vimwiki#tbl#is_separator(line) abort
return s:is_separator(a:line)
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#cell_splitter() abort
return s:cell_splitter()
2019-03-14 11:36:51 +01:00
endfunction
function! vimwiki#tbl#sep_splitter() abort
return s:sep_splitter()
2019-03-14 11:36:51 +01:00
endfunction