Permalink
Browse files

Version 0.2.2

Added keybindings to split/vertsplit when following WikiWords.
<S-CR> - split WikiWord
<C-CR> - vertical split WikiWord
  • Loading branch information...
habamax authored and vim-scripts committed May 7, 2008
1 parent 4e4fb8a commit c0b56d572b43d485e265f78d93c58855cc1a9965
Showing with 19 additions and 12 deletions.
  1. +15 −6 ftplugin/vimwiki.vim
  2. +4 −6 syntax/vimwiki.vim
View
@@ -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,20 +132,27 @@ 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 == ""
execute "normal! \n"
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>
View
@@ -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

0 comments on commit c0b56d5

Please sign in to comment.