lervag / wiki.vim

A wiki plugin for Vim
MIT License
640 stars 67 forks source link

Linking existing files #240

Closed EricEWeir closed 2 years ago

EricEWeir commented 2 years ago

Adoption of wiki.vim has gotten me interested in zettelkasten. (I knew nothing about it before.) There are lots of software takes on it, even within vim. I’m still getting familiar with wiki.vim, but I'd like to see what’s possible, zettelkasten-wise, with it.

I’ve gone back and forth on numbering schemes. Initially timestamps struck me as simplest and likely sufficient. I’ve become convinced, for the moment at least, that manually created alphanumeric names, perhaps coupled with a bit of meaningful text, may be necessary for the development of the insight and meaning that is supposed to be one of the benefits, if not the benefit, of zettelkasten.

It’s relatively clear how you link from an open note to a new note. What I’m having a hard time getting my head around is how you link an open note to an existing note.

Wouldn’t be surprised if there were a variety of possibilities. I would appreciate suggestions.

Thanks.

bybor commented 2 years ago

I use timestamp at the beginning of every file name. Doing so I can search by date and by title using WikiFzfPages.

I have a separate function that returns wiki link instead of opening a file name. It uses Fzf too.

I heavily miss fuzzy autocompletion of links, though it may be not very useful in the end - need to try before i decide. It's like typing [[, popup appears, you type part of the name, enter, ready. It could insert new name of you can't find anything that fits. It's all doable but very time consuming. Built-in completion from wiki.vim is starts with.

Also, check this https://www.frrobert.com/blog/linkingzettelkasten-2020-05-11-0735

And it has links to another post by Edwin - it may have something in this regard as well.

bybor commented 2 years ago

Did you try Obsidian? It may be a good fit for you. I think it has optional Vim movements, but not sure.

I don't use it for personal reasons. Years ago I picked asciidoc as my markup, I picked Vim as an editor, i don't want to use tools that may go away, even though I am a Windows user.

But obsidian looks very nice and tempting.

EricEWeir commented 2 years ago

Thanks for both your responses. And the link you provided. And the links it it.

I’m agnostic about numbering conventions. At the moment I’m leaning strongly toward the suggestion that there is important learning of the kind promised by zettelkesten that results from manually constructing the number so that it indicates the note’s place in the network of notes.

I have no experience with searching and am baffled by the plethora of digital tools for it. There is a paragraph in the note you linked to that mentions I think four or five different tools.

That said, it seems they provide a solution to the question that’s been preoccupying me: how to link a current note to an existing note. I take it they also are agnostic about which number convention to use.

I want to stick with vim. Even though I’m note a coder. I take it you use wiki.vim. I’m still struggling with the configuration of my installation. And with synchronizing directories across my devices.

I take it wiki.vim by itself doesn’t provide a solution to the problem of linking to an existing note.

EricEWeir commented 2 years ago

Did you try Obsidian? It may be a good fit for you. I think it has optional Vim movements, but not sure.

I’ve installed it on my mobile devices. But it doesn’t tempt me. As I say, I want to stick with Vim.

I don't use it for personal reasons. Years ago I picked asciidoc as my markup, I picked Vim as an editor, i don't want to use tools that may go away…

That’s one of my reasons for wanting to stick with vim. Another is that it’s command-oriented. In my initial experience writing with a computer I used Wordstar. I got to where I could fly across the keys. Never been happy with graphically-oriented writing tools.

…even though I am a Windows user.

I’m an Apple person. I would be very tempted by The Archive (zettelkasten.de) but for the fact that there’s no mobile version.

lervag commented 2 years ago

Adoption of wiki.vim has gotten me interested in zettelkasten. (I knew nothing about it before.) There are lots of software takes on it, even within vim. I’m still getting familiar with wiki.vim, but I'd like to see what’s possible, zettelkasten-wise, with it.

I have to admit I don't know much of Zettelkasten. I've heard about it and read a few blog posts, but it never felt useful to me. It might be because I never quite understood it.

I’ve gone back and forth on numbering schemes. Initially timestamps struck me as simplest and likely sufficient. I’ve become convinced, for the moment at least, that manually created alphanumeric names, perhaps coupled with a bit of meaningful text, may be necessary for the development of the insight and meaning that is supposed to be one of the benefits, if not the benefit, of zettelkasten.

Why do you want this? I have 1000's of wiki files on any topic I've dabbled with, and I don't have any issues finding my notes and linking between them.

It’s relatively clear how you link from an open note to a new note. What I’m having a hard time getting my head around is how you link an open note to an existing note.

I do this in two ways. E.g., I I were to write a note about scipy.optimize, which is a useful module of the famous SciPy, then I would probably write a note named something like "SciPy Optimize". In the note, I would write, either

  1. "This is part of the well known Python toolkit SciPy", then I would hit <cr> on top of "Python" and "SciPy" to create the links to these existing pages.
  2. Alternatively, I would write "This is part of the well known [[P" then hit <c-x><c-o> to complete the link target with omnicompletion. In fact, since I use an autocomplete plugin, I don't actually activate the omnicompletion manually, but it is essentially the same (I currently use nvim-cmp for autocompletion).
lervag commented 2 years ago

I use timestamp at the beginning of every file name. Doing so I can search by date and by title using WikiFzfPages.

So, you would have multiple notes for a given topic with different dates? I guess this is my lack of understanding the "Zettelkasten way", but to me, it seems chaotic, and it seems easy to miss the context from previous work on a topic?

I heavily miss fuzzy autocompletion of links

Fuzzy autocompletion can be achieved with a variaty of autocomplete plugins. I personally don't really like fuzzy, but if you want it, you could try something like "denite", "coc.nvim", "coq-nvim", or "nvim-cmp", or similar. Many of these are neovim only, but there are plenty others that also works well in Vim.

Built-in completion from wiki.vim is starts with.

No, that's only partly right. wiki.vim provides an omnicomplete function which will use the text as a regular expression. If you write [[2022-05.*python<c-x><c-o>, it would match any files that match the specified regular expression. There's an option to specify if you want case sensitive matching, see :help g:wiki_completion_case_sensitive.

I have no experience with searching and am baffled by the plethora of digital tools for it. There is a paragraph in the note you linked to that mentions I think four or five different tools.

Yes, there are a lot of tools for searching. I recommend that you take a note of two of them: ripgrep and fd. ripgrep is a faster grep implementation with a few fancy options. fd is a faster find. It is really very fast, and thus useful to find and list files within big projects.

I take it wiki.vim by itself doesn’t provide a solution to the problem of linking to an existing note.

It does, see above. But feel free to let me know if you think the existing solutions are inadequate somehow!

EricEWeir commented 2 years ago

I have to admit I don't know much of Zettelkasten. I've heard about it and read a few blog posts, but it never felt useful to me. It might be because I never quite understood it.

I’ve read a lot. I have negligible experience. Feeble efforts. Barely started. But enough to get me to change my initial approach.

It’s not simply a note taking/management system. It’s a way of developing your thinking on a topic. For its founder it was a way of writing. That’s perhaps the best way of thinking about it.

That and the fact that it allows structure to develop from the ground up, as your thinking evolves, instead of imposing it from the outside.

I’ve become convinced, for the moment at least, that manually created alphanumeric names, perhaps coupled with a bit of meaningful text, may be necessary for the development of the insight and meaning that is supposed to be one of the benefits, if not the benefit, of zettelkasten.

Why do you want this? I have 1000's of wiki files on any topic I've dabbled with, and I don't have any issues finding my notes and linking between them.

I don’t think I can put it any better than I did in the paragraph to which you’re responding. Finding notes is of course important. And of course digital tools are helpful. But the fundamental problem is not finding notes but establishing connections between them, not simply for purposes of retrieving them, but in a way that represents, extends, focuses your thinking.

There is something of a debate between analog and digital approaches to zettelkasten. The former argue that manually constructing the number assigned to a note so that it by itself represents the note’s place in the evolving network of notes is critical to the development of thinking that is the promised benefit of zettelkasten.

In zettelkasten the number assigned to a note, whether timestamp or alphanumeric, never changes. At the moment I can’t explain why that is. For now I simply accept ti. Perhaps it’s because it’s through the number that notes are connected.

For the moment I am persuaded by the argument for manually creating the number. Digital tools don’t lose their relevance when it’s approached that way. Perhaps in time I’ll become persuaded by a different way.

It’s relatively clear how you link from an open note to a new note. What I’m having a hard time getting my head around is how you link an open note to an existing note.

I do this in two ways. E.g., I I were to write a note about scipy.optimize, which is a useful module of the famous SciPy, then I would probably write a note named something like "SciPy Optimize". In the note, I would write, either

  1. "This is part of the well known Python toolkit SciPy", then I would hit <cr> on top of "Python" and "SciPy" to create the links to these existing pages.

I think I would would want to represent the link by the number that’s been assigned to those pages, i.e., to put those numbers in the current note.

Understand that I’m responding primarily on the basis of my at present largely theoretical and possibly imperfect understanding of zettelkasten. Because it’s theoretical my understanding is weaker than it would be if it was practical. (And that might be a comment about what’s distinctive and important about zettelkasten.)

  1. Alternatively, I would write "This is part of the well known [[P" then hit <c-x><c-o> to complete the link target with omnicompletion. In fact, since I use an autocomplete plugin, I don't actually activate the omnicompletion manually, but it is essentially the same (I currently use nvim-cmp for autocompletion).

Again, I would want to represent the link by the number of the notes to which I’m linking. Or perhaps by combination of the number and some text.

EricEWeir commented 2 years ago

I use timestamp at the beginning of every file name. Doing so I can search by date and by title using WikiFzfPages.

So, you would have multiple notes for a given topic with different dates? I guess this is my lack of understanding the "Zettelkasten way", but to me, it seems chaotic, and it seems easy to miss the context from previous work on a topic?

Don’t mean to respond for bybor, but to test my own understanding. Same topic, different thought. The text part of the name captures the context. My problem, as of my current thinking, is that the timestamp is abstract, arbitrary, meaningless.

Manually constructing the number it would seem necessary to give a distinct number to each note. Is that practical?

I have no experience with searching and am baffled by the plethora of digital tools for it. There is a paragraph in the note you linked to that mentions I think four or five different tools.

Yes, there are a lot of tools for searching. I recommend that you take a note of two of them: ripgrep and fd. ripgrep is a faster grep implementation with a few fancy options. fd is a faster find. It is really very fast, and thus useful to find and list files within big projects.

First question, are these whole text searches or filename searches? Second, because of Apple’s sandboxing of apps on its mobile devices, iVim is restricted to use of plugins that involve no external resources, that have no external commands. Could I use ripgrep and fd?

I take it wiki.vim by itself doesn’t provide a solution to the problem of linking to an existing note.

It does, see above. But feel free to let me know if you think the existing solutions are inadequate somehow!

I think I understand the sense in which it does. The challenge I'm imagining is representing the link by the number assigned to the note linked to, whether it’s an existing note or a new one.

I’ve never used splits. When linking to a new note, which would involve creating a (unique?) number that represents the note’s place in the network of notes, I imagine it would be helpful to have access to, in a split, the list of files in the folder.

bybor commented 2 years ago

@EricEWeir , I found something that hints that file system interaction is possible. It's in comments under the first answer : https://apple.stackexchange.com/questions/428690/how-can-i-install-a-termux-like-terminal-app-for-ios

Everything below would go under a pretty big IF, since it's a pure theory.

Android has a thing called Termux, which gives you an experience of Linux terminal/shell. In it you get all the tools like fd, ripgrep, (neo)vim, git, all accessing a folder tree that can be synced to Android and then to anywhere else.

Apple is different, but if it's possible to get iSH (libTerm ?) environment, then you will no longer be limited to iVim and you also will get the search tools. I don't really know how it works, it may be , again, very different from Termux.

lervag commented 2 years ago

I’ve become convinced, for the moment at least, that manually created alphanumeric names, perhaps coupled with a bit of meaningful text, may be necessary for the development of the insight and meaning that is supposed to be one of the benefits, if not the benefit, of zettelkasten.

Why do you want this? I have 1000's of wiki files on any topic I've dabbled with, and I don't have any issues finding my notes and linking between them.

I don’t think I can put it any better than I did in the paragraph to which you’re responding. Finding notes is of course important. And of course digital tools are helpful. But the fundamental problem is not finding notes but establishing connections between them, not simply for purposes of retrieving them, but in a way that represents, extends, focuses your thinking.

Ok, thanks for the info and explanations. Perhaps there's something useful about Zettelkasten that helps facilitate this, but for me, my usage of wiki.vim also does this.

So, you would have multiple notes for a given topic with different dates? I guess this is my lack of understanding the "Zettelkasten way", but to me, it seems chaotic, and it seems easy to miss the context from previous work on a topic?

Don’t mean to respond for bybor, but to test my own understanding. Same topic, different thought. The text part of the name captures the context. My problem, as of my current thinking, is that the timestamp is abstract, arbitrary, meaningless.

Manually constructing the number it would seem necessary to give a distinct number to each note. Is that practical?

To me, this really does not sound practical. But again, I don't fully understand the concept. It sounds to me like Zettelkasten require more specialized tooling to enable discoverability and automatic linking and similar. This sounds out of scope for wiki.vim, but I don't know.

I have no experience with searching and am baffled by the plethora of digital tools for it. There is a paragraph in the note you linked to that mentions I think four or five different tools.

Yes, there are a lot of tools for searching. I recommend that you take a note of two of them: ripgrep and fd. ripgrep is a faster grep implementation with a few fancy options. fd is a faster find. It is really very fast, and thus useful to find and list files within big projects.

First question, are these whole text searches or filename searches?

ripgrep is like grep: full text search. fd is like find and searches by file name and/or attributes.

Second, because of Apple’s sandboxing of apps on its mobile devices, iVim is restricted to use of plugins that involve no external resources, that have no external commands. Could I use ripgrep and fd?

I don't know, sorry. But wiki.vim should more or less work as expected without these external tools.

I take it wiki.vim by itself doesn’t provide a solution to the problem of linking to an existing note.

It does, see above. But feel free to let me know if you think the existing solutions are inadequate somehow!

I think I understand the sense in which it does. The challenge I'm imagining is representing the link by the number assigned to the note linked to, whether it’s an existing note or a new one.

I’ve never used splits. When linking to a new note, which would involve creating a (unique?) number that represents the note’s place in the network of notes, I imagine it would be helpful to have access to, in a split, the list of files in the folder.

From my perspective, this seems very much like overthinking the concepts of taking good notes. But, again, there may be something useful about all of this that I'm just missing out on.

lervag commented 2 years ago

To be slightly more "on track": I may consider adding more types of links that may facilitate Zettelkasten ideas, but that would require you (or someone else) to explain specifically what you need. Preferably with examples and step-by-step guides.

As an example, based on what you are writing, you might want the link toggle/open mapping to work on text that forms the desired numbering pattern (e.g. timestamp or some number). Pressing <cr> on such a pattern would then open the note that is identified with the number/timestamp.

Still, for this type of workflow, it seems you also need some kind of discoverability to easily find existing notes. I'm not sure how that should/would look.

I would not be surprised if there are existing Zettelkasten tools that already implement these types of things. It seems a good idea to use these tools, and then possibly ask for features in wiki.vim to allow this workflow — if this is at all of interest after testing other tools?

EricEWeir commented 2 years ago

@EricEWeir , I found something that hints that file system interaction is possible. It's in comments under the first answer : https://apple.stackexchange.com/questions/428690/how-can-i-install-a-termux-like-terminal-app-for-ios

Everything below would go under a pretty big IF, since it's a pure theory.

Android has a thing called Termux, which gives you an experience of Linux terminal/shell. In it you get all the tools like fd, ripgrep, (neo)vim, git, all accessing a folder tree that can be synced to Android and then to anywhere else.

Apple is different, but if it's possible to get iSH (libTerm ?) environment, then you will no longer be limited to iVim and you also will get the search tools. I don't really know how it works, it may be , again, very different from Termux.

I checked out the discussion at the link you provided. Interesting, but I’m concerned that pursuing that avenue would mire me down in a level of obsessive tech problem solving that would be a diversion from what I really want to do, which is to write. I believe I’m eventually, and perhaps soon, going to get to the place with vim and wiki.vim, and perhaps search tools that I have yet to experiment with, that I can do that comfortably.

My disappointment at discovering after I got my first iPad that I couldn’t run vim on it I bought a Google Android tablet to see what was possible. I found that, with the help of a replacement keyboard that replicated a desktop or notebook keyboard, there was no limit.

At that point I could have just gone with the Android tablet. But I wanted to stick with Apple and so I sold it.

EricEWeir commented 2 years ago

To be slightly more "on track": I may consider adding more types of links that may facilitate Zettelkasten ideas, but that would require you (or someone else) to explain specifically what you need. Preferably with examples and step-by-step guides.

I was aware that we'd drifted pretty far off from the topic of using wiki.vim into the wilds of zettelkasten, which is of interest to me, less so to you.

But you have been, and are being, very generous. And I appreciate it.

As an example, based on what you are writing, you might want the link toggle/open mapping to work on text that forms the desired numbering pattern (e.g. timestamp or some number). Pressing <cr> on such a pattern would then open the note that is identified with the number/timestamp.

In my current state of naïveté that sounds exactly what I would like.

Still, for this type of workflow, it seems you also need some kind of discoverability to easily find existing notes. I'm not sure how that should/would look.

I would not be surprised if there are existing Zettelkasten tools that already implement these types of things. It seems a good idea to use these tools, and then possibly ask for features in wiki.vim to allow this workflow — if this is at all of interest after testing other tools?

That’s what I was going to say. Get more actual experience trying to do zettelkasten with wiki.vim, supplemented with experimentation with digital search tools. Then maybe I’ll be able talk about what is needed, or what I would like, on the basis of actual experience, rather than abstract, before the fact, theorizing.

There’s a fair bit of vim experience with zettelkasten out there that I can continue learning from. Of particular interest is vim.zettel. (https://github.com/michal-h21/vim-zettel) It’s an enhancement of vimwiki for zettlekasten.

Again, I really appreciate your help. And once I get wiki.vim with markdown working I will try to be less of a klutzy burden.

EricEWeir commented 2 years ago

If I were less obstinate about manually constructing the name for notes and willing to go with timestamps instead, wiki.vim might work for me as is. At one point last week I adapted your “map_create_page” function so that it assigned a date-timestamp to the new page and prompted for text to add to it. Nifty.

My sense was that that function would also be used by the “wiki-link-follow” command. Which would also have been nifty. (But maybe I am confused.)

lervag commented 2 years ago

Then you may be interested in g:wiki_map_text_to_link, e.g. something like this:

let g:wiki_map_text_to_link = 'MyTextToLink'

function MyTextToLink(text) abort
  return [strftime('%Y%m%d') . '_' . a:text, a:text]
endfunction

Notice that this function must return a pair of values, as opposed to g:wiki_map_create_page, which should only return a single value. I believe this should be well documented; see :help g:wiki_map_text_to_link.

lervag commented 2 years ago

As far as I can see, it seems this thread is also more or less resolved? When you have some clear ideas about what you find lacking, feel free to open new issues/feature requests.