Browse files

Version 2.1.6

The Outliner / MindStructure / Logicizer / UniverseMapper / CoffeeMaker just got better:
Fixed the GotoRef function (mapped to "gr" and "<CR>")
  • Loading branch information...
1 parent ab1569e commit 571608a13fbebd2fdebdee03e506c29ba1c588a6 @isene isene committed with Oct 15, 2012
Showing with 21 additions and 8 deletions.
  1. +21 −8 syntax/hyperlist.vim
View
29 syntax/hyperlist.vim
@@ -12,11 +12,9 @@
" Further, I am under no obligation to maintain or extend
" this software. It is provided on an 'as is' basis without
" any expressed or implied warranty.
-" Version: 2.1.4 - compatible with the HyperList definition v. 2.1
-" Modified: 2012-09-25
-" Changes: Added "zx" as a command to update folding (to update syntax)
-" Added <CR> as an alternative to gr (Goto Ref)
-" Added a mark (m') to gr/<CR> to facilitate easy jump back
+" Version: 2.1.6 - compatible with the HyperList definition v. 2.1
+" Modified: 2012-10-15
+" Changes: Fixed GotoRef function
" INSTRUCTIONS {{{1
"
@@ -142,10 +140,11 @@ function! CheckItem (stamp)
endfunction
" Goto reference {{{2
-" Mapped to 'gr'
+" Mapped to 'gr' and <CR>
if !exists("*GotoRef")
function! GotoRef()
let current_line = getline('.')
+ let ref_multi = 0
if match(current_line,'#') >= 0
if match(current_line,'file:') >=0
if match(current_line,"#.* ") >= 0
@@ -161,7 +160,12 @@ if !exists("*GotoRef")
let ref_word = matchstr(current_line,"#\'.*\'")
let ref_word = substitute(ref_word, "\'", '', 'g')
let ref_word = substitute(ref_word, '#', '', 'g')
- let ref_dest = substitute(ref_word, '/', '.*\\n\\s*.\\{-}', 'g')
+ let ref_end = ref_word
+ if match(ref_word,"\/") >= 0
+ let ref_end = substitute(ref_end, '^.*/', '\t', 'g')
+ let ref_multi = 1
+ endif
+ let ref_dest = substitute(ref_word, '/', '\\_.\\{-}\\t', 'g')
let ref_dest = "\\\(#\\\'\\\)\\\@<!" . ref_dest
else
if match(current_line,"#.* ") >= 0
@@ -170,14 +174,23 @@ if !exists("*GotoRef")
let ref_word = matchstr(current_line,"#.*$")
endif
let ref_word = substitute(ref_word, '#', '', 'g')
- let ref_dest = substitute(ref_word, '/', '.*\\n\\s*.\\{-}', 'g')
+ let ref_end = ref_word
+ if match(ref_word,"\/") >= 0
+ let ref_end = substitute(ref_end, '^.*/', '\t', 'g')
+ let ref_multi = 1
+ endif
+ let ref_dest = substitute(ref_word, '/', '\\_.\\{-}\\t', 'g')
let ref_dest = "#\\\@<!" . ref_dest
endif
let @/ = ref_dest
call search(ref_dest)
let new_line = getline('.')
if new_line == current_line
echo "No destination"
+ else
+ if ref_multi == 1
+ call search(ref_end)
+ end
endif
else
echo "No reference in the HyperList item"

0 comments on commit 571608a

Please sign in to comment.