Permalink
Browse files

Improve related jump

  • Loading branch information...
1 parent e46da88 commit 5a7a5b4fb6170e7c09862eee2e09645b917e0b66 violetyk committed Dec 12, 2013
Showing with 17 additions and 6 deletions.
  1. +17 −6 autoload/cake.vim
View
@@ -2278,10 +2278,16 @@ function! cake#factory(path_app)
let from = buffer.type
let i = index(g:cakephp_related_group, from)
- if i != -1
- let i = i + direction
+ if i == -1
+ return
+ endif
+
+ let i_max = len(g:cakephp_related_group) - 1
+
+ let k = 0
+ while k < i_max
- let i_max = len(g:cakephp_related_group) - 1
+ let i = i + direction
if i < 0
let i = i_max
elseif i > i_max
@@ -2297,9 +2303,14 @@ function! cake#factory(path_app)
let target = buffer.name
endif
- let Fn = get(self, printf('jump_%s', to))
- return call(Fn, ['n', target], self)
- endif
+ let Fn = get(self, printf('name_to_path_%s', to))
+ if filereadable(call(Fn, [target], self))
+ let Fn = get(self, printf('jump_%s', to))
+ return call(Fn, ['n', target], self)
+ endif
+
+ let k += 1
+ endwhile
endfunction "}}}
function! self.gf(option) "{{{

0 comments on commit 5a7a5b4

Please sign in to comment.