Version 0.9.1
* [new] HTML Table cell text alignment, see :h vimwiki-syntax-tables. * [new] Wikipage history simplified. Each vimwiki buffer now holds b:vimwiki_prev_word which is list of [PrevWord, getpos()]. * [new] If highlight for groups wikiHeader1..wikiHeader6 exist (defined in a colorscheme) -- use it. Otherwise use Title highlight for all Headers. * [fix] Warn only once if 'html_header' or 'html_footer' does not exist. * [fix] Wrong folding for the text after the last nested list item. * [fix] Bold and Italic aren't highlighted in tables without spaces between || and * or _. ||*bold*||_asdf_ || (Thanks Brett Stahlman)
This commit is contained in:
parent
c9c4b84df5
commit
15603267db
@ -2,7 +2,7 @@
|
|||||||
UseVimball
|
UseVimball
|
||||||
finish
|
finish
|
||||||
doc\vimwiki.txt [[[1
|
doc\vimwiki.txt [[[1
|
||||||
948
|
970
|
||||||
*vimwiki.txt* A Personal Wiki for Vim
|
*vimwiki.txt* A Personal Wiki for Vim
|
||||||
|
|
||||||
__ __ ______ __ __ ______ __ __ ______ ~
|
__ __ ______ __ __ ______ __ __ ______ ~
|
||||||
@ -13,7 +13,7 @@ doc\vimwiki.txt [[[1
|
|||||||
\ `\___/ /\_____\\ \_\\ \_\ `\___x___/ /\_____\\ \_\ \_\ /\_____\~
|
\ `\___/ /\_____\\ \_\\ \_\ `\___x___/ /\_____\\ \_\ \_\ /\_____\~
|
||||||
`\/__/ \/_____/ \/_/ \/_/'\/__//__/ \/_____/ \/_/\/_/ \/_____/~
|
`\/__/ \/_____/ \/_/ \/_/'\/__//__/ \/_____/ \/_/\/_/ \/_____/~
|
||||||
|
|
||||||
Version: 0.8.4 ~
|
Version: 0.9.1 ~
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
CONTENTS *vimwiki-contents*
|
CONTENTS *vimwiki-contents*
|
||||||
@ -402,6 +402,19 @@ For example:
|
|||||||
||1940 ||-2 ||40 ||
|
||1940 ||-2 ||40 ||
|
||||||
|
|
||||||
|
|
||||||
|
For HTML, contents of table cell could be aligned to the right, left and
|
||||||
|
center:
|
||||||
|
|
||||||
|
|| Center || Center || Center ||
|
||||||
|
||Left || Center || Right||
|
||||||
|
|| Right||Left || Center ||
|
||||||
|
|| Center || Right||Left ||
|
||||||
|
|
||||||
|
No spaces on the left side -- left alignment.
|
||||||
|
No spaces on the right side -- right alignment.
|
||||||
|
Spaces on the left and on the right -- center alignment.
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
5.7. Preformatted text *vimwiki-syntax-preformatted*
|
5.7. Preformatted text *vimwiki-syntax-preformatted*
|
||||||
|
|
||||||
@ -751,6 +764,17 @@ Vim plugins website: http://www.vim.org/scripts/script.php?script_id=2226
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
12. Changelog *vimwiki-changelog*
|
12. Changelog *vimwiki-changelog*
|
||||||
|
|
||||||
|
0.9.1
|
||||||
|
* [new] HTML Table cell text alignment, see |vimwiki-syntax-tables|
|
||||||
|
* [new] Wikipage history simplified. Each vimwiki buffer now holds
|
||||||
|
b:vimwiki_prev_word which is list of [PrevWord, getpos()].
|
||||||
|
* [new] If highlight for groups wikiHeader1..wikiHeader6 exist (defined in
|
||||||
|
a colorscheme) -- use it. Otherwise use Title highlight for all Headers.
|
||||||
|
* [fix] Warn only once if 'html_header' or 'html_footer' does not exist.
|
||||||
|
* [fix] Wrong folding for the text after the last nested list item.
|
||||||
|
* [fix] Bold and Italic aren't highlighted in tables without spaces
|
||||||
|
between || and * or _. ||*bold*||_asdf_ || (Thanks Brett Stahlman)
|
||||||
|
|
||||||
0.9.0
|
0.9.0
|
||||||
* [new] You can add classes to 'pre' tag -- |vimwiki-syntax-preformatted|.
|
* [new] You can add classes to 'pre' tag -- |vimwiki-syntax-preformatted|.
|
||||||
This might be useful for coloring some programming code with external js
|
This might be useful for coloring some programming code with external js
|
||||||
@ -761,9 +785,7 @@ Vim plugins website: http://www.vim.org/scripts/script.php?script_id=2226
|
|||||||
* [new] New implementation of |:VimwikiRenameWord|. CAUTION: It was tested
|
* [new] New implementation of |:VimwikiRenameWord|. CAUTION: It was tested
|
||||||
on 2 computers only, backup your wiki before use it. Email me if it
|
on 2 computers only, backup your wiki before use it. Email me if it
|
||||||
doesn't work for you.
|
doesn't work for you.
|
||||||
* [new] HTML: convert [ ] to html checkboxes.
|
* [fix] Less than 3 symbols are not highlighted in Bold and Italic.
|
||||||
* [new] Default CSS: gray out checked items.
|
|
||||||
* [fix] Less than 3 characters are not highlighted in Bold and Italic.
|
|
||||||
* [fix] Added vimwiki autocmd group to avoid clashes with user defined
|
* [fix] Added vimwiki autocmd group to avoid clashes with user defined
|
||||||
autocmds.
|
autocmds.
|
||||||
* [fix] Pressing ESC while |:VimwikiUISelect| opens current wiki index file.
|
* [fix] Pressing ESC while |:VimwikiUISelect| opens current wiki index file.
|
||||||
@ -952,11 +974,11 @@ it's free enough to suit your needs.
|
|||||||
|
|
||||||
vim:tw=78:ts=8:ft=help
|
vim:tw=78:ts=8:ft=help
|
||||||
syntax\vimwiki.vim [[[1
|
syntax\vimwiki.vim [[[1
|
||||||
111
|
128
|
||||||
" Vimwiki syntax file
|
" Vimwiki syntax file
|
||||||
" Author: Maxim Kim <habamax@gmail.com>
|
" Author: Maxim Kim <habamax@gmail.com>
|
||||||
" Home: http://code.google.com/p/vimwiki/
|
" Home: http://code.google.com/p/vimwiki/
|
||||||
" vim:tw=78:
|
" vim:tw=79:
|
||||||
|
|
||||||
" Quit if syntax file is already loaded
|
" Quit if syntax file is already loaded
|
||||||
if version < 600
|
if version < 600
|
||||||
@ -992,6 +1014,9 @@ execute 'syntax match wikiTodo /'. g:vimwiki_rxTodo .'/'
|
|||||||
" Load concrete Wiki syntax
|
" Load concrete Wiki syntax
|
||||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
||||||
|
|
||||||
|
" Tables
|
||||||
|
execute 'syntax match wikiTable /'.g:vimwiki_rxTable.'/'
|
||||||
|
|
||||||
execute 'syntax match wikiBold /'.g:vimwiki_rxBold.'/'
|
execute 'syntax match wikiBold /'.g:vimwiki_rxBold.'/'
|
||||||
|
|
||||||
execute 'syntax match wikiItalic /'.g:vimwiki_rxItalic.'/'
|
execute 'syntax match wikiItalic /'.g:vimwiki_rxItalic.'/'
|
||||||
@ -1011,15 +1036,9 @@ execute 'syntax match wikiCode /'.g:vimwiki_rxCode.'/'
|
|||||||
" Aggregate all the regular text highlighting into wikiText
|
" Aggregate all the regular text highlighting into wikiText
|
||||||
" syntax cluster wikiText contains=wikiItalic,wikiBold,wikiCode,wikiDelText,wikiSuperScript,wikiSubScript,wikiWord,wikiEmoticons
|
" syntax cluster wikiText contains=wikiItalic,wikiBold,wikiCode,wikiDelText,wikiSuperScript,wikiSubScript,wikiWord,wikiEmoticons
|
||||||
|
|
||||||
" Header levels, 1-6
|
|
||||||
execute 'syntax match wikiHeader /'.g:vimwiki_rxHeader.'/'
|
|
||||||
|
|
||||||
" <hr> horizontal rule
|
" <hr> horizontal rule
|
||||||
execute 'syntax match wikiHR /'.g:vimwiki_rxHR.'/'
|
execute 'syntax match wikiHR /'.g:vimwiki_rxHR.'/'
|
||||||
|
|
||||||
" Tables
|
|
||||||
execute 'syntax match wikiTable /'.g:vimwiki_rxTable.'/'
|
|
||||||
|
|
||||||
" List items
|
" List items
|
||||||
execute 'syntax match wikiList /'.g:vimwiki_rxListBullet.'/'
|
execute 'syntax match wikiList /'.g:vimwiki_rxListBullet.'/'
|
||||||
execute 'syntax match wikiList /'.g:vimwiki_rxListNumber.'/'
|
execute 'syntax match wikiList /'.g:vimwiki_rxListNumber.'/'
|
||||||
@ -1037,8 +1056,28 @@ execute 'syntax match wikiCheckBoxDone /'.g:vimwiki_rxListNumber.'\s*\[x\].*$/'
|
|||||||
|
|
||||||
syntax region wikiComment start='<!--' end='-->'
|
syntax region wikiComment start='<!--' end='-->'
|
||||||
|
|
||||||
|
if !vimwiki#hl_exists("wikiHeader1")
|
||||||
|
execute 'syntax match wikiHeader /'.g:vimwiki_rxHeader.'/'
|
||||||
|
else
|
||||||
|
" Header levels, 1-6
|
||||||
|
execute 'syntax match wikiHeader1 /'.g:vimwiki_rxH1.'/'
|
||||||
|
execute 'syntax match wikiHeader2 /'.g:vimwiki_rxH2.'/'
|
||||||
|
execute 'syntax match wikiHeader3 /'.g:vimwiki_rxH3.'/'
|
||||||
|
execute 'syntax match wikiHeader4 /'.g:vimwiki_rxH4.'/'
|
||||||
|
execute 'syntax match wikiHeader5 /'.g:vimwiki_rxH5.'/'
|
||||||
|
execute 'syntax match wikiHeader6 /'.g:vimwiki_rxH6.'/'
|
||||||
|
endif
|
||||||
|
|
||||||
hi def link wikiHeader Title
|
if !vimwiki#hl_exists("wikiHeader1")
|
||||||
|
hi def link wikiHeader Title
|
||||||
|
else
|
||||||
|
hi def link wikiHeader1 Title
|
||||||
|
hi def link wikiHeader2 Title
|
||||||
|
hi def link wikiHeader3 Title
|
||||||
|
hi def link wikiHeader4 Title
|
||||||
|
hi def link wikiHeader5 Title
|
||||||
|
hi def link wikiHeader6 Title
|
||||||
|
endif
|
||||||
|
|
||||||
hi def wikiBold term=bold cterm=bold gui=bold
|
hi def wikiBold term=bold cterm=bold gui=bold
|
||||||
hi def wikiItalic term=italic cterm=italic gui=italic
|
hi def wikiItalic term=italic cterm=italic gui=italic
|
||||||
@ -1074,32 +1113,32 @@ syntax\vimwiki_default.vim [[[1
|
|||||||
|
|
||||||
" text: *strong*
|
" text: *strong*
|
||||||
" let g:vimwiki_rxBold = '\*[^*]\+\*'
|
" let g:vimwiki_rxBold = '\*[^*]\+\*'
|
||||||
let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\zs'.
|
let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||||
\'\*'.
|
\'\*'.
|
||||||
\'\([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`]\)'.
|
\'\([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`]\)'.
|
||||||
\'\*'.
|
\'\*'.
|
||||||
\'\ze\%([[:punct:]]\|\s\|$\)'
|
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||||
|
|
||||||
" text: _emphasis_
|
" text: _emphasis_
|
||||||
" let g:vimwiki_rxItalic = '_[^_]\+_'
|
" let g:vimwiki_rxItalic = '_[^_]\+_'
|
||||||
let g:vimwiki_rxItalic = '\%(^\|\s\|[[:punct:]]\)\zs'.
|
let g:vimwiki_rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||||
\'_'.
|
\'_'.
|
||||||
\'\([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`]\)'.
|
\'\([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`]\)'.
|
||||||
\'_'.
|
\'_'.
|
||||||
\'\ze\%([[:punct:]]\|\s\|$\)'
|
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||||
|
|
||||||
" text: *_bold italic_* or _*italic bold*_
|
" text: *_bold italic_* or _*italic bold*_
|
||||||
let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\zs'.
|
let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||||
\'\*_'.
|
\'\*_'.
|
||||||
\'\([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`]\)'.
|
\'\([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`]\)'.
|
||||||
\'_\*'.
|
\'_\*'.
|
||||||
\'\ze\%([[:punct:]]\|\s\|$\)'
|
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||||
|
|
||||||
let g:vimwiki_rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\zs'.
|
let g:vimwiki_rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||||
\'_\*'.
|
\'_\*'.
|
||||||
\'\([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`]\)'.
|
\'\([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`]\)'.
|
||||||
\'\*_'.
|
\'\*_'.
|
||||||
\'\ze\%([[:punct:]]\|\s\|$\)'
|
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||||
|
|
||||||
" text: `code`
|
" text: `code`
|
||||||
let g:vimwiki_rxCode = '`[^`]\+`'
|
let g:vimwiki_rxCode = '`[^`]\+`'
|
||||||
@ -1399,17 +1438,22 @@ function! vimwiki_gtd#GTDToggleItem()"{{{
|
|||||||
endwhile
|
endwhile
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
autoload\vimwiki_html.vim [[[1
|
autoload\vimwiki_html.vim [[[1
|
||||||
844
|
859
|
||||||
" Vimwiki autoload plugin file
|
" Vimwiki autoload plugin file
|
||||||
" Export to HTML
|
" Export to HTML
|
||||||
" Author: Maxim Kim <habamax@gmail.com>
|
" Author: Maxim Kim <habamax@gmail.com>
|
||||||
" Home: http://code.google.com/p/vimwiki/
|
" Home: http://code.google.com/p/vimwiki/
|
||||||
|
|
||||||
|
" Load only once {{{
|
||||||
if exists("g:loaded_vimwiki_html_auto") || &cp
|
if exists("g:loaded_vimwiki_html_auto") || &cp
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_vimwiki_html_auto = 1
|
let g:loaded_vimwiki_html_auto = 1
|
||||||
|
"}}}
|
||||||
|
" Warn if html header or html footer do not exist only once. {{{
|
||||||
|
let s:warn_html_header = 0
|
||||||
|
let s:warn_html_footer = 0
|
||||||
|
"}}}
|
||||||
" TODO: move the next 2 functions into vimwiki#msg and
|
" TODO: move the next 2 functions into vimwiki#msg and
|
||||||
" vimwiki#get_file_name_only.
|
" vimwiki#get_file_name_only.
|
||||||
function! s:msg(message) "{{{
|
function! s:msg(message) "{{{
|
||||||
@ -1432,21 +1476,18 @@ function! s:create_default_CSS(path) " {{{
|
|||||||
let path = expand(a:path)
|
let path = expand(a:path)
|
||||||
if glob(path.'style.css') == ""
|
if glob(path.'style.css') == ""
|
||||||
let lines = []
|
let lines = []
|
||||||
call add(lines, 'body {margin: 1em 5em 1em 5em; font-size: 100%; line-height: 1.5;}')
|
|
||||||
call add(lines, 'h1 {font-size: 2.0em;}')
|
call add(lines, 'body {margin: 1em 2em 1em 2em; font-size: 100%; line-height: 130%;}')
|
||||||
call add(lines, 'h2 {font-size: 1.6em;}')
|
call add(lines, 'h1, h2, h3, h4, h5, h6 {margin-top: 1.5em; margin-bottom: 0.5em;}')
|
||||||
call add(lines, 'h3 {font-size: 1.2em;}')
|
call add(lines, 'h1 {font-size: 2.0em; color: #3366aa;}')
|
||||||
call add(lines, 'h4 {font-size: 1.2em;}')
|
call add(lines, 'h2 {font-size: 1.6em; color: #335588;}')
|
||||||
call add(lines, 'h5 {font-size: 1.1em;}')
|
call add(lines, 'h3 {font-size: 1.2em; color: #224466;}')
|
||||||
call add(lines, 'h6 {font-size: 1.1em;}')
|
call add(lines, 'h4 {font-size: 1.2em; color: #113344;}')
|
||||||
call add(lines, 'h1, h2, h3, h4, h5, h6 {margin: 1.2em auto 0.6em;}')
|
call add(lines, 'h5 {font-size: 1.1em; color: #112233;}')
|
||||||
call add(lines, 'h1 {border-bottom: 1px solid #3366cc; text-align: left; padding: 0em 1em 0em 0em;}')
|
call add(lines, 'h6 {font-size: 1.1em; color: #111111;}')
|
||||||
call add(lines, 'h3 {background: #e5ecf9; border-top: 1px solid #3366cc; padding: 0em 0.1em 0em 0.1em;}')
|
call add(lines, 'p, pre, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;}')
|
||||||
call add(lines, 'h4 {color: #333333;}')
|
call add(lines, 'ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;}')
|
||||||
call add(lines, 'h5 {color: #555555;}')
|
call add(lines, 'li {margin: 0.3em auto;}')
|
||||||
call add(lines, 'h6 {color: #777777;}')
|
|
||||||
call add(lines, 'p, pre {margin: 0.6em auto;}')
|
|
||||||
call add(lines, 'ul, ol, dl, li {margin: 0.3em auto;}')
|
|
||||||
call add(lines, 'ul {margin-left: 2em; padding-left: 0.5em;}')
|
call add(lines, 'ul {margin-left: 2em; padding-left: 0.5em;}')
|
||||||
call add(lines, 'dt {font-weight: bold;}')
|
call add(lines, 'dt {font-weight: bold;}')
|
||||||
call add(lines, 'img {border: none;}')
|
call add(lines, 'img {border: none;}')
|
||||||
@ -1455,6 +1496,9 @@ function! s:create_default_CSS(path) " {{{
|
|||||||
call add(lines, 'hr {border: none; border-top: 1px solid #ccc; width: 100%;}')
|
call add(lines, 'hr {border: none; border-top: 1px solid #ccc; width: 100%;}')
|
||||||
call add(lines, '.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}')
|
call add(lines, '.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}')
|
||||||
call add(lines, '.strike {text-decoration: line-through; color: #777777;}')
|
call add(lines, '.strike {text-decoration: line-through; color: #777777;}')
|
||||||
|
call add(lines, '.justleft {text-align: left;}')
|
||||||
|
call add(lines, '.justright {text-align: right;}')
|
||||||
|
call add(lines, '.justcenter {text-align: center;}')
|
||||||
|
|
||||||
call writefile(lines, path.'style.css')
|
call writefile(lines, path.'style.css')
|
||||||
echomsg "Default style.css is created."
|
echomsg "Default style.css is created."
|
||||||
@ -1491,12 +1535,13 @@ endfunction "}}}
|
|||||||
function! s:get_html_header(title, charset) "{{{
|
function! s:get_html_header(title, charset) "{{{
|
||||||
let lines=[]
|
let lines=[]
|
||||||
|
|
||||||
if VimwikiGet('html_header') != ""
|
if VimwikiGet('html_header') != "" && !s:warn_html_header
|
||||||
try
|
try
|
||||||
let lines = readfile(expand(VimwikiGet('html_header')))
|
let lines = readfile(expand(VimwikiGet('html_header')))
|
||||||
call map(lines, 'substitute(v:val, "%title%", "'. a:title .'", "g")')
|
call map(lines, 'substitute(v:val, "%title%", "'. a:title .'", "g")')
|
||||||
return lines
|
return lines
|
||||||
catch /E484/
|
catch /E484/
|
||||||
|
let s:warn_html_header = 1
|
||||||
call s:msg("Header template ". VimwikiGet('html_header'). " does not exist!")
|
call s:msg("Header template ". VimwikiGet('html_header'). " does not exist!")
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
@ -1517,11 +1562,12 @@ endfunction "}}}
|
|||||||
function! s:get_html_footer() "{{{
|
function! s:get_html_footer() "{{{
|
||||||
let lines=[]
|
let lines=[]
|
||||||
|
|
||||||
if VimwikiGet('html_footer') != ""
|
if VimwikiGet('html_footer') != "" && !s:warn_html_footer
|
||||||
try
|
try
|
||||||
let lines = readfile(expand(VimwikiGet('html_footer')))
|
let lines = readfile(expand(VimwikiGet('html_footer')))
|
||||||
return lines
|
return lines
|
||||||
catch /E484/
|
catch /E484/
|
||||||
|
let s:warn_html_footer = 1
|
||||||
call s:msg("Footer template ". VimwikiGet('html_footer'). " does not exist!")
|
call s:msg("Footer template ". VimwikiGet('html_footer'). " does not exist!")
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
@ -1791,8 +1837,16 @@ function! s:process_tag_table(line, table) "{{{
|
|||||||
let pos2 = len(a:line)
|
let pos2 = len(a:line)
|
||||||
endif
|
endif
|
||||||
let line = strpart(a:line, pos1+2, pos2-pos1-2)
|
let line = strpart(a:line, pos1+2, pos2-pos1-2)
|
||||||
if line != ''
|
if line == ''
|
||||||
call add(lines, "<td>".line."</td>")
|
continue
|
||||||
|
endif
|
||||||
|
if strpart(line, 0, 1) == ' ' &&
|
||||||
|
\ strpart(line, len(line) - 1, 1) == ' '
|
||||||
|
call add(lines, '<td class="justcenter">'.line.'</td>')
|
||||||
|
elseif strpart(line, 0, 1) == ' '
|
||||||
|
call add(lines, '<td class="justright">'.line.'</td>')
|
||||||
|
else
|
||||||
|
call add(lines, '<td class="justleft">'.line.'</td>')
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
call add(lines, "</tr>")
|
call add(lines, "</tr>")
|
||||||
@ -2245,7 +2299,7 @@ function! vimwiki_html#WikiAll2HTML(path) "{{{
|
|||||||
let &more = setting_more
|
let &more = setting_more
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
autoload\vimwiki.vim [[[1
|
autoload\vimwiki.vim [[[1
|
||||||
386
|
375
|
||||||
" Vimwiki autoload plugin file
|
" Vimwiki autoload plugin file
|
||||||
" Author: Maxim Kim <habamax@gmail.com>
|
" Author: Maxim Kim <habamax@gmail.com>
|
||||||
" Home: http://code.google.com/p/vimwiki/
|
" Home: http://code.google.com/p/vimwiki/
|
||||||
@ -2365,7 +2419,7 @@ function! vimwiki#mkdir(path) "{{{
|
|||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:update_wiki_link(fname, old, new) " {{{
|
function! s:update_wiki_link(fname, old, new) " {{{
|
||||||
echomsg "Updating links in ".a:fname
|
echo "Updating links in ".a:fname
|
||||||
let has_updates = 0
|
let has_updates = 0
|
||||||
let dest = []
|
let dest = []
|
||||||
for line in readfile(a:fname)
|
for line in readfile(a:fname)
|
||||||
@ -2391,17 +2445,36 @@ endfunction " }}}
|
|||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" HISTORY helper functions {{{
|
" SYNTAX highlight {{{
|
||||||
" history is [['WikiWord.wiki', getpos('.')],
|
function! vimwiki#WikiHighlightWords() "{{{
|
||||||
" ['AnotherWikiWord', getpos('.')] ... etc]
|
let wikies = glob(VimwikiGet('path').'*'.VimwikiGet('ext'))
|
||||||
" where numbers are row and column positions we should return to when coming back.
|
"" remove .wiki extensions
|
||||||
function! s:get_history_word(historyItem)
|
let wikies = substitute(wikies, '\'.VimwikiGet('ext'), "", "g")
|
||||||
return get(a:historyItem, 0)
|
let g:vimwiki_wikiwords = split(wikies, '\n')
|
||||||
endfunction
|
"" remove paths
|
||||||
|
call map(g:vimwiki_wikiwords, 'substitute(v:val, ''.*[/\\]'', "", "g")')
|
||||||
|
"" remove backup files (.wiki~)
|
||||||
|
call filter(g:vimwiki_wikiwords, 'v:val !~ ''.*\~$''')
|
||||||
|
|
||||||
function! s:get_history_pos(historyItem)
|
for word in g:vimwiki_wikiwords
|
||||||
return get(a:historyItem, 1)
|
if word =~ g:vimwiki_word1 && !s:is_link_to_non_wiki_file(word)
|
||||||
endfunction
|
execute 'syntax match wikiWord /\%(^\|[^!]\)\zs\<'.word.'\>/'
|
||||||
|
endif
|
||||||
|
execute 'syntax match wikiWord /\[\[\<'.substitute(word, g:vimwiki_stripsym, s:wiki_badsymbols, "g").'\>\%(|\+.*\)*\]\]/'
|
||||||
|
endfor
|
||||||
|
execute 'syntax match wikiWord /\[\[.\+\.\%(jpg\|png\|gif\)\%(|\+.*\)*\]\]/'
|
||||||
|
endfunction "}}}
|
||||||
|
|
||||||
|
function! vimwiki#hl_exists(hl)"{{{
|
||||||
|
if !hlexists(a:hl)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
redir => hlstatus
|
||||||
|
exe "silent hi" a:hl
|
||||||
|
redir END
|
||||||
|
return (hlstatus !~ "cleared")
|
||||||
|
endfunc
|
||||||
|
"}}}
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" WIKI functions {{{
|
" WIKI functions {{{
|
||||||
@ -2430,39 +2503,21 @@ function! vimwiki#WikiFollowWord(split) "{{{
|
|||||||
if s:is_link_to_non_wiki_file(word)
|
if s:is_link_to_non_wiki_file(word)
|
||||||
call s:edit_file(cmd, word)
|
call s:edit_file(cmd, word)
|
||||||
else
|
else
|
||||||
call insert(VimwikiGet('history'), [expand('%:p'), getpos('.')])
|
let vimwiki_prev_word = [expand('%:p'), getpos('.')]
|
||||||
call s:edit_file(cmd, VimwikiGet('path').word.VimwikiGet('ext'))
|
call s:edit_file(cmd, VimwikiGet('path').word.VimwikiGet('ext'))
|
||||||
|
let b:vimwiki_prev_word = vimwiki_prev_word
|
||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#WikiGoBackWord() "{{{
|
function! vimwiki#WikiGoBackWord() "{{{
|
||||||
if !empty(VimwikiGet('history'))
|
if exists("b:vimwiki_prev_word")
|
||||||
let item = remove(VimwikiGet('history'), 0)
|
|
||||||
" go back to saved WikiWord
|
" go back to saved WikiWord
|
||||||
execute ":e ".substitute(s:get_history_word(item), '\s', '\\\0', 'g')
|
let prev_word = b:vimwiki_prev_word
|
||||||
call setpos('.', s:get_history_pos(item))
|
execute ":e ".substitute(prev_word[0], '\s', '\\\0', 'g')
|
||||||
|
call setpos('.', prev_word[1])
|
||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#WikiHighlightWords() "{{{
|
|
||||||
let wikies = glob(VimwikiGet('path').'*'.VimwikiGet('ext'))
|
|
||||||
"" remove .wiki extensions
|
|
||||||
let wikies = substitute(wikies, '\'.VimwikiGet('ext'), "", "g")
|
|
||||||
let g:vimwiki_wikiwords = split(wikies, '\n')
|
|
||||||
"" remove paths
|
|
||||||
call map(g:vimwiki_wikiwords, 'substitute(v:val, ''.*[/\\]'', "", "g")')
|
|
||||||
"" remove backup files (.wiki~)
|
|
||||||
call filter(g:vimwiki_wikiwords, 'v:val !~ ''.*\~$''')
|
|
||||||
|
|
||||||
for word in g:vimwiki_wikiwords
|
|
||||||
if word =~ g:vimwiki_word1 && !s:is_link_to_non_wiki_file(word)
|
|
||||||
execute 'syntax match wikiWord /\%(^\|[^!]\)\zs\<'.word.'\>/'
|
|
||||||
endif
|
|
||||||
execute 'syntax match wikiWord /\[\[\<'.substitute(word, g:vimwiki_stripsym, s:wiki_badsymbols, "g").'\>\%(|\+.*\)*\]\]/'
|
|
||||||
endfor
|
|
||||||
execute 'syntax match wikiWord /\[\[.\+\.\%(jpg\|png\|gif\)\%(|\+.*\)*\]\]/'
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! vimwiki#WikiGoHome(index) "{{{
|
function! vimwiki#WikiGoHome(index) "{{{
|
||||||
call s:wiki_select(a:index)
|
call s:wiki_select(a:index)
|
||||||
call vimwiki#mkdir(VimwikiGet('path'))
|
call vimwiki#mkdir(VimwikiGet('path'))
|
||||||
@ -2477,7 +2532,6 @@ function! vimwiki#WikiGoHome(index) "{{{
|
|||||||
" Find out what is the reason and how to avoid it. Is it dangerous?
|
" Find out what is the reason and how to avoid it. Is it dangerous?
|
||||||
echomsg "Unknown error!"
|
echomsg "Unknown error!"
|
||||||
endtry
|
endtry
|
||||||
call VimwikiSet('history', [])
|
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#WikiDeleteWord() "{{{
|
function! vimwiki#WikiDeleteWord() "{{{
|
||||||
@ -2496,16 +2550,6 @@ function! vimwiki#WikiDeleteWord() "{{{
|
|||||||
endtry
|
endtry
|
||||||
execute "bdelete! ".escape(fname, " ")
|
execute "bdelete! ".escape(fname, " ")
|
||||||
|
|
||||||
" delete from g:vimwiki_history list
|
|
||||||
call filter (VimwikiGet('history'), 's:get_history_word(v:val) != fname')
|
|
||||||
" as we got back to previous WikiWord - delete it from history - as much
|
|
||||||
" as possible
|
|
||||||
let hword = ""
|
|
||||||
while !empty(VimwikiGet('history')) &&
|
|
||||||
\ hword == s:get_history_word(VimwikiGet('history')[0])
|
|
||||||
let hword = s:get_history_word(remove(VimwikiGet('history'), 0))
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
" reread buffer => deleted WikiWord should appear as non-existent
|
" reread buffer => deleted WikiWord should appear as non-existent
|
||||||
if expand('%:p') != ""
|
if expand('%:p') != ""
|
||||||
execute "e"
|
execute "e"
|
||||||
@ -2602,7 +2646,6 @@ function! vimwiki#WikiRenameWord() "{{{
|
|||||||
setlocal nomore
|
setlocal nomore
|
||||||
|
|
||||||
" update links
|
" update links
|
||||||
echomsg "Updating links to ".newWord."..."
|
|
||||||
if isOldWordComplex
|
if isOldWordComplex
|
||||||
call s:update_wiki_links('\[\['.wwtorename.'\]\]', newWord)
|
call s:update_wiki_links('\[\['.wwtorename.'\]\]', newWord)
|
||||||
else
|
else
|
||||||
@ -2633,7 +2676,7 @@ endfunction"}}}
|
|||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
ftplugin\vimwiki.vim [[[1
|
ftplugin\vimwiki.vim [[[1
|
||||||
196
|
201
|
||||||
" Vimwiki filetype plugin file
|
" Vimwiki filetype plugin file
|
||||||
" Author: Maxim Kim <habamax@gmail.com>
|
" Author: Maxim Kim <habamax@gmail.com>
|
||||||
" Home: http://code.google.com/p/vimwiki/
|
" Home: http://code.google.com/p/vimwiki/
|
||||||
@ -2697,31 +2740,18 @@ function! VimwikiFoldLevel(lnum) "{{{
|
|||||||
let rx_list_item = '\('.
|
let rx_list_item = '\('.
|
||||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
||||||
\ '\)'
|
\ '\)'
|
||||||
if line =~ rx_list_item &&
|
if line =~ rx_list_item && nline =~ rx_list_item
|
||||||
\ nline =~ rx_list_item
|
|
||||||
if VimwikiGet('syntax') == 'media'
|
|
||||||
return s:get_li_level_media(a:lnum, nnum)
|
|
||||||
else
|
|
||||||
return s:get_li_level(a:lnum, nnum)
|
return s:get_li_level(a:lnum, nnum)
|
||||||
endif
|
" list is over, remove foldlevel
|
||||||
|
elseif line =~ rx_list_item && nline !~ rx_list_item
|
||||||
|
return s:get_li_level_last(a:lnum)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return '='
|
return '='
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:get_li_level(lnum, nnum) "{{{
|
function! s:get_li_level(lnum, nnum) "{{{
|
||||||
let level = ((indent(a:nnum) - indent(a:lnum)) / &sw)
|
if VimwikiGet('syntax') == 'media'
|
||||||
if level > 0
|
|
||||||
return "a".level
|
|
||||||
elseif level < 0
|
|
||||||
return "s".abs(level)
|
|
||||||
else
|
|
||||||
return "="
|
|
||||||
endif
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
" Special case: MediaWiki list items level do not use indents.
|
|
||||||
function! s:get_li_level_media(lnum, nnum) "{{{
|
|
||||||
let level = s:count_first_sym(getline(a:nnum)) -
|
let level = s:count_first_sym(getline(a:nnum)) -
|
||||||
\ s:count_first_sym(getline(a:lnum))
|
\ s:count_first_sym(getline(a:lnum))
|
||||||
if level > 0
|
if level > 0
|
||||||
@ -2731,6 +2761,24 @@ function! s:get_li_level_media(lnum, nnum) "{{{
|
|||||||
else
|
else
|
||||||
return "="
|
return "="
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
let level = ((indent(a:nnum) - indent(a:lnum)) / &sw)
|
||||||
|
if level > 0
|
||||||
|
return "a".level
|
||||||
|
elseif level < 0
|
||||||
|
return "s".abs(level)
|
||||||
|
else
|
||||||
|
return "="
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction "}}}
|
||||||
|
|
||||||
|
function! s:get_li_level_last(lnum) "{{{
|
||||||
|
if VimwikiGet('syntax') == 'media'
|
||||||
|
return "s".(s:count_first_sym(getline(a:lnum)) - 1)
|
||||||
|
else
|
||||||
|
return "s".(indent(a:lnum) / &sw - 1)
|
||||||
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:count_first_sym(line) "{{{
|
function! s:count_first_sym(line) "{{{
|
||||||
@ -2831,7 +2879,7 @@ noremap <silent><script><buffer>
|
|||||||
|
|
||||||
" KEYBINDINGS }}}
|
" KEYBINDINGS }}}
|
||||||
plugin\vimwiki.vim [[[1
|
plugin\vimwiki.vim [[[1
|
||||||
193
|
197
|
||||||
" Vimwiki plugin file
|
" Vimwiki plugin file
|
||||||
" Author: Maxim Kim <habamax@gmail.com>
|
" Author: Maxim Kim <habamax@gmail.com>
|
||||||
" Home: http://code.google.com/p/vimwiki/
|
" Home: http://code.google.com/p/vimwiki/
|
||||||
@ -2889,6 +2937,7 @@ function! s:setup_buffer_enter() "{{{
|
|||||||
|
|
||||||
let b:vimwiki_idx = g:vimwiki_current_idx
|
let b:vimwiki_idx = g:vimwiki_current_idx
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if &filetype != 'vimwiki'
|
if &filetype != 'vimwiki'
|
||||||
setlocal ft=vimwiki
|
setlocal ft=vimwiki
|
||||||
else
|
else
|
||||||
@ -2908,7 +2957,6 @@ let s:vimwiki_defaults.syntax = 'default'
|
|||||||
let s:vimwiki_defaults.gohome = 'split'
|
let s:vimwiki_defaults.gohome = 'split'
|
||||||
let s:vimwiki_defaults.html_header = ''
|
let s:vimwiki_defaults.html_header = ''
|
||||||
let s:vimwiki_defaults.html_footer = ''
|
let s:vimwiki_defaults.html_footer = ''
|
||||||
let s:vimwiki_defaults.history = []
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" DEFAULT options {{{
|
" DEFAULT options {{{
|
||||||
@ -2994,6 +3042,10 @@ augroup vimwiki
|
|||||||
for ext in keys(extensions)
|
for ext in keys(extensions)
|
||||||
execute 'autocmd BufEnter *'.ext.' call s:setup_buffer_enter()'
|
execute 'autocmd BufEnter *'.ext.' call s:setup_buffer_enter()'
|
||||||
execute 'autocmd BufLeave,BufHidden *'.ext.' call s:setup_buffer_leave()'
|
execute 'autocmd BufLeave,BufHidden *'.ext.' call s:setup_buffer_leave()'
|
||||||
|
|
||||||
|
" ColorScheme could have or could have not a wikiHeader1..wikiHeader6
|
||||||
|
" highlight groups. We need to refresh syntax after colorscheme change.
|
||||||
|
execute 'autocmd ColorScheme *'.ext.' set syntax=vimwiki'
|
||||||
endfor
|
endfor
|
||||||
augroup END
|
augroup END
|
||||||
"}}}
|
"}}}
|
Loading…
Reference in New Issue
Block a user