From c0b56d572b43d485e265f78d93c58855cc1a9965 Mon Sep 17 00:00:00 2001 From: Maxim Kim Date: Wed, 7 May 2008 00:00:00 +0000 Subject: [PATCH] Version 0.2.2 Added keybindings to split/vertsplit when following WikiWords. - split WikiWord - vertical split WikiWord --- ftplugin/vimwiki.vim | 21 +++++++++++++++------ syntax/vimwiki.vim | 10 ++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 8f2b517..63aa183 100644 --- 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 j gj imap gj imap gk -nmap :call WikiFollowWord() +nmap :call WikiFollowWord('nosplit') +nmap :call WikiFollowWord('split') +nmap :call WikiFollowWord('vsplit') nmap :call WikiGoBackWord() nmap :call WikiNextWord() diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index 7544e14..9be0ec4 100644 --- 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