Comments (21)
Here is my script for Tagbar integration. Look in the comment for how to use it.
https://gist.github.com/EinfachToll/9071573
from vimwiki.
Seems like you are using Python 3. A newer version of the script is here: https://github.com/vimwiki/utils/blob/master/vwtags.py . It should work with Python 3 as well as with Python 2.
from vimwiki.
Here is an example of the Zim sidebars for navigating the wiki tree on the left and the current page outline on the right:
from vimwiki.
I've been using Vimwiki for a few weeks now, and the lack of the sidebar is definitely my biggest issue so far. I tried most of the stuff mentioned in this thread and did some thinking on what an optimal workflow would look like. My naive initial thoughts were around a better automated index but with hindsight, this is not really addressing the core issue.
First of all, if we look at @dotancohen screenshot of Zim
, and in particular the left side bar index, I think it pretty much sums up the ideal interface for me. That index is basically an always visible NERDTree with extracted page titles instead of displaying filenames. That way, whatever our notes content, we have an overall view of the structures and entries at all times, without manually maintaining an index that potentially reproduce that whole structure.
Note: with regard to the right-side bar of that same screenshot, I think this is basically what the tagbar + vmtags.py
hack does. While I don't need it personally (my wiki pages are usually small enough), I think this issue already has a form of solution.
Also, I'm a heavy user of fzf (generic fuzzy finder) and its Vim integration. Long story short: nnoremap <C-p> :FZF<CR>
to jump to anything from anywhere in a fraction of second. While this may sound trivial, that tool brutally destroyed all my workflows within vim
, and that of course includes my navigation within vimwiki
. Most modern complex graphical tools also have a similar kind of feature. I'm mentioning this here, because it affects my reasoning here. Basically, while I can jump to any file in an instant, I may not exactly know where I end up: that's why I believe one important feature of the NERDTree-like sidebar would be to focus on the current wikipage, unrolling the directories as necessary, with an highlight on the current file. I believe @brennen mentioned something along these lines recently on IRC.
Now that we addressed the navigation, there is one last point: how to create pages? Indeed, with that sidebar, we basically remove the need for the usual root index (which could now simply be your daily TODO, some random ASCII art or whatever). Which means when you create a page, you're likely not going to first write its title into that index anymore (before creating the page pressing enter). The easy answer could be :e tools/foobar.md
, but this lacks practicability: first of all, you'll have to explicit the potential subdirectories, as well as the filename which could have been derived from the title. This makes me believe the sidebar should prompt the creation of a new file by just pressing enter on your target directory in the side-bar, asking for your page title and derive the rest (path, filename, and a new page with the title inserted).
This pretty much sums up my thinking on the issue. I'll be happy to discuss this further.
Now onto the limitations this would introduce, I think the main one would be that using the side bar will make you dependent on your filesystem or file-naming for link ordering (which was more flexible while maintaining it in your index yourself). I think that's secondary compared to all the benefits this brings, especially since the sidebar could be optional, and nothing would prevent you from still using the index like we currently do.
from vimwiki.
I love this idea, especially if they can be opened / closed at will. I use this same setup in Zim, which is the wiki system that I'm migrating to vimwiki from. The wiki page tree is in a (collapsible) sidebar on the left, and the outline of the current page is in a (collapsible) sidebar on the right.
Note though that vimwiki does not currently support a page hierarchy, only individual pages.
from vimwiki.
Note that the taglist plugin also uses a similar sidepanel that can be hidden.
from vimwiki.
@dotancohen , yeah, that screenshot is pretty much exactly what I was thinking.
When you say "vimwiki does not currently support a page hierarchy", isn't a set of inter-linked files (ie wiki) always a hierarchy, of sorts?
from vimwiki.
No, vimwiki pages are all top-level from what I understand. No intrinsic nesting, which is actually what is preventing me from moving to vimwiki fully.
My current workaround is to have the index page as an indented bulleted list of links to the pages organized as seen in the screenshot.
from vimwiki.
A side panel with the outline of the current document is easy, you can use Tagbar and a script that extracts the headers from a file. I made a Python script which I can share the next days.
A panel for the outline of all wiki files is more complicated. Vimpanel looks interesting, but as far as I can see it supports only file system hierarchies. Maybe you can also misuse Tagbar to show files instead of tags.
@dotancohen: You can put your wiki files in arbitrary subdirectories, if you want to have a hierarchy. Just make a link like [[subdir/file]]
. Maybe this helps you a little bit. Personally, I think a real hierarchy of files is not a wiki is made for.
from vimwiki.
I'm also attempting to move from zim, and this is one feature that I really miss. I attempted to use your script, but I'm not sure if I'm doing it right. I installed tagbar, created your script at ~/.vim/vwtags.py
, then added the following to ~/.vimrc
:
let g:tagbar_type_vimwiki = {
\ 'ctagstype':'vimwiki'
\ , 'kinds':['h:header']
\ , 'sro':'&&&'
\ , 'kind2scope':{'h':'header'}
\ , 'sort':0
\ , 'ctagsbin':'~/.vim/vwtags.py'
\ , 'ctagsargs': 'default'
\ }
Then, after opening my wiki, and using :TagbarToggle
, I get the following error.
Messages maintainer: Mike Williams <[email protected]>
"/HDD/protist/Computer/vimwiki/general/index.wiki" 3L, 27C
Error detected while processing function tagbar#ToggleWindow..<SNR>39_ToggleWindow..<SNR>39_OpenWindow..
<SNR>39_AutoUpdate..<SNR>39_ProcessFile..<SNR>39_ExecuteCtagsOnFile:
line 64:
Tagbar: Could not execute ctags for /tmp/vyTpAtX/8.wiki!
Executed command: "'/home/protist/.vim/vwtags.py' default '/tmp/vyTpAtX/8.wiki'"
Command output:
File "/home/protist/.vim/vwtags.py", line 53
print '{0}\t{1}\t/{2}/;"\t{3}\tline:{4}{5}'.format(cur_tag, filename,
^
SyntaxError: invalid syntax
I wasn't sure that I installed correctly, so I also tried changing to 'ctagsargs': 'markdown'
, but it still failed.
from vimwiki.
Yes, I am using Python 3, and yes that works great! Thank you!
Also, I created a simple script to create a navigation tree. It has a dependency on tree
, to show a pretty output. It will write to a file, so it's not quite as "interactive" as a panel, but it works well enough for me.
https://gist.github.com/protist/820bb6a25722083a2edd
from vimwiki.
@protist: if you want, you can add it to https://github.com/vimwiki/utils . Maybe there are some more people who find your script useful. Just create a pull request at https://github.com/vimwiki/utils
from vimwiki.
@EinfachToll Done. This is the first time I've made a pull request, so I'm not sure if I should have created a new branch. Please let me know if I've done something wrong. Cheers.
from vimwiki.
Everything's good. The utils repository is just a collection of scripts, so there's no need to branch something off.
from vimwiki.
There hasn't been any interest in this for a few years so I'm going to close.
from vimwiki.
Oh, I was actually following this thread since recently and didn't notice the date. Well, I'll leave my comment to see if anyone else has any interest
from vimwiki.
Well, I'd still be keen for this too. I haven't re-commented, because I imagined bumping it regularly wouldn't be great etiquette. FWIW I use tagbar to navigate the headers of the current file, so an additional navigator would still be useful. Not high on the list of priorities for me personally, but still useful.
from vimwiki.
@adrianrocamora @protist , It looks like the PR referenced in this issue was merged. Is there something else that you're interested in that hasn't been resolved?
from vimwiki.
@hq6 As per my comments above, this PR just creates a static page as an index. It also has to be run manually. If I understand correctly, this issue is about having an automated, interactive, navigation panel within vim itself, similar to tagbar.
from vimwiki.
@protist , In that case, I will reopen this issue.
PR's are welcome; otherwise it will likely take us a while to implement something like this.
from vimwiki.
@hq6 Thank you. As per above, for me personally, it's not super-high priority, but it would be a welcome addition.
from vimwiki.
Related Issues (20)
- VimWiki and Goyo HOT 1
- Failure in Exapanding snippets/Ultisnips in inline math mode of vimwiki
- Improve docs for opening links in existing split: How to give [reuse] Argument to VimwikiSplitLink? HOT 2
- Is it possible to make enter on GitHub links go to repo in filesystem? HOT 1
- (neovim) Vimwiki always creates .wiki files instead of .md HOT 2
- How can I disable VimWiki's table mode? HOT 1
- vimwiki_tags not generated for markdown syntax files
- Macro slows down with each iteration HOT 4
- VimWiki "Wiki" section in Github allows everyone to create pages HOT 2
- Addition of new line is not reflected in conversion from .wiki to .html HOT 1
- Help setting different dirs from diary and zk
- Link works for VIM 9.0 but report error for VIM 9.1
- Links that line wrap are badly formatted HOT 3
- VimwikiSearchTags does not work with empty `pre_mark`
- Missing </blockquote> tag in html
- after update from 2.5 to 2024.01.24, vimwiki doesn't work HOT 3
- Data lost when the wiki name is truncated.
- Avoid listing deprecated functions in command autocomplete
- backport ZettelBacklinks as VimwikiGenerateBacklinks HOT 1
- [[file:]] with space is not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vimwiki.