Permalink
Browse files

vim: split method for locate can now be configured

  • Loading branch information...
1 parent 728b1c4 commit ec430d304504c418f0ed4dcf86a32780fe5d02c4 @trefis trefis committed Jan 28, 2014
Showing with 16 additions and 1 deletion.
  1. +12 −1 vim/merlin/autoload/merlin.py
  2. +4 −0 vim/merlin/autoload/merlin.vim
@@ -214,8 +214,19 @@ def command_locate(path, line, col):
else:
l = pos_or_err['pos']['line']
c = pos_or_err['pos']['col']
+ split_method = vim.eval('g:merlin_split_method')
if "file" in pos_or_err:
- vim.command(":split %s" % pos_or_err['file'])
+ if split_method == "never":
+ vim.command(":e %s" % pos_or_err['file'])
+ elif "vertical" in split_method:
+ vim.command(":vsplit %s" % pos_or_err['file'])
+ else:
+ vim.command(":split %s" % pos_or_err['file'])
+ elif "always" in split_method:
+ if "vertical" in split_method:
+ vim.command(":vsplit")
+ else:
+ vim.command(":split")
vim.current.window.cursor = (l, c)
except MerlinExc as e:
try_print_error(e)
@@ -5,6 +5,10 @@ if !has('python')
finish
endif
+if !exists('g:merlin_split_method')
+ let g:merlin_split_method = 'horizontal'
+endif
+
if !exists("g:merlin_ignore_warnings")
" strings are ugly, but at least I'm sure it's not converted in some weird
" value when passing it to python

0 comments on commit ec430d3

Please sign in to comment.