1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:00:04 +08:00

feat(zettelkasten): detach vim-zettelkasten plugin

update

zettelkasten browser statusline

update

update readme

update
This commit is contained in:
Eric Wong 2024-12-10 21:47:12 +08:00
parent 0801126d19
commit b89c9f320a
10 changed files with 68 additions and 101 deletions

View File

@ -382,6 +382,27 @@ EOT
_checkdir doc/
_detach_bundle vim-cheat doc/vim-cheat.txt
;;
vim-zettelkasten)
git clone https://github.com/wsdjeg/vim-zettelkasten.git detach/$1
cd detach/$1
_detact LICENSE
_checkdir plugin/
_detach_bundle vim-zettelkasten plugin/zettelkasten.lua
_detach_bundle vim-zettelkasten README.md
_checkdir doc/
_detach_bundle vim-zettelkasten doc/vim-zettelkasten.txt
_checkdir ftdetect
_detach_bundle vim-zettelkasten ftdetect/zettelkasten.lua
_checkdir ftplugin
_detach_bundle vim-zettelkasten ftplugin/markdown.lua
_detach_bundle vim-zettelkasten ftplugin/zkbrowser.lua
_checkdir lua/zettelkasten
_detach_bundle vim-zettelkasten lua/zettelkasten.lua
_detach_bundle vim-zettelkasten lua/zettelkasten/browser.lua
_detach_bundle vim-zettelkasten lua/zettelkasten/config.lua
_detach_bundle vim-zettelkasten lua/zettelkasten/formatter.lua
_detach_bundle vim-zettelkasten lua/zettelkasten/log.lua
;;
xmake.vim)
git clone https://github.com/wsdjeg/xmake.vim.git detach/$1
cd detach/$1

View File

@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
detachPlugin: ["FlyGrep.vim", "dein-ui.vim", "vim-todo", "iedit.vim", "scrollbar.vim", "vim-chat", "vim-cheat", "xmake.vim", "GitHub.vim", "JavaUnit.vim", "git.vim", "cpicker.nvim", "SourceCounter.vim"]
detachPlugin: ["FlyGrep.vim", "dein-ui.vim", "vim-todo", "iedit.vim", "scrollbar.vim", "vim-chat", "vim-cheat", "xmake.vim", "GitHub.vim", "JavaUnit.vim", "git.vim", "cpicker.nvim", "SourceCounter.vim", "vim-zettelkasten"]
runs-on: ubuntu-latest
steps:
- name: Checkout

View File

@ -1,24 +0,0 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>

View File

@ -1,70 +1,36 @@
# vim-zettelkasten
`vim-zettelkasten` is a [Zettelkasten](https://zettelkasten.de) note taking plugin.
> _vim-zettelkasten_ is a [Zettelkasten](https://zettelkasten.de) note taking plugin, which is forked from [zettelkasten.nvim@fe174666](https://github.com/Furkanzmc/zettelkasten.nvim/tree/fe1746666e27c2fcc0e60dc2786cb9983b994759).
It is based on [zettelkasten.nvim@fe174666](https://github.com/Furkanzmc/zettelkasten.nvim/tree/fe1746666e27c2fcc0e60dc2786cb9983b994759)
[![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org)
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](LICENSE)
Using this plugin, you can:
<!-- vim-markdown-toc GFM -->
1. Create new notes with unique IDs (`:help :ZkNew`)
- [Install](#install)
- [Feedback](#feedback)
2. List the places where a tag is used with `:tselect tag_name` or use Vim's own tag shortcuts for
navigation.
<!-- vim-markdown-toc -->
3. Use `i_CTRL-X_CTRL-]` to get a list of all the tags in your notes.
## Install
4. Get a completion list of note references.
1. Using `vim-zettelkasten` in SpaceVim:
5. Use `K` command to display context for a note ID.
```toml
[[layers]]
name = 'zettelkasten'
zettel_dir = 'D:\me\zettelkasten'
zettel_template_dir = 'D:\me\zettelkasten_template'
```
6. Use `gf` to navigate to a reference. As long as your `:help path` option is set correctly, this
will work.
2. Using `vim-zettelkasten` without SpaceVim:
There's no separate file type for zettelkasten. Markdown file type is used to extend the
functionality to make it easier to take notes.
```
Plug 'wsdjeg/vim-zettelkasten'
```
For the most up to date information, please do `:help zettelkasten.txt`. I won't be updating README
file for every single feature or update. You can also check out the
[wiki](https://github.com/Furkanzmc/zettelkasten.nvim/wiki) for tips and tricks on how to use
zettelkasten.nvim.
## Feedback
# Configuration
The development of this plugin is in [`SpaceVim/bundle/vim-zettelkasten`](https://github.com/SpaceVim/SpaceVim/tree/master/bundle/vim-zettelkasten) directory.
See `:help zettelkasten.txt` for more information.
# TODO
Potential ideas to implement in the future:
- [ ] A graph view (Possible with an external CLI program.)
- [X] A sidebar (or preview window) to display the linked notes.
- [ ] Telescope support. It's a popular plugin so it'd be useful but I don't use Telescope so
contributions for this feature is most welcome!
# Project Goals
I started the project out of a bout of excitement for having discovered the Zettelkasten note
taking system. I've been looking for better ways to take notes and this system seems to fulfill my
needs. Since I love Vim, and Zettelkasten is a text based system (Which is what I love the most
about it), I decided to create a plugin immediately.
My goal is not to turn this into a huge thing with custom pickers, and file types, and a gazillion
mapping and commands. My goal is to make use of the existing Vim options/mappings/features to
extend markdown file type so it's more convenient to navigate, discover, and write.
As you can see from its initial state, the only thing you need to really know about this plugin is
the `:ZkNew` command. Everything else can be discovered as you are flexing your usual Vim muscles
(e. `gf`, `i_CTRL-X_CTRL-]`, `CTRL-]`).
In true Vim philosophy, I also want to make it easier for people to extend this plugin to their own
needs. So, all the Lua API will be nicely designed so you can interface this plugin with others
(e.g `Telescope.nvim`) or create your own workflow easily.
Please also see `:help zettelkasten.nvim-101` and `:help zettelkasten-philosophy`.
# Related Projects
- [zk-nvim](https://github.com/mickael-menu/zk-nvim)
- [zettel.vim](https://github.com/Aarleks/zettel.vim/)
- [telekasten.nvim](https://github.com/renerocksai/telekasten.nvim)
- [marty-oehme/zettelkasten.nvim](https://github.com/marty-oehme/zettelkasten.nvim)
If you encounter any bugs or have suggestions, please file an issue in the [issue tracker](https://github.com/SpaceVim/SpaceVim/issues)

View File

@ -13,14 +13,8 @@ vim.opt_local.iskeyword:append(':')
vim.opt_local.iskeyword:append('-')
vim.opt_local.suffixesadd:append('.md')
vim.opt_local.errorformat = '%f:%l: %m'
if vim.opt_local.keywordprg:get() == '' then
vim.opt_local.keywordprg = ':ZkHover -preview'
end
if vim.opt_local.tagfunc:get() == '' then
vim.opt_local.tagfunc = 'v:lua.zettelkasten.tagfunc'
end
vim.opt_local.keywordprg = ':ZkHover -preview'
vim.opt_local.tagfunc = 'v:lua.zettelkasten.tagfunc'
local win = require('spacevim.api.vim.window')

View File

@ -1,3 +1,11 @@
--=============================================================================
-- formatter.lua --- formatter for zk notes browser
-- Copyright (c) 2024 Wang Shidong & Contributors
-- Author: Wang Shidong < wsdjeg@outlook.com >
-- URL: https://spacevim.org
-- License: GPLv3
--=============================================================================
local M = {}
local s_formatters = {
['%r'] = function(line)
@ -10,6 +18,9 @@ local s_formatters = {
return vim.fn.fnamemodify(line.file_name, ':t')
end,
['%h'] = function(line)
if vim.fn.strdisplaywidth(line.title) <= 30 then
return line.title .. string.rep(' ', 30 - vim.fn.strdisplaywidth(line.title))
end
return line.title
end,
['%d'] = function(line)

View File

@ -1,6 +0,0 @@
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"

View File

@ -2,12 +2,14 @@ if "zkbrowser" !=# get(b:, "current_syntax", "zkbrowser")
finish
endif
syntax match ZkFileName '[0-9]\+-[0-9]\+-[0-9]\+-[0-9]\+-[0-9]\+-[0-9]\+\.md'
syntax match ZkRefCount '\[[0-9]\+ .*\]'
syntax match ZkTag '#\<\k\+\>'
syntax match ZettelKastenID '[0-9]\+-[0-9]\+-[0-9]\+-[0-9]\+-[0-9]\+-[0-9]\+\.md'
syntax match ZettelKastenDash '\s-\s'
syntax match ZettelKastenRefs '\[[0-9]\+ .*\]'
syntax match ZettelKastenTags '#\<\k\+\>'
highlight default link ZkFileName Label
highlight default link ZkRefCount Link
highlight default link ZkTag Tag
highlight default link ZettelKastenID String
highlight default link ZettelKastenDash Comment
highlight default link ZettelKastenRefs Number
highlight default link ZettelKastenTags Tag
let b:current_syntax = "zkbrowser"

View File

@ -582,6 +582,9 @@ local special_statusline = {
calender = function()
return simple_name('Calendar')
end,
zkbrowser = function()
return simple_name('Zettelkasten Browser')
end,
['vader-result'] = function()
return simple_name('Vader result')
end,