vimwiki icon indicating copy to clipboard operation
vimwiki copied to clipboard

Feature: Open folds when navigating

Open lervag opened this issue 10 years ago • 3 comments

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.

lervag avatar May 28 '15 09:05 lervag

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.

  1. I like the hook style, feel free to make a PR.
  2. If too lazy for the hook (20 lines). Just add some z<Enter> map with a comment TODO get this as a hook to <Enter>

tinmarino avatar May 12 '20 15:05 tinmarino

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.

lervag avatar May 12 '20 16:05 lervag

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>

davidsierradz avatar Jul 07 '20 22:07 davidsierradz