ack.vim icon indicating copy to clipboard operation
ack.vim copied to clipboard

Respect splitright and splitbelow options

Open shanesmith opened this issue 11 years ago • 7 comments

Fixes a bother of mine.

It does make for a more complex mapping, any suggestions to clean this up are welcome.

shanesmith avatar Jul 29 '14 02:07 shanesmith

Bump!

shanesmith avatar Jun 06 '15 04:06 shanesmith

This works as intended, I merged and tested this in ag.nvim where it worked. :+1:

Numkil avatar Jun 06 '15 07:06 Numkil

Thanks, I agree with fixing the general problem. The way ack.vim's mappings are implemented and configured is brittle and clumsy, I've been thinking about overhauling it along the lines of f04a8a9af3854 from #150 that isn't merged yet, taking that a bit further to probably expose some functions through Plug mappings. This is a good reminder to take splitright and splitbelow into account when working on that too.

This is probably harmless to merge in the meantime. Give me a few days to find time to do some work on ack.vim and I'll likely merge it. Thanks for your patience.

ches avatar Jun 06 '15 08:06 ches

@shanesmith Hi! This kinda solved my problem here at #241

(I only copied the v: part coz it's what I need right now. But the problem is that every time I open a search result, it goes to the right (as expected) but the height of the pane for search results increases. Does it happen to you too?

yujinyuz avatar Mar 26 '18 07:03 yujinyuz

@yujinyuz there's already an issue opened for it here #150 =)

shanesmith avatar Mar 26 '18 13:03 shanesmith

@shanesmith thanks! I just thought it was just my config that got messed up.

yujinyuz avatar Mar 26 '18 15:03 yujinyuz

Seems like I was able to just apply this fix manually...

" help Ack mappings to respect my split settings
let g:ack_mappings = {
  \ "h": "<C-W><CR>:exe 'wincmd ' (&splitbelow ? 'J' : 'K')<CR><C-W>p<C-W>J<C-W>p",
  \ "v": "<C-W><CR>:exe 'wincmd ' (&splitright ? 'L' : 'H')<CR><C-W>p<C-W>J<C-W>p"}

Integralist avatar Mar 01 '21 11:03 Integralist