wincent / corpus

📝 A note-management application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feedback

ahmedelgabri opened this issue · comments

See twitter thread for context

First, I understand that this is currently a WIP & might not even be released. Because it was created for personal use. But I was looking exactly for something like that so I thought I'd give it a try. So here are my initial thoughts:

  • Currently, the plugin works only with git repos folders, it will be great if it can also work with normal folders.
  • A callback to control the newly created file name. For example one of the folders I want to use Corpus for is a notes folder, and I like to prefix the name with a datestamp. Something like %Y-%m-%d-%H-%M-%S-<name>.md
  • [minor] In neovim with the new Lua rewrite it feels less vim-y adding a global variable CorpusDirectories = {…} instead of doing something like vim.g.CorpusDirectories = {…} for example

Thanks for opening the issue, @ahmedelgabri:

Currently, the plugin works only with git repos folders, it will be great if it can also work with normal folders.

I suspect that it could probably be made to work on non-Git repos when autocommit = 0 is set, if we add a little bit of plumbing to allow plugging in alternate "finder" tools; eg rg could probably stand in for the two core uses of Git that are currently in there (git ls-files to list files and git grep for full text search).

A callback to control the newly created file name.

Yep, makes sense.

  • In neovim with the new Lua rewrite it feels less vim-y adding a global variable CorpusDirectories = {…} instead of doing something like vim.g.CorpusDirectories = {…} for example

Yeah, that's true. Before the Lua move it was g:CorpusDirectories, and for a while I was reading that from Lua (it is easy enough to do), then I moved it over to Lua because I was thinking of possibilities like the one you mentioned above (ie. of controlling some behavior more flexibly with callbacks), and my suspicion is that implementing those in Lua would be more performant. But this is an axis that can be explored over time as things get solidified.

Currently, the plugin works only with git repos folders, it will be great if it can also work with normal folders.

I suspect that it could probably be made to work on non-Git repos when autocommit = 0 is set, if we add a little bit of plumbing to allow plugging in alternate "finder" tools; eg rg could probably stand in for the two core uses of Git that are currently in there (git ls-files to list files and git grep for full text search).

I think you might be able to do this in reverse (rg first then fallback to git ls-files) or even do it fully with rg, because rg by default respects .gitignore so something like this might be the same as git ls-files.

rg --hidden --follow --files --type md

One more point, it seems that there is no way to change to a different directory once you are inside one of the directories in CorpusDirectories. I expected :Corpus <Tab> to maybe work but that was not the case & I feel like it might be too much for the same command, maybe :CorpusSwitch or <Plug><Corpus-switch>

Yeah, it is kind of intentionally overloaded in that way.

  1. If you're outside of a Corpus directory, it will autocomplete configured directories.
  2. If you're already in a Corpus directory, tab will autocomplete note files in that directory.

So in a sense, it is pretty easy to go from "1" to "2", but not the reverse.

As a temporary measure, if you want to hack in a mapping to switch you could use something like this:

nnoremap <Leader>k :cd ~<CR>:Corpus<Space>

ie. switch back to your home directory (which is presumably not a Corpus directory) and then invoke :Corpus .