tpope / vim-cucumber

Vim Cucumber runtime files

Home Page:http://www.vim.org/scripts/script.php?script_id=2973

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Horizontal vs Vertical Split

dgdosen opened this issue · comments

When i open up a step definition for a feature step, the definition always opens in a horizontal split (not wanted) vs a vertical split (wanted)

Do you know what could be causing that?

Thanks!

I'm seeing this too. Is the split configurable for this plugin separately from settings in vimrc?

I do have set splitbelow and set splitright defined in my vimrc. Perhaps that has something to do with it?

Thanks Tim!

The <C-W>d mapping mimics the behavior of the built in Vim map, no more no less. To the best of my knowledge that's not configurable.

Gotcha, thanks for the info. Sorry if this follow up question doesn't make sense then, but is there a way to have <C-W>d (or another mapping) focus the step definition for a line in a feature file in an existing split instead of opening a new one each time? It's a bit unwieldy to have 3-4 of the same split opened to different line numbers in the same file to see the step def of several different lines in a feature file.

My current workaround is to close the splits aggressively, but it's some friction I'd love to avoid if possible. Especially when trying to grok a suite and/or during refactoring (like moving things to page objects, for example) where I'm trying to find where many different feature file lines are defined.

The 'switchbuf' option might help with that.

Hmmm switchbuf didn't help. At least not with <C-W>d, but I think that's because the plugin is explicitly asking vim to split (I could be wrong). [d is closer to what I'm looking for, except for the cursor doesn't jump into the split, and the split is not as large as I'd like. But it does keep just the one split open and updates where the cursor ends up when you jump to that split. So it's quite close.

Is there a way I can combine them to get the best of both worlds? AKA, can I make [d jump to the split and increase the size? Or add a new custom mapping that does so?

Thanks!

@tpope ok, so this does what I want... but I don't think it's a good implementation. Could you lend a hand?

nnoremap <localleader>p :<C-U>exe <SNR>167_jump('pedit',v:count)<CR><C-W>P:resize 30<CR>zz

So... wow, ok, this does the thing from here: https://github.com/tpope/vim-cucumber/blob/master/ftplugin%2Fcucumber.vim#L29

But I had to do :map to see how vim created the function and reference it so my ~/.vimrc would work (so I didn't have to edit the plugin to add this directly). I'm guessing that function name is going to change on me each time I load vim, but I don't know enough about it to say for sure. Maybe it would only change if a new plugin or mapping or function gets added? Anyway...

So after it opens the preview buffer it jumps to it with <C-W>P, then resizes the preview buffer to 30 lines high, then centers the cursor. I'm sure (positive) there is a better way.