Open losingkeys opened 10 years ago
From same vim_use thread: need to add a zv to the end of normal-mode mappings if you want folds to open from a mapping.
I'm confused as to why this works: https://github.com/joshuarh/ag.vim/commit/a0e425828082b997d4f15cade00f34068eb5bb21. Aren't I still in the quickfix window when the mapping uses zv
? If so, shouldn't it try that command on the (not folded) line in the quickfix window, actually show the match, then continue to show the match (not opening folds like it was before?
In the quickfix window, by default, pressing <CR>
on an item will open the file for that item in a buffer and then jump to the line for that item within that buffer. So after the <CR>
, you'll no longer be in the quickfix window. Therefore mapping something to <CR>zv
should work to show the fold. If you want to end up in the quickfix window, you'd further need to add a <C-w>p
to your mapping.
Yeah, that's what I thought... but https://github.com/joshuarh/ag.vim/commit/a0e425828082b997d4f15cade00f34068eb5bb21 seems to work fine. So zv
works anywhere in a mapping for all movements that mapping might make?
I don't think that's how zv is supposed to work. I'm not sure why those changes in your commit would work, if they do. What's the extra space between zv and the rest for?
Hmm, I'll move them around then. They do work though, which is odd. I put the space there because I thought it needed to be there to separate the normal mode & command mode commands. It doesn't look like that's the case (and now that I think of it, that doesn't make a whole lot of sense). Thanks for your comments, I'll make a pull request when I've fixed that commit up.
That said, it's cleaner to just put it in front if it works. What do you think about just leaving it there?
Don't care, I don't use it. I'm was just trying to do a good turn when I saw the vim_use post in case you weren't following it. Do what you want :-)
Originally reported on the vim_use mailing list here: https://groups.google.com/d/msg/vim_use/L9E3EJqd610/9o1Uq2p_9bwJ .