vimwiki
vimwiki copied to clipboard
Feature: Open folds when navigating
I'm an avid user of folds, and I think the vimwiki folding is working well. However, navigating in the wiki by use of <cr> (and similar) with folding enabled often leads to closed folds. I therefore often do something like zv to open the folds after I've navigated with <cr>.
I propose to either add a call to zv in the <cr> mapping, or to add a hook or in some way allow the user to add actions to be performed after a wiki link has been opened. The latter seems the best solution to me, as it gives more control, but the former is also OK. I think it makes sense that navigation in the wiki always opens the folds at the link targets.
I think it makes sense that navigation in the wiki always opens the folds at the link targets
It depends ... sometime, you only want to get a glimpse.
- I like the hook style, feel free to make a PR.
- If too lazy for the hook (20 lines). Just add some
z<Enter>map with a commentTODO get this as a hook to <Enter>
Thanks @tinmarino; I'm happy to see the activity on vimwiki. It's an important and very useful project!
However, as you can see, the issue is 5 years old. In the meantime, I've made my own wiki plugin, and so I'm personally no longer interested in this issue. Thus, I won't suggest any PR's. I don't mind if the issue is closed, but of course, if you think the original suggestion is good then feel free to keep the issue open.
I solved it like:
function! FollowLink()
VimwikiFollowLink
normal zv
endfunction
nmap <F7> <Plug>VimwikiFollowLink
nnoremap <silent> <CR> :call FollowLink()<CR>
You need to map <Plug>VimwikiFollowLink to something else, so we can replace <CR>