')
- return [1, lines]
- endif
- return [0, lines]
-endfunction "}}}
-
-function! s:process_tag_h(line) "{{{
- let line = a:line
- let processed = 0
- if a:line =~ g:vimwiki_rxH6
- let line = '
'.strpart(a:line, 6).'
'
- let processed = 1
- elseif a:line =~ g:vimwiki_rxH5
- let line = '
'.strpart(a:line, 5).'
'
- let processed = 1
- elseif a:line =~ g:vimwiki_rxH4
- let line = '
'.strpart(a:line, 4).'
'
- let processed = 1
- elseif a:line =~ g:vimwiki_rxH3
- let line = '
'.strpart(a:line, 3).'
'
- let processed = 1
- elseif a:line =~ g:vimwiki_rxH2
- let line = '
'.strpart(a:line, 2).'
'
- let processed = 1
- elseif a:line =~ g:vimwiki_rxH1
- let line = '
'.strpart(a:line, 1).'
'
- let processed = 1
- endif
- return [processed, line]
-endfunction "}}}
-
-function! s:process_tag_hr(line) "{{{
- let line = a:line
- let processed = 0
- if a:line =~ '^-----*$'
- let line = ''
- let processed = 1
- endif
- return [processed, line]
-endfunction "}}}
-
-function! s:process_tag_table(line, table) "{{{
- let table = a:table
- let lines = []
- let processed = 0
- if a:line =~ '^||.\+||.*'
- if !table
- call add(lines, "
")
- let table = 1
- endif
- let processed = 1
-
- call add(lines, "
")
- let pos1 = 0
- let pos2 = 0
- let done = 0
- while !done
- let pos1 = stridx(a:line, '||', pos2)
- let pos2 = stridx(a:line, '||', pos1+2)
- if pos1==-1 || pos2==-1
- let done = 1
- let pos2 = len(a:line)
- endif
- let line = strpart(a:line, pos1+2, pos2-pos1-2)
- if line != ''
- call add(lines, "
".line."
")
- endif
- endwhile
- call add(lines, "
")
-
- elseif table
- call add(lines, "
")
- let table = 0
- endif
- return [processed, lines, table]
-endfunction "}}}
-
-"" change dangerous html symbols - < > & (line)
-function! s:safe_html(line) "{{{
- let line = substitute(a:line, '&', '\&', 'g')
- let line = substitute(line, '<', '\<', 'g')
- let line = substitute(line, '>', '\>', 'g')
- return line
-endfunction "}}}
-
-"" Substitute text found by regexp_match with tagOpen.regexp_subst.tagClose
-function! s:make_tag_helper(line, regexp_match, tagOpen, tagClose, cSymRemove, func) " {{{
- let pos = 0
- let lines = split(a:line, a:regexp_match, 1)
- let res_line = ""
- for line in lines
- let res_line = res_line.line
- let matched = matchstr(a:line, a:regexp_match, pos)
- if matched != ""
- let toReplace = strpart(matched, a:cSymRemove, len(matched)-2*a:cSymRemove)
- if a:func!=""
- let toReplace = {a:func}(escape(toReplace, '\&*[]?%'))
- else
- " let toReplace = a:tagOpen.escape(toReplace, '\&*[]?%').a:tagClose
- let toReplace = a:tagOpen.toReplace.a:tagClose
- endif
- let res_line = res_line.toReplace
- endif
- let pos = matchend(a:line, a:regexp_match, pos)
- endfor
- return res_line
-
-endfunction " }}}
-
-"" Make tags only if not in ` ... `
-"" ... should be function that process regexp_match deeper.
-function! s:make_tag(line, regexp_match, tagOpen, tagClose, ...) " {{{
- "check if additional function exists
- let func = ""
- let cSym = 1
- if a:0 == 2
- let cSym = a:1
- let func = a:2
- elseif a:0 == 1
- let cSym = a:1
- endif
-
- let patt_splitter = g:vimwiki_rxCode
- " let patt_splitter = '\('.g:vimwiki_rxCode.'\)\|\(\)\|\(\)'
- " TODO: make one regexp from g:vimwiki_rxPreStart.'.\+'.g:vimwiki_rxPreEnd
- let patt_splitter = '\('.g:vimwiki_rxCode.'\)\|\('.g:vimwiki_rxPreStart.'.\+'.g:vimwiki_rxPreEnd.'\)\|\(\)\|\(\)'
- if g:vimwiki_rxCode == a:regexp_match || g:vimwiki_rxPreStart.'.\+'.g:vimwiki_rxPreEnd == a:regexp_match
- let res_line = s:make_tag_helper(a:line, a:regexp_match, a:tagOpen, a:tagClose, cSym, func)
- else
- let pos = 0
- let lines = split(a:line, patt_splitter, 1)
- let res_line = ""
- for line in lines
- let res_line = res_line.s:make_tag_helper(line, a:regexp_match, a:tagOpen, a:tagClose, cSym, func)
- let res_line = res_line.matchstr(a:line, patt_splitter, pos)
- let pos = matchend(a:line, patt_splitter, pos)
- endfor
- endif
- return res_line
-endfunction " }}}
-
-"" Make link desc
-"" from [link link desc]
-function! s:make_external_link(entag) "{{{
- let line = ''
- if s:is_web_link(a:entag)
- let lnkElements = split(a:entag)
- let head = lnkElements[0]
- let rest = join(lnkElements[1:])
- if rest==""
- let rest=head
- endif
- if s:is_img_link(rest)
- if rest!=head
- let line = ''
- else
- let line = ''
- endif
- else
- let line = ''.rest.''
- endif
- elseif s:is_img_link(a:entag)
- let line = ''
- else
- " [alskfj sfsf] shouldn't be a link. So return it as it was --
- " enclosed in [...]
- let line = '['.a:entag.']'
- endif
- return line
-endfunction "}}}
-
-"" Make This is a link
-"" from [[This is a link]]
-function! s:make_internal_link(entag) "{{{
- let line = ''
- if s:is_img_link(a:entag)
- let line = ''
- else
- let line = ''.a:entag.''
- endif
- return line
-endfunction "}}}
-
-"" Make WikiWord
-"" from WikiWord
-function! s:make_wikiword_link(entag) "{{{
- let line = ''.a:entag.''
- return line
-endfunction "}}}
-
-"" Make http://habamax.ru
-"" from http://habamax.ru
-function! s:make_barebone_link(entag) "{{{
- if s:is_img_link(a:entag)
- let line = ''
- else
- let line = ''.a:entag.''
- endif
- return line
-endfunction "}}}
-
-function! vimwiki_html#Wiki2HTML(path, wikifile) "{{{
- if !s:syntax_supported()
- call s:msg('Wiki2Html: Only vimwiki_default syntax supported!!!')
- return
- endif
-
- if !isdirectory(a:path)
- call s:msg('Please create '.a:path.' directory first!')
- return
- endif
-
- let lsource=readfile(a:wikifile)
- let ldest = s:get_html_header(s:get_file_name_only(a:wikifile), &encoding)
-
- let pre = 0
- let code = 0
- let table = 0
- let lists = []
-
- for line in lsource
- let processed = 0
- let lines = []
-
- let line = s:safe_html(line)
-
- "" Code
- if !processed
- let [processed, lines, code] = s:process_tag_code(line, code)
- if processed && len(lists)
- call s:close_tag_list(lists, ldest)
- endif
- if processed && table
- let table = s:close_tag_table(table, ldest)
- endif
- if processed && pre
- let pre = s:close_tag_pre(pre, ldest)
- endif
- call extend(ldest, lines)
- endif
-
- "" Pre
- if !processed
- let oldpre = pre
- let [processed, lines, pre] = s:process_tag_pre(line, pre)
- if processed && len(lists)
- call s:close_tag_list(lists, ldest)
- endif
- if processed && table
- let table = s:close_tag_table(table, ldest)
- endif
- if processed && code
- let code = s:close_tag_code(code, ldest)
- endif
-
- " A dirty hack: There could be a lot of empty strings before
- " s:process_tag_pre find out `pre` is over. So we should delete
- " them all.
- if (oldpre != pre) && ldest[-1] =~ '^\s*$'
- while ldest[-1] =~ '^\s*$'
- call remove(ldest, -1)
- endwhile
- endif
-
- call extend(ldest, lines)
- endif
-
- "" list
- if !processed
- let [processed, lines] = s:process_tag_list(line, lists)
- if processed && pre
- let pre = s:close_tag_pre(pre, ldest)
- endif
- if processed && code
- let code = s:close_tag_code(code, ldest)
- endif
- if processed && table
- let table = s:close_tag_table(table, ldest)
- endif
- call map(lines, 's:make_tag(v:val, ''\[\[.\{-}\]\]'', '''', '''', 2, ''s:make_internal_link'')')
- call map(lines, 's:make_tag(v:val, ''\[.\{-}\]'', '''', '''', 1, ''s:make_external_link'')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxWeblink, '''', '''', 0, ''s:make_barebone_link'')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxWikiWord, '''', '''', 0, ''s:make_wikiword_link'')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxItalic, '''', '''')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxBold, '''', '''')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxTodo, '''', '''', 0)')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxDelText, '''', '''', 2)')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxSuperScript, '''', '''', 1)')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxSubScript, '''', '''', 2)')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxCode, '''', '''')')
- " TODO: change make_tag function: delete cSym parameter -- count of symbols
- " to strip from 2 sides of tag. Add 2 new instead -- OpenWikiTag length
- " and CloseWikiTag length as for preformatted text there could be {{{,}}} and
,
.
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxPreStart.''.\+''.g:vimwiki_rxPreEnd, '''', '''', 3)')
- call extend(ldest, lines)
- endif
-
- "" table
- if !processed
- let [processed, lines, table] = s:process_tag_table(line, table)
- call map(lines, 's:make_tag(v:val, ''\[\[.\{-}\]\]'', '''', '''', 2, ''s:make_internal_link'')')
- call map(lines, 's:make_tag(v:val, ''\[.\{-}\]'', '''', '''', 1, ''s:make_external_link'')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxWeblink, '''', '''', 0, ''s:make_barebone_link'')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxWikiWord, '''', '''', 0, ''s:make_wikiword_link'')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxItalic, '''', '''')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxBold, '''', '''')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxTodo, '''', '''', 0)')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxDelText, '''', '''', 2)')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxSuperScript, '''', '''', 1)')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxSubScript, '''', '''', 2)')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxCode, '''', '''')')
- call map(lines, 's:make_tag(v:val, g:vimwiki_rxPreStart.''.\+''.g:vimwiki_rxPreEnd, '''', '''', 3)')
- call extend(ldest, lines)
- endif
-
- if !processed
- let [processed, line] = s:process_tag_h(line)
- if processed
- call s:close_tag_list(lists, ldest)
- let table = s:close_tag_table(table, ldest)
- let code = s:close_tag_code(code, ldest)
- call add(ldest, line)
- endif
- endif
-
- if !processed
- let [processed, line] = s:process_tag_hr(line)
- if processed
- call s:close_tag_list(lists, ldest)
- let table = s:close_tag_table(table, ldest)
- let code = s:close_tag_code(code, ldest)
- call add(ldest, line)
- endif
- endif
-
- "" P
- if !processed
- let line = s:make_tag(line, '\[\[.\{-}\]\]', '', '', 2, 's:make_internal_link')
- let line = s:make_tag(line, '\[.\{-}\]', '', '', 1, 's:make_external_link')
- let line = s:make_tag(line, g:vimwiki_rxWeblink, '', '', 0, 's:make_barebone_link')
- let line = s:make_tag(line, g:vimwiki_rxWikiWord, '', '', 0, 's:make_wikiword_link')
- let line = s:make_tag(line, g:vimwiki_rxItalic, '', '')
- let line = s:make_tag(line, g:vimwiki_rxBold, '', '')
- let line = s:make_tag(line, g:vimwiki_rxTodo, '', '', 0)
- let line = s:make_tag(line, g:vimwiki_rxDelText, '', '', 2)
- let line = s:make_tag(line, g:vimwiki_rxSuperScript, '', '', 1)
- let line = s:make_tag(line, g:vimwiki_rxSubScript, '', '', 2)
- let line = s:make_tag(line, g:vimwiki_rxCode, '', '')
- let line = s:make_tag(line, g:vimwiki_rxPreStart.'.\+'.g:vimwiki_rxPreEnd, '', '', 3)
- let [processed, lines] = s:process_tag_p(line)
- if processed && pre
- let pre = s:close_tag_pre(pre, ldest)
- endif
- if processed && code
- let code = s:close_tag_code(code, ldest)
- endif
- if processed && table
- let table = s:close_tag_table(table, ldest)
- endif
- call extend(ldest, lines)
- endif
-
- "" add the rest
- if !processed
- call add(ldest, line)
- endif
- endfor
-
- "" process end of file
- "" close opened tags if any
- call s:close_tag_pre(pre, ldest)
- call s:close_tag_code(code, ldest)
- call s:close_tag_list(lists, ldest)
- call s:close_tag_table(table, ldest)
-
-
- call extend(ldest, s:get_html_footer())
-
- "" make html file.
- "" TODO: add html headings, css, etc.
- let wwFileNameOnly = s:get_file_name_only(a:wikifile)
- call writefile(ldest, a:path.wwFileNameOnly.'.html')
-endfunction "}}}
-
-function! vimwiki_html#WikiAll2HTML(path) "{{{
- if !s:syntax_supported()
- call s:msg('Wiki2Html: Only vimwiki_default syntax supported!!!')
- return
- endif
-
- if !isdirectory(a:path)
- call s:msg('Please create '.a:path.' directory first!')
- return
- endif
-
- let setting_more = &more
- setlocal nomore
-
- let wikifiles = split(glob(g:vimwiki_home.'*'.g:vimwiki_ext), '\n')
- for wikifile in wikifiles
- echomsg 'Processing '.wikifile
- call vimwiki_html#Wiki2HTML(a:path, wikifile)
- endfor
- call s:create_default_CSS(g:vimwiki_home_html)
- echomsg 'Done!'
-
- let &more = setting_more
-endfunction "}}}
-autoload\vimwiki.vim [[[1
-343
-" 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:37
-" Version: 0.6.1
-
-if exists("g:loaded_vimwiki_auto") || &cp
- finish
-endif
-let g:loaded_vimwiki_auto = 1
-
-let s:wiki_badsymbols = '[<>|?*/\:"]'
-
-function! s:msg(message) "{{{
- echohl WarningMsg
- echomsg 'vimwiki: '.a:message
- echohl None
-endfunction "}}}
-
-function! s:get_file_name_only(filename) "{{{
- let word = substitute(a:filename, '\'.g:vimwiki_ext, "", "g")
- let word = substitute(word, '.*[/\\]', "", "g")
- return word
-endfunction "}}}
-
-function! s:editfile(command, filename) "{{{
- let fname = escape(a:filename, '% ')
- execute a:command.' '.fname
-
- " if fname is new
- " if g:vimwiki_addheading!=0 && glob(fname) == ''
- " execute 'normal I! '.s:getfilename(fname)
- " update
- " endif
-endfunction "}}}
-
-function! s:SearchWord(wikiRx,cmd) "{{{
- let hl = &hls
- let lasts = @/
- let @/ = a:wikiRx
- set nohls
- try
- :silent exe 'normal ' a:cmd
- catch /Pattern not found/
- call s:msg('WikiWord not found')
- endt
- let @/ = lasts
- let &hls = hl
-endfunction "}}}
-
-function! s:WikiGetWordAtCursor(wikiRX) "{{{
- let col = col('.') - 1
- let line = getline('.')
- let ebeg = -1
- let cont = match(line, a:wikiRX, 0)
- while (ebeg >= 0 || (0 <= cont) && (cont <= col))
- let contn = matchend(line, a:wikiRX, cont)
- if (cont <= col) && (col < contn)
- let ebeg = match(line, a:wikiRX, cont)
- let elen = contn - ebeg
- break
- else
- let cont = match(line, a:wikiRX, contn)
- endif
- endwh
- if ebeg >= 0
- return strpart(line, ebeg, elen)
- else
- return ""
- endif
-endf "}}}
-
-function! s:WikiStripWord(word, sym) "{{{
- function! s:WikiStripWordHelper(word, sym)
- return substitute(a:word, s:wiki_badsymbols, a:sym, 'g')
- endfunction
-
- let result = a:word
- if strpart(a:word, 0, 2) == "[["
- let result = s:WikiStripWordHelper(strpart(a:word, 2, strlen(a:word)-4), a:sym)
- endif
- return result
-endfunction "}}}
-
-function! s:WikiIsLinkToNonWikiFile(word) "{{{
- " Check if word is link to a non-wiki file.
- " The easiest way is to check if it has extension like .txt or .html
- if a:word =~ '\.\w\{1,4}$'
- return 1
- endif
- return 0
-endfunction "}}}
-
-" WikiWord history helper functions {{{
-" history is [['WikiWord.wiki', 11], ['AnotherWikiWord', 3] ... etc]
-" where numbers are column positions we should return to when coming back.
-function! s:GetHistoryWord(historyItem)
- return get(a:historyItem, 0)
-endfunction
-function! s:GetHistoryColumn(historyItem)
- return get(a:historyItem, 1)
-endfunction
-"}}}
-
-function! vimwiki#WikiNextWord() "{{{
- call s:SearchWord(g:vimwiki_rxWikiWord, 'n')
-endfunction "}}}
-
-function! vimwiki#WikiPrevWord() "{{{
- call s:SearchWord(g:vimwiki_rxWikiWord, 'N')
-endfunction "}}}
-
-function! vimwiki#WikiFollowWord(split) "{{{
- if a:split == "split"
- let cmd = ":split "
- elseif a:split == "vsplit"
- let cmd = ":vsplit "
- else
- let cmd = ":e "
- endif
- let word = s:WikiStripWord(s:WikiGetWordAtCursor(g:vimwiki_rxWikiWord), g:vimwiki_stripsym)
- " insert doesn't work properly inside :if. Check :help :if.
- if word == ""
- execute "normal! \n"
- return
- endif
- if s:WikiIsLinkToNonWikiFile(word)
- call s:editfile(cmd, word)
- else
- call insert(g:vimwiki_history, [expand('%:p'), col('.')])
- call s:editfile(cmd, g:vimwiki_home.word.g:vimwiki_ext)
- endif
-endfunction "}}}
-
-function! vimwiki#WikiGoBackWord() "{{{
- if !empty(g:vimwiki_history)
- let word = remove(g:vimwiki_history, 0)
- " go back to saved WikiWord
- execute ":e ".s:GetHistoryWord(word)
- call cursor(line('.'), s:GetHistoryColumn(word))
- 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 '."\".'"_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
- if getline('.') =~ '^\s\+$'
- execute 'normal x'
- else
- execute 'normal X'
- endif
-endfunction "}}}
-
-function! vimwiki#WikiHighlightWords() "{{{
- let wikies = glob(g:vimwiki_home.'*')
- "" remove .wiki extensions
- let wikies = substitute(wikies, '\'.g:vimwiki_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:WikiIsLinkToNonWikiFile(word)
- execute 'syntax match wikiWord /\<'.word.'\>/'
- else
- execute 'syntax match wikiWord /\[\['.substitute(word, g:vimwiki_stripsym, s:wiki_badsymbols, "g").'\]\]/'
- endif
- endfor
-endfunction "}}}
-
-function! vimwiki#WikiGoHome()"{{{
- try
- execute ':e '.g:vimwiki_home.g:vimwiki_index.g:vimwiki_ext
- 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
- endtry
- let g:vimwiki_history = []
-endfunction"}}}
-
-function! vimwiki#WikiDeleteWord() "{{{
- "" file system funcs
- "" Delete WikiWord you are in from filesystem
- let val = input('Delete ['.expand('%').'] (y/n)? ', "")
- if val!='y'
- return
- endif
- let fname = expand('%:p')
- " call WikiGoBackWord()
- try
- call delete(fname)
- catch /.*/
- call s:msg('Cannot delete "'.expand('%:r').'"!')
- return
- endtry
- execute "bdelete! ".escape(fname, " ")
-
- " delete from g:vimwiki_history list
- call filter (g:vimwiki_history, 's:GetHistoryWord(v:val) != fname')
- " as we got back to previous WikiWord - delete it from history - as much
- " as possible
- let hword = ""
- while !empty(g:vimwiki_history) && hword == s:GetHistoryWord(g:vimwiki_history[0])
- let hword = s:GetHistoryWord(remove(g:vimwiki_history, 0))
- endwhile
-
- " reread buffer => deleted WikiWord should appear as non-existent
- execute "e"
-endfunction "}}}
-
-function! vimwiki#WikiRenameWord() "{{{
- "" Rename WikiWord, update all links to renamed WikiWord
- let wwtorename = expand('%:r')
- let isOldWordComplex = 0
- if wwtorename !~ g:vimwiki_word1
- let wwtorename = substitute(wwtorename, g:vimwiki_stripsym, s:wiki_badsymbols, "g")
- let isOldWordComplex = 1
- endif
-
- " there is no file (new one maybe)
- " if glob(g:vimwiki_home.expand('%')) == ''
- if glob(expand('%:p')) == ''
- call s:msg('Cannot rename "'.expand('%:p').'". It does not exist! (New file? Save it before renaming.)')
- return
- endif
-
- let val = input('Rename "'.expand('%:r').'" (y/n)? ', "")
- if val!='y'
- return
- endif
- let newWord = input('Enter new name: ', "")
- " check newWord - it should be 'good', not empty
- if substitute(newWord, '\s', '', 'g') == ''
- call s:msg('Cannot rename to an empty filename!')
- return
- endif
- if s:WikiIsLinkToNonWikiFile(newWord)
- call s:msg('Cannot rename to a filename with extension (ie .txt .html)!')
- return
- endif
-
- if newWord !~ g:vimwiki_word1
- " if newWord is 'complex wiki word' then add [[]]
- let newWord = '[['.newWord.']]'
- endif
- let newFileName = s:WikiStripWord(newWord, g:vimwiki_stripsym).g:vimwiki_ext
-
- " do not rename if word with such name exists
- let fname = glob(g:vimwiki_home.newFileName)
- if fname != ''
- call s:msg('Cannot rename to "'.newFileName.'". File with that name exist!')
- return
- endif
- " rename WikiWord file
- try
- echomsg "Renaming ".expand('%')." to ".g:vimwiki_home.newFileName
- let res = rename(expand('%'), g:vimwiki_home.newFileName)
- if res == 0
- bd
- else
- throw "Cannot rename!"
- end
- catch /.*/
- call s:msg('Cannot rename "'.expand('%:r').'" to "'.newFileName.'"')
- return
- endtry
-
- " save open buffers
- let openbuffers = []
- let bcount = 1
- while bcount<=bufnr("$")
- if bufexists(bcount)
- call add(openbuffers, bufname(bcount))
- endif
- let bcount = bcount + 1
- endwhile
-
- " update links
- echomsg "Updating links to ".newWord."..."
- execute ':silent args '.escape(g:vimwiki_home, " ").'*'.g:vimwiki_ext
- if isOldWordComplex
- execute ':silent argdo %sm/\[\['.wwtorename.'\]\]/'.newWord.'/geI | update'
- else
- execute ':silent argdo %sm/\<'.wwtorename.'\>/'.newWord.'/geI | update'
- endif
- execute ':silent argd *'.g:vimwiki_ext
-
- " restore open buffers
- let bcount = 1
- while bcount<=bufnr("$")
- if bufexists(bcount)
- if index(openbuffers, bufname(bcount)) == -1
- execute 'silent bdelete '.escape(bufname(bcount), " ")
- end
- endif
- let bcount = bcount + 1
- endwhile
-
- call s:editfile('e', g:vimwiki_home.newFileName)
-
- "" DONE: after renaming GUI caption is a bit corrupted?
- "" FIXED: buffers menu is also not in the "normal" state, howto Refresh menu?
- "" TODO: Localized version of Gvim gives error -- Refresh menu doesn't exist
- execute "silent! emenu Buffers.Refresh\ menu"
-
- echomsg wwtorename." is renamed to ".newWord
-endfunction "}}}
doc\vimwiki.txt [[[1
-651
+670
*vimwiki.txt* A Personal Wiki for Vim
__ __ ______ __ __ ______ __ __ ______ ~
@@ -1008,7 +16,7 @@ doc\vimwiki.txt [[[1
Let the help begins ...~
- Version: 0.6.1 ~
+ Version: 0.6.2 ~
==============================================================================
CONTENTS *vimwiki-contents*
@@ -1237,6 +245,8 @@ Internal links:
CapitalizedWordsConnected
or:
[[This is a link]]
+or:
+ [[link source|Description of the link]]
External links effects are visible after export to HTML.
Plain link:
@@ -1252,6 +262,12 @@ Plain image link:
Image thumbnail link:
[http://someaddr.com/bigpicture.jpg http://someaddr.com/thumbnail.jpg]
+Link to local image:
+ [[images/pabloymoira.jpg|Pablo y Moira]]
+
+Path to image (ie. images/pabloymoira.jpg) is relative to
+|g:vimwiki_home_html|.
+
------------------------------------------------------------------------------
5.3. Headers *vimwiki-headers*
! Header level 1
@@ -1528,12 +544,23 @@ Vim plugins website: http://www.Vim.org/scripts/script.php?script_id=2226
==============================================================================
9. Changelog *vimwiki-changelog*
+0.6.2
+ * [new] [[link|description]] is available now.
+ * [fix] Barebone links (ie: http://bla-bla-bla.org/h.pl?id=98) get extra
+ escaping of ? and friends so they become invalid in HTML.
+ * [fix] In linux going to [[wiki with whitespaces]] and then pressing BS
+ to go back to prev wikipage produce error. (Thanks Brendon Bensel for
+ the fix)
+ * [fix] Remove setlocal encoding and fileformat from vimwiki ftplugin.
+ * [fix] Some tweaks on default style.css
+
0.6.1
* [fix] [blablabla bla] shouldn't be converted to a link.
* [fix] Remove extra annoing empty strings from PRE tag made from
whitespaces in HTML export.
* [fix] Moved functions related to HTML converting to new autoload module
to increase a bit vimwiki startup time.
+
0.6
* [new] Header and footer templates. See|g:vimwiki_html_header| and
|g:vimwiki_html_footer|.
@@ -1646,196 +673,15 @@ it's free enough to suit your needs.
vim:tw=78:ts=8:ft=help:fdm=marker:
-ftplugin\vimwiki.vim [[[1
-98
-" Vim filetype 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 12:41
-" Version: 0.6.1
-
-if exists("b:did_ftplugin")
- finish
-endif
-
-let b:did_ftplugin = 1 " Don't load another plugin for this buffer
-
-
-"" Defaults
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-" Reset the following options to undo this plugin.
-let b:undo_ftplugin = "setl tw< wrap< lbr< fenc< ff< sua< isf< awa< com< fo< fdt< fdm< fde< commentstring<"
-
-setlocal textwidth=0
-setlocal wrap
-setlocal linebreak
-setlocal fileencoding=utf-8
-setlocal fileformat=unix
-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
-
-" folding for Headers using syntax fold method.
-setlocal fdm=syntax
-
-setlocal commentstring=
-
-"" commands {{{2
-command! -buffer Vimwiki2HTML call vimwiki_html#Wiki2HTML(expand(g:vimwiki_home_html), expand('%'))
-command! -buffer VimwikiAll2HTML call vimwiki_html#WikiAll2HTML(expand(g:vimwiki_home_html))
-
-command! -buffer VimwikiNextWord call vimwiki#WikiNextWord()
-command! -buffer VimwikiPrevWord call vimwiki#WikiPrevWord()
-command! -buffer VimwikiDeleteWord call vimwiki#WikiDeleteWord()
-command! -buffer VimwikiRenameWord call vimwiki#WikiRenameWord()
-command! -buffer VimwikiFollowWord call vimwiki#WikiFollowWord('nosplit')
-command! -buffer VimwikiGoBackWord call vimwiki#WikiGoBackWord()
-command! -buffer VimwikiSplitWord call vimwiki#WikiFollowWord('split')
-command! -buffer VimwikiVSplitWord call vimwiki#WikiFollowWord('vsplit')
-
-"" commands 2}}}
-
-"" keybindings {{{
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-nmap gk
-nmap k gk
-vmap gk
-vmap k gk
-
-nmap gj
-nmap j gj
-vmap gj
-vmap j gj
-
-imap gj
-imap gk
-
-nmap :VimwikiFollowWord
-nmap :VimwikiSplitWord
-nmap :VimwikiVSplitWord
-
-nmap
-nmap
-noremap <2-LeftMouse> :VimwikiFollowWord
-noremap :VimwikiSplitWord
-noremap :VimwikiVSplitWord
-
-nmap :VimwikiGoBackWord
-" mapping doesn't work in vim console
-nmap :VimwikiGoBackWord
-nmap :VimwikiGoBackWord
-
-nmap :VimwikiNextWord
-nmap :VimwikiPrevWord
-
-nmap wd :VimwikiDeleteWord
-nmap wr :VimwikiRenameWord
-
-if g:vimwiki_smartCR==1
- inoremap :call vimwiki#WikiNewLine('checkup')
- noremap o o:call vimwiki#WikiNewLine('checkup')
- noremap O O:call vimwiki#WikiNewLine('checkdown')
-endif
-" keybindings }}}
-plugin\vimwiki.vim [[[1
-79
-" 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.1
-
-if exists("loaded_vimwiki") || &cp
- finish
-endif
-let loaded_vimwiki = 1
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-function! s:default(varname,value)
- if !exists('g:vimwiki_'.a:varname)
- let g:vimwiki_{a:varname} = a:value
- endif
-endfunction
-
-"" Could be redefined by users
-call s:default('home',"")
-call s:default('index',"index")
-call s:default('ext','.wiki')
-call s:default('upper','A-ZА-Я')
-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/")
-call s:default('html_header',"")
-call s:default('html_footer',"")
-
-call s:default('history',[])
-
-let g:vimwiki_home = expand(g:vimwiki_home)
-let g:vimwiki_home_html = expand(g:vimwiki_home_html)
-let g:vimwiki_html_header = expand(g:vimwiki_html_header)
-let g:vimwiki_html_footer = expand(g:vimwiki_html_footer)
-
-let upp = g:vimwiki_upper
-let low = g:vimwiki_lower
-let oth = g:vimwiki_other
-let nup = low.oth
-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
-
-execute 'autocmd! BufNewFile,BufReadPost,BufEnter *'.g:vimwiki_ext.' set ft=vimwiki'
-
-
-command! VimwikiGoHome call vimwiki#WikiGoHome()
-command! VimwikiTabGoHome tabedit call vimwiki#WikiGoHome()
-command! VimwikiExploreHome execute "Explore ".g:vimwiki_home
-
-if !hasmapto('VimwikiGoHome')
- map ww VimwikiGoHome
-endif
-noremap