Version 0.7

* NEW: GTD stuff -- toggleable list items. See h: vimwiki-gtd.
 * FIX: Headers do not fold inner headers. (Thanks Brett Stahlman)
 * FIX: Remove last blank lines from preformatted text at the end of file (HTML).
 * DEL: Removed g:vimwiki_smartCR option.
This commit is contained in:
Maxim Kim 2009-02-23 00:00:00 +00:00 committed by Able Scraper
parent 2417109bc3
commit cd42eecc86

View File

@ -2,7 +2,7 @@
UseVimball
finish
doc\vimwiki.txt [[[1
670
669
*vimwiki.txt* A Personal Wiki for Vim
__ __ ______ __ __ ______ __ __ ______ ~
@ -13,10 +13,7 @@ doc\vimwiki.txt [[[1
\ `\___/ /\_____\\ \_\\ \_\ `\___x___/ /\_____\\ \_\ \_\ /\_____\~
`\/__/ \/_____/ \/_/ \/_/'\/__//__/ \/_____/ \/_/\/_/ \/_____/~
Let the help begins ...~
Version: 0.6.2 ~
Version: 0.7.0 ~
==============================================================================
CONTENTS *vimwiki-contents*
@ -37,11 +34,12 @@ CONTENTS *vimwiki-contents*
5.5. Lists ...............................|vimwiki-lists|
5.6. Tables ..............................|vimwiki-tables|
5.7. Pre .................................|vimwiki-pre|
6. Options .................................|vimwiki-options|
7. Help ....................................|vimwiki-help|
8. Author ..................................|vimwiki-author|
9. Changelog ...............................|vimwiki-changelog|
10. License ................................|vimwiki-license|
6. Getting Things Done (GTD)................|vimwiki-gtd|
7. Options .................................|vimwiki-options|
8. Help ....................................|vimwiki-help|
9. Author ..................................|vimwiki-author|
10. Changelog ..............................|vimwiki-changelog|
11. License ................................|vimwiki-license|
==============================================================================
@ -142,6 +140,9 @@ Normal mode (Keyboard):~
<Leader>wr Rename WikiWord you are in.
Maps to|:VimwikiRenameWord|.
<C-Space> Toggle list item on/off (checked/unchecked)
Maps to|:VimwikiGTDToggleItem|.
See |vimwiki-gtd|.
Normal mode (Mouse): ~
<2-LeftMouse> Follow/Create WikiWord
@ -204,6 +205,11 @@ Note that in order 2HTML commands to work you should set up & create html
directory. By default it is g:vimwiki_home/html/ so just go to g:vimwiki_home
and create html directory there.
*:VimwikiGTDToggleItem*
Toggle list item on/off (checked/unchecked)
See |vimwiki-gtd|.
==============================================================================
5. Wiki syntax *vimwiki-syntax*
@ -358,7 +364,29 @@ It could be started from column 0.
==============================================================================
6. Options *vimwiki-options*
6. Getting Things Done (GTD) *vimwiki-gtd*
That is not really a GTD :). But vimwiki can handle "projects" that are just
lists of items you can check/uncheck.
Consider the following example:
!!! Toggleable list of items
* [ ] Toggleable vimwiki's list of items
* [x] Toggle list item on/off.
* [x] Simple toggling between [ ] and [x].
* [x] All list's subitems should be toggled on/off appropriately.
* [x] Toggle child subitems only if current line is list item
* [x] Parent list item should be toggled depending on it's child items.
* [x] Make numbered list items toggleable too
* [ ] Add highlighting to list item boxes
* [x] Add [ ] to the next created with o, O and <CR> list item.
Pressing <C-Space> on the first list item will toggle it and all of it's child
items.
==============================================================================
7. Options *vimwiki-options*
------------------------------------------------------------------------------
Default: "" *g:vimwiki_home*
@ -457,40 +485,6 @@ Values: Lower letters ranges
See |g:vimwiki_upper|: >
let g:vimwiki_lower="a-z"
------------------------------------------------------------------------------
Default: 1 *g:vimwiki_smartCR*
Values: 0, 1, 2
This option affects the behaviour of <CR> in INSERT mode while adding new
|vimwiki-lists|items.
let g:vimwiki_smartCR=1~
Imagine you have the following list (cursor stands on | ): >
* List item 1
* List item 2 |
Now if you press <CR>: >
* List item 1
* List item 2
* |
New list item appear. Now press <CR> again: >
* List item 1
* List item 2
|
It is disappeared. That's it. Try it with cursor on any part of the list. It
also works for |o| and |O|.
let g:vimwiki_smartCR=2~
It only adds new list item. Nothing more. It uses Vim comments facility such
as: >
:h comments
:h formatoptions.
To turn it off: >
let g:vimwiki_smartCR = 0
------------------------------------------------------------------------------
Default: 1 *g:vimwiki_maxhi*
Values: 0, 1
@ -518,7 +512,7 @@ splitted. Or opened in a new tab.
==============================================================================
7. Help *vimwiki-help*
8. Help *vimwiki-help*
As you could see I am not native English speaker (not a writer as well).
Please send me correct phrases instead of that incorrect stuff I have used
@ -527,7 +521,7 @@ here.
Any help is really appreciated!
==============================================================================
8. Author *vimwiki-author*
9. Author *vimwiki-author*
I live in Moscow and you may believe me -- there are no polar bears (no brown
too) here in the streets.
@ -535,14 +529,19 @@ too) here in the streets.
I do not do programming for a living. So don't blame me for an ugly
ineffective code. :)
Maxim Kim
e-mail: habamax@gmail.com~
Maxim Kim <habamax@gmail.com>
Vimwiki's website: http://code.google.com/p/vimwiki/
Vim plugins website: http://www.Vim.org/scripts/script.php?script_id=2226
==============================================================================
9. Changelog *vimwiki-changelog*
10. Changelog *vimwiki-changelog*
0.7.0
* [new] GTD stuff -- toggleable list items. See |vimwiki-gtd|.
* [fix] Headers do not fold inner headers. (Thanks Brett Stahlman)
* [fix] Remove last blank lines from preformatted text at the end of file.
* [del] Removed g:vimwiki_smartCR option.
0.6.2
* [new] [[link|description]] is available now.
@ -663,7 +662,7 @@ Vim plugins website: http://www.Vim.org/scripts/script.php?script_id=2226
* First public version.
==============================================================================
10. License *vimwiki-license*
11. License *vimwiki-license*
GNU General Public License v2
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
@ -672,16 +671,16 @@ To be frank I didn't read it myself. It is not that easy reading. But I hope
it's free enough to suit your needs.
vim:tw=78:ts=8:ft=help:fdm=marker:
vim:tw=78:ts=8:ft=help
syntax\vimwiki.vim [[[1
123
129
" Vim syntax file
" Language: Wiki
" Author: Maxim Kim (habamax at gmail dot com)
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-10 16:15
" Version: 0.6.2
" Last Change: 2009-02-19 10:12
" Version: 0.7.0
" Quit if syntax file is already loaded
if version < 600
@ -705,10 +704,7 @@ else
endif
" text: "this is a link (optional tooltip)":http://www.microsoft.com
" TODO: check URL syntax against RFC
let g:vimwiki_rxWeblink = '\("[^"(]\+\((\([^)]\+\))\)\?":\)\?\(https\?\|ftp\|gopher\|telnet\|file\|notes\|ms-help\):\(\(\(//\)\|\(\\\\\)\)\+[A-Za-z0-9:#@%/;$~_?+=.&\\\-]*\)'
" let g:vimwiki_rxWeblink = '\("[^"(]\+\((\([^)]\+\))\)\?":\)\?\(https\?\|ftp\|gopher\|telnet\|file\|notes\|ms-help\):\(\(\(//\)\|\(\\\\\)\)\+[A-Za-z0-9:#@%/;$~_?+-=.&\-\\\\]*\)'
execute 'syntax match wikiLink `'.g:vimwiki_rxWeblink.'`'
" Emoticons: must come after the Textilisms, as later rules take precedence
@ -736,7 +732,7 @@ execute 'syntax match wikiSubScript /'.g:vimwiki_rxSubScript.'/'
execute 'syntax match wikiCode /'.g:vimwiki_rxCode.'/'
" 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 wikiH1 /'.g:vimwiki_rxH1.'/'
@ -746,15 +742,13 @@ execute 'syntax match wikiH4 /'.g:vimwiki_rxH4.'/'
execute 'syntax match wikiH5 /'.g:vimwiki_rxH5.'/'
execute 'syntax match wikiH6 /'.g:vimwiki_rxH6.'/'
" <hr>, horizontal rule
" <hr> horizontal rule
execute 'syntax match wikiHR /'.g:vimwiki_rxHR.'/'
" Tables. Each line starts and ends with '||'; each cell is separated by '||'
" Tables
execute 'syntax match wikiTable /'.g:vimwiki_rxTable.'/'
" Bulleted list items start with whitespace(s), then '*'
" syntax match wikiList /^\s\+\(\*\|[1-9]\+0*\.\).*$/ contains=@wikiText
" highlight only bullets and digits.
" List items
execute 'syntax match wikiList /'.g:vimwiki_rxListBullet.'/'
execute 'syntax match wikiList /'.g:vimwiki_rxListNumber.'/'
@ -762,12 +756,23 @@ execute 'syntax match wikiList /'.g:vimwiki_rxListNumber.'/'
execute 'syntax match wikiPre /'.g:vimwiki_rxPre1.'/'
execute 'syntax region wikiPre start=/'.g:vimwiki_rxPreStart.'/ end=/'.g:vimwiki_rxPreEnd.'/'
" FIXME: this is quite buggy...
" execute 'syntax sync match wikiPreSync grouphere wikiPre /'.g:vimwiki_rxPreStart.'/'
" Folding
execute 'syntax region wikiHeaderFolding start=/'.g:vimwiki_rxFoldHeadingStart.'/ end=/'.g:vimwiki_rxFoldHeadingEnd.'/ transparent fold'
execute 'syntax region wikiH1Folding start=/'.g:vimwiki_rxFoldH1Start.
\ '/ end=/'.g:vimwiki_rxFoldH1End.'/me=s-1 transparent fold'
execute 'syntax region wikiH2Folding start=/'.g:vimwiki_rxFoldH2Start.
\ '/ end=/'.g:vimwiki_rxFoldH2End.'/me=s-1 transparent fold'
execute 'syntax region wikiH3Folding start=/'.g:vimwiki_rxFoldH3Start.
\ '/ end=/'.g:vimwiki_rxFoldH3End.'/me=s-1 transparent fold'
execute 'syntax region wikiH4Folding start=/'.g:vimwiki_rxFoldH4Start.
\ '/ end=/'.g:vimwiki_rxFoldH4End.'/me=s-1 transparent fold'
execute 'syntax region wikiH5Folding start=/'.g:vimwiki_rxFoldH5Start.
\ '/ end=/'.g:vimwiki_rxFoldH5End.'/me=s-1 transparent fold'
execute 'syntax region wikiH6Folding start=/'.g:vimwiki_rxFoldH6Start.
\ '/ end=/'.g:vimwiki_rxFoldH6End.'/me=s-1 transparent fold'
" List item checkbox
syntax match wikiCheckBox /\[.\?\]/
hi def link wikiH1 Title
hi def link wikiH2 wikiH1
@ -788,6 +793,7 @@ hi def link wikiNoExistsWord Error
hi def link wikiPre PreProc
hi def link wikiLink Underlined
hi def link wikiList Operator
hi def link wikiCheckBox wikiList
hi def link wikiTable PreProc
hi def link wikiEmoticons Constant
hi def link wikiDelText Comment
@ -797,16 +803,15 @@ hi def link wikiSubScript Constant
hi def link wikiTodo Todo
let b:current_syntax="vimwiki"
syntax\vimwiki_default.vim [[[1
66
76
" Vim syntax file
" Language: Wiki (vimwiki default)
" Author: Maxim Kim (habamax at gmail dot com)
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-08 01:38
" Version: 0.6.2
" Last Change: 2009-02-19 10:16
" Version: 0.7.0
" text: *strong*
" let g:vimwiki_rxBold = '\*[^*]\+\*'
@ -845,10 +850,7 @@ let g:vimwiki_rxHR = '^----.*$'
" Tables. Each line starts and ends with '||'; each cell is separated by '||'
let g:vimwiki_rxTable = '||'
" Bulleted list items start with whitespace(s), then '*'
" syntax match wikiList /^\s\+\(\*\|[1-9]\+0*\.\).*$/ contains=@wikiText
" highlight only bullets and digits.
" let g:vimwiki_rxList = '^\s\+\(\*\|#\)'
" List items start with whitespace(s) then '*' or '#'
let g:vimwiki_rxListBullet = '^\s\+\*'
let g:vimwiki_rxListNumber = '^\s\+#'
@ -856,25 +858,38 @@ let g:vimwiki_rxListNumber = '^\s\+#'
let g:vimwiki_rxPre1 = '^\s\+[^[:blank:]*#].*$'
" Preformatted text
" let g:vimwiki_rxPreStart = '^{{{\s*$'
" let g:vimwiki_rxPreEnd = '^}}}\s*$'
let g:vimwiki_rxPreStart = '{{{'
let g:vimwiki_rxPreEnd = '}}}'
" Header's folding
let g:vimwiki_rxFoldHeadingStart = '^!'
let g:vimwiki_rxFoldHeadingEnd = '\n\+\ze!'
let g:vimwiki_rxFoldH1Start = '^![^!]\+.*'
let g:vimwiki_rxFoldH1End = '^![^!]\+.*'
let g:vimwiki_rxFoldH2Start = '^!![^!]\+.*'
let g:vimwiki_rxFoldH2End = '^!!\{,1}[^!]\+.*'
let g:vimwiki_rxFoldH3Start = '^!!![^!]\+.*'
let g:vimwiki_rxFoldH3End = '^!!\{,2}[^!]\+.*'
let g:vimwiki_rxFoldH4Start = '^!!!![^!]\+.*'
let g:vimwiki_rxFoldH4End = '^!!\{,3}[^!]\+.*'
let g:vimwiki_rxFoldH5Start = '^!!!!![^!]\+.*'
let g:vimwiki_rxFoldH5End = '^!!\{,4}[^!]\+.*'
let g:vimwiki_rxFoldH6Start = '^!!!!!![^!]\+.*'
let g:vimwiki_rxFoldH6End = '^!!\{,5}[^!]\+.*'
" vim:tw=0:
syntax\vimwiki_google.vim [[[1
65
78
" Vim syntax file
" Language: Wiki
" Author: Maxim Kim (habamax at gmail dot com)
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-08 01:39
" Version: 0.6.2
" Last Change: 2009-02-19 11:27
" Version: 0.7.0
" text: *strong*
" let g:vimwiki_rxBold = '\*[^*]\+\*'
@ -923,25 +938,38 @@ let g:vimwiki_rxListNumber = '^\s\+#'
let g:vimwiki_rxPre1 = '^\s\+[^[:blank:]*#].*$'
" Preformatted text
" let g:vimwiki_rxPreStart = '^{{{\s*$'
" let g:vimwiki_rxPreEnd = '^}}}\s*$'
let g:vimwiki_rxPreStart = '{{{'
let g:vimwiki_rxPreEnd = '}}}'
" Header's folding
let g:vimwiki_rxFoldHeadingStart = '^=\+[^=]\+='
let g:vimwiki_rxFoldHeadingEnd = '\n\ze=\+[^=]\+='
let g:vimwiki_rxFoldH1Start = '^=[^=]\+.*=\s*$'
let g:vimwiki_rxFoldH1End = '^=[^=]\+=\s*$'
let g:vimwiki_rxFoldH2Start = '^==[^=]\+.*==\s*$'
let g:vimwiki_rxFoldH2End = '^==\{,1}[^=]\+.*==\{,1}\s*$'
let g:vimwiki_rxFoldH3Start = '^===[^=]\+.*===\s*$'
let g:vimwiki_rxFoldH3End = '^==\{,2}[^=]\+.*==\{,2}\s*$'
let g:vimwiki_rxFoldH4Start = '^====[^=]\+.*====\s*$'
let g:vimwiki_rxFoldH4End = '^==\{,3}[^=]\+.*==\{,4}\s*$'
let g:vimwiki_rxFoldH5Start = '^=====[^=]\+.*=====\s*$'
let g:vimwiki_rxFoldH5End = '^==\{,4}[^=]\+.*==\{,4}\s*$'
let g:vimwiki_rxFoldH6Start = '^======[^=]\+.*======\s*$'
let g:vimwiki_rxFoldH6End = '^==\{,5}[^=]\+.*==\{,5}\s*$'
" vim:tw=0:
syntax\vimwiki_media.vim [[[1
60
75
" Vim syntax file
" Language: Wiki (MediaWiki)
" Author: Maxim Kim (habamax at gmail dot com)
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-08 01:39
" Version: 0.6.2
" Last Change: 2009-02-19 10:42
" Version: 0.7.0
" text: '''strong'''
let g:vimwiki_rxBold = "'''[^']\\+'''"
@ -991,19 +1019,34 @@ let g:vimwiki_rxPreStart = '<pre>'
let g:vimwiki_rxPreEnd = '<\/pre>'
" Header's folding
let g:vimwiki_rxFoldHeadingStart = '^=\+[^=]\+='
let g:vimwiki_rxFoldHeadingEnd = '\n\ze=\+[^=]\+='
let g:vimwiki_rxFoldH1Start = '^=[^=]\+.*=\s*$'
let g:vimwiki_rxFoldH1End = '^=[^=]\+=\s*$'
let g:vimwiki_rxFoldH2Start = '^==[^=]\+.*==\s*$'
let g:vimwiki_rxFoldH2End = '^==\{,1}[^=]\+.*==\{,1}\s*$'
let g:vimwiki_rxFoldH3Start = '^===[^=]\+.*===\s*$'
let g:vimwiki_rxFoldH3End = '^==\{,2}[^=]\+.*==\{,2}\s*$'
let g:vimwiki_rxFoldH4Start = '^====[^=]\+.*====\s*$'
let g:vimwiki_rxFoldH4End = '^==\{,3}[^=]\+.*==\{,4}\s*$'
let g:vimwiki_rxFoldH5Start = '^=====[^=]\+.*=====\s*$'
let g:vimwiki_rxFoldH5End = '^==\{,4}[^=]\+.*==\{,4}\s*$'
let g:vimwiki_rxFoldH6Start = '^======[^=]\+.*======\s*$'
let g:vimwiki_rxFoldH6End = '^==\{,5}[^=]\+.*==\{,5}\s*$'
" vim:tw=0:
autoload\vimwiki.vim [[[1
343
305
" VimWiki plugin file
" Language: Wiki
" Author: Maxim Kim (habamax at gmail dot com)
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-10 14:40
" Version: 0.6.2
" Last Change: 2009-02-20 15:59
" Version: 0.6.3
if exists("g:loaded_vimwiki_auto") || &cp
finish
@ -1140,48 +1183,6 @@ function! vimwiki#WikiGoBackWord() "{{{
endif
endfunction "}}}
function! vimwiki#WikiNewLine(direction) "{{{
"" direction == checkup - use previous line for checking
"" direction == checkdown - use next line for checking
function! s:WikiAutoListItemInsert(listSym, dir)
let sym = escape(a:listSym, '*')
if a:dir=='checkup'
let linenum = line('.')-1
else
let linenum = line('.')+1
end
let prevline = getline(linenum)
if prevline =~ '^\s\+'.sym
let curline = substitute(getline('.'),'^\s\+',"","g")
if prevline =~ '^\s*'.sym.'\s*$'
" there should be easier way ...
execute 'normal kA '."\<ESC>".'"_dF'.a:listSym.'JX'
return 1
endif
let ind = indent(linenum)
call setline(line('.'), strpart(prevline, 0, ind).a:listSym.' '.curline)
call cursor(line('.'), ind+3)
return 1
endif
return 0
endfunction
if s:WikiAutoListItemInsert('*', a:direction)
return
endif
if s:WikiAutoListItemInsert('#', a:direction)
return
endif
" delete <space>
if getline('.') =~ '^\s\+$'
execute 'normal x'
else
execute 'normal X'
endif
endfunction "}}}
function! vimwiki#WikiHighlightWords() "{{{
let wikies = glob(g:vimwiki_home.'*')
"" remove .wiki extensions
@ -1209,6 +1210,10 @@ function! vimwiki#WikiGoHome()"{{{
catch /E37/ " catch 'No write since last change' error
" this is really unsecure!!!
execute ':'.g:vimwiki_gohome.' '.g:vimwiki_home.g:vimwiki_index.g:vimwiki_ext
catch /E325/ " catch 'ATTENTION' error
" TODO: Hmmm, if open already opened index.wiki there is an error...
" Find out what is the reason and how to avoid it. Is it dangerous?
echomsg "Unknown error!"
endtry
let g:vimwiki_history = []
endfunction"}}}
@ -1340,15 +1345,174 @@ function! vimwiki#WikiRenameWord() "{{{
echomsg wwtorename." is renamed to ".newWord
endfunction "}}}
autoload\vimwiki_gtd.vim [[[1
157
" Vim autoload plugin file
" GTD (Getting Things Done) related stuff here.
" Language: Wiki
" Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-18 18:00
" Version: 0.7.0
" used in various checks
let s:rx_list_item = '^\s\+\(\*\|#\)\s*\zs\[.\?\]'
let s:rx_li_box = '\[.\?\]'
let s:rx_li_unchecked = '\[\s\?\]'
" used in substitutes
let s:rx_li_check = '\[x\]'
let s:rx_li_uncheck = '\[ \]'
" Set state of the list item on line number "lnum" to [ ] or [x]
function! s:set_state(lnum, on_off)
let line = getline(a:lnum)
if a:on_off
let state = s:rx_li_check
else
let state = s:rx_li_uncheck
endif
let line = substitute(line, s:rx_li_box, state, '')
call setline(a:lnum, line)
endfunction
" Get state of the list item on line number "lnum"
function! s:get_state(lnum)
let state = 1
let line = getline(a:lnum)
let opt = matchstr(line, s:rx_list_item)
if opt =~ s:rx_li_unchecked
let state = 0
endif
return state
endfunction
" Returns: 1 if line is list item, 0 otherwise
function! s:is_list_item(lnum)
return getline(a:lnum) =~ s:rx_list_item
endfunction
" Returns: list of line numbers of parent and all its child items.
function! s:get_child_items(lnum)
let result = []
let lnum = a:lnum
let parent_indent = indent(lnum)
" add parent
call add(result, lnum)
let lnum += 1
while s:is_list_item(lnum) &&
\ indent(lnum) > parent_indent &&
\ lnum <= line('$')
call add(result, lnum)
let lnum += 1
endwhile
return result
endfunction
" Returns: list of line numbers of all items of the same level.
function! s:get_sibling_items(lnum)
let result = []
let lnum = a:lnum
let ind = indent(lnum)
while s:is_list_item(lnum) &&
\ indent(lnum) >= ind &&
\ lnum <= line('$')
if indent(lnum) == ind
call add(result, lnum)
endif
let lnum += 1
endwhile
let lnum = a:lnum - 1
while s:is_list_item(lnum) &&
\ indent(lnum) >= ind &&
\ lnum >= 0
if indent(lnum) == ind
call add(result, lnum)
endif
let lnum -= 1
endwhile
return result
endfunction
" Returns: line number of the parent of lnum item
function! s:get_parent_item(lnum)
let lnum = a:lnum
let ind = indent(lnum)
while s:is_list_item(lnum) &&
\ indent(lnum) >= ind &&
\ lnum >= 0
let lnum -= 1
endwhile
if s:is_list_item(lnum)
return lnum
else
return a:lnum
endif
endfunction
" Toggle list item between [ ] and [x]
" Returns: 1 if toggled to [x]
" 0 if toggled to [ ]
function! vimwiki_gtd#GTDToggleItem()
let current_lnum = line('.')
if !s:is_list_item(current_lnum)
return
endif
let current_state = s:get_state(current_lnum)
if current_state == 0
for lnum in s:get_child_items(current_lnum)
call s:set_state(lnum, 1)
let new_state = 1
endfor
else
for lnum in s:get_child_items(current_lnum)
call s:set_state(lnum, 0)
let new_state = 0
endfor
endif
let c_lnum = current_lnum
while s:is_list_item(c_lnum)
let all_items_checked = 1
for lnum in s:get_sibling_items(c_lnum)
if s:get_state(lnum) != 1
let all_items_checked = 0
break
endif
endfor
let parent_lnum = s:get_parent_item(c_lnum)
if parent_lnum == c_lnum
break
endif
call s:set_state(parent_lnum, all_items_checked)
let c_lnum = parent_lnum
endwhile
endfunction
autoload\vimwiki_html.vim [[[1
679
684
" VimWiki plugin file
" Language: Wiki
" Author: Maxim Kim (habamax at gmail dot com)
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-10 17:42
" Version: 0.6.2
" Last Change: 2009-02-20 23:42
" Version: 0.7.0
if exists("g:loaded_vimwiki_html_auto") || &cp
finish
@ -1390,7 +1554,7 @@ function! s:create_default_CSS(path) " {{{
call add(lines, 'img {border: none;}')
call add(lines, 'pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;}')
call add(lines, 'td {border: 1px solid #ccc; padding: 0.3em;}')
call add(lines, 'hr {border: none; border-top: 1px solid #ccc; width: 90%;}')
call add(lines, 'hr {border: none; border-top: 1px solid #ccc; width: 100%;}')
call add(lines, '.todo {font-weight: bold; text-decoration: underline; color: #FF0000;}')
call add(lines, '.strike {text-decoration: line-through;}')
@ -1399,6 +1563,12 @@ function! s:create_default_CSS(path) " {{{
endif
endfunction "}}}
function! s:remove_blank_lines(lines) " {{{
while a:lines[-1] =~ '^\s*$'
call remove(a:lines, -1)
endwhile
endfunction "}}}
function! s:is_web_link(lnk) "{{{
if a:lnk =~ '^\(http://\|www.\|ftp://\)'
return 1
@ -1972,14 +2142,14 @@ function! vimwiki_html#Wiki2HTML(path, wikifile) "{{{
" s:process_tag_pre find out `pre` is over. So we should delete
" them all. Think of the way to refactor it out.
if (oldpre != pre) && ldest[-1] =~ '^\s*$'
while ldest[-1] =~ '^\s*$'
call remove(ldest, -1)
endwhile
call s:remove_blank_lines(ldest)
endif
call extend(ldest, lines)
endfor
call s:remove_blank_lines(ldest)
"" process end of file
"" close opened tags if any
let lines = []
@ -1989,7 +2159,6 @@ function! vimwiki_html#Wiki2HTML(path, wikifile) "{{{
call s:close_tag_table(table, lines)
call extend(ldest, lines)
call extend(ldest, s:get_html_footer())
"" make html file.
@ -2025,11 +2194,11 @@ ftplugin\vimwiki.vim [[[1
96
" Vim filetype plugin file
" Language: Wiki
" Author: Maxim Kim (habamax at gmail dot com)
" Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-15 12:23
" Version: 0.6.2
" Last Change: 2009-02-18 10:27
" Version: 0.7.0
if exists("b:did_ftplugin")
finish
@ -2048,14 +2217,16 @@ setlocal textwidth=0
setlocal wrap
setlocal linebreak
setlocal autowriteall
" for gf
execute 'setlocal suffixesadd='.g:vimwiki_ext
setlocal isfname-=[,]
if g:vimwiki_smartCR>=2
setlocal comments=b:*,b:#
setlocal formatoptions=ctnqro
endif
" for list items, and list items with checkboxes
setlocal comments=b:*\ [\ ],b:*[\ ],b:*\ [],b:*[],b:*\ [x],b:*[x]
setlocal comments+=b:#\ [\ ],b:#[\ ],b:#\ [],b:#[],b:#\ [x],b:#[x]
setlocal comments+=b:*,b:#
setlocal formatoptions=ctnqro
" folding for Headers using syntax fold method.
setlocal fdm=syntax
@ -2075,6 +2246,7 @@ command! -buffer VimwikiGoBackWord call vimwiki#WikiGoBackWord()
command! -buffer VimwikiSplitWord call vimwiki#WikiFollowWord('split')
command! -buffer VimwikiVSplitWord call vimwiki#WikiFollowWord('vsplit')
command! -buffer VimwikiGTDToggleItem call vimwiki_gtd#GTDToggleItem()
"" commands 2}}}
"" keybindings {{{
@ -2113,21 +2285,18 @@ nmap <silent><buffer> <S-TAB> :VimwikiPrevWord<CR>
nmap <silent><buffer> <Leader>wd :VimwikiDeleteWord<CR>
nmap <silent><buffer> <Leader>wr :VimwikiRenameWord<CR>
if g:vimwiki_smartCR==1
inoremap <silent><buffer><CR> <CR><Space><C-O>:call vimwiki#WikiNewLine('checkup')<CR>
noremap <silent><buffer>o o<Space><C-O>:call vimwiki#WikiNewLine('checkup')<CR>
noremap <silent><buffer>O O<Space><C-O>:call vimwiki#WikiNewLine('checkdown')<CR>
endif
nmap <silent><buffer> <C-Space> :VimwikiGTDToggleItem<CR>
" keybindings }}}
plugin\vimwiki.vim [[[1
79
77
" VimWiki plugin file
" Language: Wiki
" Author: Maxim Kim (habamax at gmail dot com)
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-08 01:38
" Version: 0.6.2
" Last Change: 2009-02-18 10:02
" Version: 0.7.0
if exists("loaded_vimwiki") || &cp
finish
@ -2152,7 +2321,6 @@ call s:default('lower','a-zа-я')
call s:default('other','0-9_')
call s:default('maxhi','1')
call s:default('stripsym','_')
call s:default('smartCR',1)
call s:default('syntax','default')
call s:default('gohome','split')
call s:default('home_html',g:vimwiki_home."html/")
@ -2174,7 +2342,6 @@ let nlo = upp.oth
let any = upp.nup
let g:vimwiki_word1 = '\C\<['.upp.']['.nlo.']*['.low.']['.nup.']*['.upp.']['.any.']*\>'
" let g:vimwiki_word2 = '\[\[['.upp.low.oth.'[:punct:][:space:]]\{-}\]\]'
let g:vimwiki_word2 = '\[\[[^\]]\+\]\]'
let g:vimwiki_rxWikiWord = g:vimwiki_word1.'\|'.g:vimwiki_word2
@ -2200,3 +2367,58 @@ if !hasmapto('<Plug>VimwikiExploreHome')
endif
noremap <unique><script> <Plug>VimwikiExploreHome :VimwikiExploreHome<CR>
indent\vimwiki.vim [[[1
53
" Vimwiki indent file
" Language: Wiki
" Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/
" Filenames: *.wiki
" Last Change: 2009-02-17 20:07
" Version: 0.7.0
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" Some preliminary settings
setlocal nolisp " Make sure lisp indenting doesn't supersede us
setlocal autoindent " indentexpr isn't much help otherwise
setlocal indentexpr=GetVimwikiIndent(v:lnum)
setlocal indentkeys+=<:>
" Only define the function once.
if exists("*GetVimwikiIndent")
finish
endif
" Come here when loading the script the first time.
function GetVimwikiIndent(lnum)
" Search backwards for the previous non-empty line.
let plnum = prevnonblank(v:lnum - 1)
if plnum == 0
" This is the first non-empty line, use zero indent.
return 0
endif
" TODO: use g:vimwiki_rxList here
let lst_indent = len(matchstr(getline(a:lnum), '^\s\+\ze\(\*\|#\)'))
if lst_indent > 0
if lst_indent < &sw
return &sw
endif
let mul = round(lst_indent*1.0/&sw)
let ind = float2nr(mul * &sw)
return ind
endif
return -1
endfunction
" vim:sw=2