commit c0b56d572b43d485e265f78d93c58855cc1a9965
parent 4e4fb8a1b4c7171d8b272644deeadd0f4173235c
Author: Maxim Kim <habamax@gmail.com>
Date: Wed, 7 May 2008 00:00:00 +0000
Version 0.2.2
Added keybindings to split/vertsplit when following WikiWords.
<S-CR> - split WikiWord
<C-CR> - vertical split WikiWord
Diffstat:
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim
@@ -4,8 +4,8 @@
" Home: http://code.google.com/p/vimwiki/
" Author: Maxim Kim
" Filenames: *.wiki
-" Last Change: (05.05.2008 19:30)
-" Version: 0.2
+" Last Change: (07.05.2008 19:25)
+" Version: 0.2.2
if exists("b:did_ftplugin")
finish
@@ -132,7 +132,14 @@ function! s:WikiLinkToNonWikiFile(word)
endfunction
if !exists('*s:WikiFollowWord')
- function! s:WikiFollowWord()
+ function! s: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(s:wiki_word), g:vimwiki_stripsym)
" insert doesn't work properly inside :if. Check :help :if.
if word == ""
@@ -140,12 +147,12 @@ if !exists('*s:WikiFollowWord')
return
endif
if s:WikiLinkToNonWikiFile(word)
- execute ":e ".word
+ execute cmd.word
else
" history is [['WikiWord.wiki', 11], ['AnotherWikiWord', 3] ... etc]
" where numbers are column positions we should return when coming back.
call insert(g:vimwiki_history, [expand('%:p'), col('.')])
- execute ":e ".g:vimwiki_home.word.g:vimwiki_ext
+ execute cmd.g:vimwiki_home.word.g:vimwiki_ext
endif
endfunction
@@ -208,7 +215,9 @@ vmap <buffer> j gj
imap <buffer> <Down> <C-o>gj
imap <buffer> <Up> <C-o>gk
-nmap <buffer> <CR> :call <SID>WikiFollowWord()<CR>
+nmap <buffer> <CR> :call <SID>WikiFollowWord('nosplit')<CR>
+nmap <buffer> <S-CR> :call <SID>WikiFollowWord('split')<CR>
+nmap <buffer> <C-CR> :call <SID>WikiFollowWord('vsplit')<CR>
nmap <buffer> <BS> :call <SID>WikiGoBackWord()<CR>
nmap <buffer> <TAB> :call <SID>WikiNextWord()<CR>
diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim
@@ -4,8 +4,8 @@
" Home: http://code.google.com/p/vimwiki/
" Author: Maxim Kim
" Filenames: *.wiki
-" Last Change: (05.05.2008 19:30)
-" Version: 0.2
+" Last Change: (07.05.2008 19:25)
+" Version: 0.2.2
" Based on FlexWiki
" Quit if syntax file is already loaded
@@ -50,9 +50,6 @@ syntax match wikiEmoticons /\((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/
" Aggregate all the regular text highlighting into wikiText
syntax cluster wikiText contains=wikiItalic,wikiBold,wikiCode,wikiDelText,wikiSuperScript,wikiSubScript,wikiLink,wikiWord,wikiEmoticons
-" Treat all other lines that start with spaces as PRE-formatted text.
-syntax match wikiPre /^[ \t]\+.*$/ contains=@wikiText
-
" Header levels, 1-6
syntax match wikiH1 /\(^!\{1}.*$\|^\s*=\{1}.*=\{1}\s*$\)/
syntax match wikiH2 /\(^!\{2}.*$\|^\s*=\{2}.*=\{2}\s*$\)/
@@ -72,7 +69,8 @@ syntax match wikiTable /||/
" highlight only bullets and digits.
syntax match wikiList /^\s\+\(\*\|[1-9]\+0*\.\|#\)/
-
+" Treat all other lines that start with spaces as PRE-formatted text.
+syntax match wikiPre /^\s\+[^[:blank:]*#].*$/
" Link FlexWiki syntax items to colors