Code Monkey home page Code Monkey logo

Comments (21)

EinfachToll avatar EinfachToll commented on May 10, 2024 4

Here is my script for Tagbar integration. Look in the comment for how to use it.
https://gist.github.com/EinfachToll/9071573

from vimwiki.

EinfachToll avatar EinfachToll commented on May 10, 2024 2

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.

dotancohen avatar dotancohen commented on May 10, 2024 1

Here is an example of the Zim sidebars for navigating the wiki tree on the left and the current page outline on the right:
zim-sidebars

from vimwiki.

ubitux avatar ubitux commented on May 10, 2024 1

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.

dotancohen avatar dotancohen commented on May 10, 2024

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.

dotancohen avatar dotancohen commented on May 10, 2024

Note that the taglist plugin also uses a similar sidepanel that can be hidden.

from vimwiki.

linuxcaffe avatar linuxcaffe commented on May 10, 2024

@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.

dotancohen avatar dotancohen commented on May 10, 2024

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.

EinfachToll avatar EinfachToll commented on May 10, 2024

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.

protist avatar protist commented on May 10, 2024

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.

protist avatar protist commented on May 10, 2024

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.

EinfachToll avatar EinfachToll commented on May 10, 2024

@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.

protist avatar protist commented on May 10, 2024

@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.

EinfachToll avatar EinfachToll commented on May 10, 2024

Everything's good. The utils repository is just a collection of scripts, so there's no need to branch something off.

from vimwiki.

ranebrown avatar ranebrown commented on May 10, 2024

There hasn't been any interest in this for a few years so I'm going to close.

from vimwiki.

adrianrocamora avatar adrianrocamora commented on May 10, 2024

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.

protist avatar protist commented on May 10, 2024

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.

hq6 avatar hq6 commented on May 10, 2024

@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.

protist avatar protist commented on May 10, 2024

@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.

hq6 avatar hq6 commented on May 10, 2024

@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.

protist avatar protist commented on May 10, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.