add zk workflow
This commit is contained in:
parent
595ac566ea
commit
2128911f24
12 changed files with 373 additions and 47 deletions
|
|
@ -3,8 +3,8 @@ packages:
|
|||
- du-dust
|
||||
- mise
|
||||
- rbw
|
||||
- yazi-fm
|
||||
- yazi-cli
|
||||
# - yazi-fm
|
||||
# - yazi-cli
|
||||
dnf:
|
||||
copr:
|
||||
- atim/lazygit
|
||||
|
|
|
|||
|
|
@ -24,3 +24,9 @@
|
|||
url = "https://github.com/joshmedeski/sesh/releases/latest/download/sesh_Linux_x86_64.tar.gz"
|
||||
path = "sesh"
|
||||
refreshPeriod = "168h"
|
||||
|
||||
[".local/bin/zk"]
|
||||
type = "archive-file"
|
||||
url = "https://github.com/zk-org/zk/releases/latest/download/zk-v0.14.1-linux-amd64.tar.gz"
|
||||
path = "zk"
|
||||
refreshPeriod = "168h"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
export FZF_SHOW_HELP_OPTS="$(
|
||||
cat <<-EOF
|
||||
|
||||
FZF Keybinds Shortcut
|
||||
|
||||
? Toggle/Hide Preview
|
||||
|
|
@ -86,7 +85,6 @@ export FZF_DEFAULT_OPTS="
|
|||
--info=inline
|
||||
--no-separator
|
||||
--layout=reverse
|
||||
--preview-window=:hidden
|
||||
"
|
||||
|
||||
export FZF_ALT_C_COMMAND="fd --type=d --color=always --hidden --exclude .git"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ return {
|
|||
triggers = {
|
||||
-- Leader triggers
|
||||
{ mode = "n", keys = "<Leader>" },
|
||||
{ mode = "v", keys = "<Leader>" },
|
||||
{ mode = "x", keys = "<Leader>" },
|
||||
|
||||
-- Built-in completion
|
||||
|
|
@ -61,6 +62,8 @@ return {
|
|||
{ mode = "n", keys = "<Leader>w", desc = "+Workspace" },
|
||||
{ mode = "n", keys = "<Leader>p", desc = "+Run stuff" },
|
||||
{ mode = "n", keys = "<Leader>a", desc = "+ChatGPT" },
|
||||
{ mode = "n", keys = "<Leader>z", desc = "+ZK" },
|
||||
{ mode = "v", keys = "<Leader>z", desc = "+ZK" },
|
||||
{ mode = "v", keys = "<Leader>a", desc = "+ChatGPT" },
|
||||
{ mode = "n", keys = "<Leader>a", desc = "+ChatGPT" },
|
||||
{ mode = "n", keys = "g?", desc = "+Print Debug" },
|
||||
|
|
|
|||
|
|
@ -11,4 +11,33 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"zk-org/zk-nvim",
|
||||
config = function()
|
||||
require("zk").setup({
|
||||
picker = "select",
|
||||
})
|
||||
|
||||
function MAP(mode, l, r, desc)
|
||||
vim.keymap.set(mode, l, r, { desc = desc, silent = true })
|
||||
end
|
||||
|
||||
MAP("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", "Open the link under cursor")
|
||||
|
||||
MAP("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>",
|
||||
"Create new note")
|
||||
MAP("v", "<leader>zN",
|
||||
":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>",
|
||||
"Create new note using selection as content")
|
||||
|
||||
MAP("n", "<leader>zl", "<Cmd>ZkInsertLink<CR>", "Insert Link into cursor position")
|
||||
MAP("v", "<leader>zl", ":'<,'>ZkInsertLinkAtSelection<CR>", "Insert Link into selection")
|
||||
|
||||
MAP("n", "<leader>zb", "<Cmd>ZkBacklinks<CR>", "Backlinks")
|
||||
MAP("n", "<leader>zo", "<Cmd>ZkLinks<CR>", "Outlinks")
|
||||
|
||||
MAP("n", "<leader>zf", "<Cmd>ZkNotes<CR>", "Find note")
|
||||
MAP("n", "<leader>zt", "<Cmd>ZkTags<CR>", "Find tags")
|
||||
end
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,5 +72,6 @@
|
|||
"vim-dadbod-ui": { "branch": "master", "commit": "f74a31e8c6c5a9dccc63450a09d5cd64a9294330" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "2694c5a2bc4dc26c7a9e74b9e2b812920c90a830" }
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "2694c5a2bc4dc26c7a9e74b9e2b812920c90a830" },
|
||||
"zk-nvim": { "branch": "main", "commit": "dbf4eeab55b08856c9d6b6722dbff39630bb35eb" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ set -g @popup-id-format '#{b:socket_path}/#{session_name}/#{b:pane_current_path}
|
|||
# Use this to open specific programs in floating panes
|
||||
bind C-p run "#{@popup-toggle}"
|
||||
bind C-o run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=tool fzf-tmux-tools-popup"
|
||||
bind C-w run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=wiki fzf-wikis"
|
||||
bind C-z run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=wiki fzf-wikis void"
|
||||
|
||||
# ╭──────────────────────────────────────────────────────────╮
|
||||
# │ FZF │
|
||||
|
|
|
|||
205
chezmoi/dot_config/zk/config.toml
Normal file
205
chezmoi/dot_config/zk/config.toml
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
# zk configuration file
|
||||
#
|
||||
# Uncomment the properties you want to customize.
|
||||
|
||||
# NOTE SETTINGS
|
||||
#
|
||||
# Defines the default options used when generating new notes.
|
||||
[note]
|
||||
|
||||
# Language used when writing notes.
|
||||
# This is used to generate slugs or with date formats.
|
||||
#language = "en"
|
||||
|
||||
# The default title used for new note, if no `--title` flag is provided.
|
||||
#default-title = "Untitled"
|
||||
|
||||
# Template used to generate a note's filename, without extension.
|
||||
filename = "{{slug title}}"
|
||||
|
||||
# The file extension used for the notes.
|
||||
#extension = "md"
|
||||
|
||||
# Template used to generate a note's content.
|
||||
# If not an absolute path, it is relative to .zk/templates/
|
||||
template = "default.md"
|
||||
|
||||
# Path globs ignored while indexing existing notes.
|
||||
#ignore = [
|
||||
# "drafts/*",
|
||||
# "log.md"
|
||||
#]
|
||||
|
||||
# Configure random ID generation.
|
||||
|
||||
# The charset used for random IDs. You can use:
|
||||
# * letters: only letters from a to z.
|
||||
# * numbers: 0 to 9
|
||||
# * alphanum: letters + numbers
|
||||
# * hex: hexadecimal, from a to f and 0 to 9
|
||||
# * custom string: will use any character from the provided value
|
||||
#id-charset = "alphanum"
|
||||
|
||||
# Length of the generated IDs.
|
||||
id-length = 8
|
||||
|
||||
# Letter case for the random IDs, among lower, upper or mixed.
|
||||
#id-case = "lower"
|
||||
|
||||
|
||||
# EXTRA VARIABLES
|
||||
#
|
||||
# A dictionary of variables you can use for any custom values when generating
|
||||
# new notes. They are accessible in templates with {{extra.<key>}}
|
||||
[extra]
|
||||
|
||||
#key = "value"
|
||||
|
||||
|
||||
# GROUP OVERRIDES
|
||||
#
|
||||
# You can override global settings from [note] and [extra] for a particular
|
||||
# group of notes by declaring a [group."<name>"] section.
|
||||
#
|
||||
# Specify the list of directories which will automatically belong to the group
|
||||
# with the optional `paths` property.
|
||||
#
|
||||
# Omitting `paths` is equivalent to providing a single path equal to the name of
|
||||
# the group. This can be useful to quickly declare a group by the name of the
|
||||
# directory it applies to.
|
||||
|
||||
#[group."<NAME>"]
|
||||
#paths = ["<DIR1>", "<DIR2>"]
|
||||
#[group."<NAME>".note]
|
||||
#filename = "{{format-date now}}"
|
||||
#[group."<NAME>".extra]
|
||||
#key = "value"
|
||||
|
||||
|
||||
# MARKDOWN SETTINGS
|
||||
[format.markdown]
|
||||
|
||||
# Format used to generate links between notes.
|
||||
# Either "wiki", "markdown" or a custom template. Default is "markdown".
|
||||
link-format = "wiki"
|
||||
# Indicates whether a link's path will be percent-encoded.
|
||||
# Defaults to true for "markdown" format and false for "wiki" format.
|
||||
#link-encode-path = true
|
||||
# Indicates whether a link's path file extension will be removed.
|
||||
# Defaults to true.
|
||||
#link-drop-extension = true
|
||||
|
||||
# Enable support for #hashtags.
|
||||
hashtags = true
|
||||
# Enable support for :colon:separated:tags:.
|
||||
colon-tags = false
|
||||
# Enable support for Bear's #multi-word tags#
|
||||
# Hashtags must be enabled for multi-word tags to work.
|
||||
multiword-tags = false
|
||||
|
||||
|
||||
# EXTERNAL TOOLS
|
||||
[tool]
|
||||
|
||||
# Default editor used to open notes. When not set, the EDITOR or VISUAL
|
||||
# environment variables are used.
|
||||
#editor = "vim"
|
||||
|
||||
# Pager used to scroll through long output. If you want to disable paging
|
||||
# altogether, set it to an empty string "".
|
||||
#pager = "less -FIRX"
|
||||
|
||||
fzf-line = "{{style 'title' path}}"
|
||||
fzf-preview = "bat -p --color always --style header,grid {-1}"
|
||||
fzf-bind-new = ""
|
||||
fzf-options = """
|
||||
--layout reverse
|
||||
--height 100%
|
||||
--no-hscroll
|
||||
--preview-window down,wrap,border-none,70%
|
||||
--header "C-A: New note in root with query as slug\nC-N: New note respecting query path"
|
||||
--bind "ctrl-n:abort+execute(mkdir -p $(dirname '{q}') && zk new $(dirname '{q}') --title $(basename '{q}'))"
|
||||
--bind "ctrl-a:abort+execute(mkdir -p $(dirname '{q}') && zk new $(dirname '{q}') --title $(basename '{q}'))"
|
||||
"""
|
||||
|
||||
|
||||
# LSP
|
||||
#
|
||||
# Configure basic editor integration for LSP-compatible editors.
|
||||
# See https://github.com/zk-org/zk/blob/main/docs/editors-integration.md
|
||||
#
|
||||
[lsp]
|
||||
|
||||
[lsp.diagnostics]
|
||||
# Each diagnostic can have for value: none, hint, info, warning, error
|
||||
|
||||
# Report titles of wiki-links as hints.
|
||||
# wiki-title = "hint"
|
||||
# Warn for dead links between notes.
|
||||
dead-link = "error"
|
||||
|
||||
[lsp.completion]
|
||||
# Customize the completion pop-up of your LSP client.
|
||||
|
||||
# Show the note title in the completion pop-up, or fallback on its path if empty.
|
||||
#note-label = ""
|
||||
# Filter out the completion pop-up using the note title or its path.
|
||||
#note-filter-text = " "
|
||||
# Show the note filename without extension as detail.
|
||||
#note-detail = ""
|
||||
|
||||
|
||||
# NAMED FILTERS
|
||||
#
|
||||
# A named filter is a set of note filtering options used frequently together.
|
||||
#
|
||||
[filter]
|
||||
|
||||
# Matches the notes created the last two weeks. For example:
|
||||
# $ zk list recents --limit 15
|
||||
# $ zk edit recents --interactive
|
||||
#recents = "--sort created- --created-after 'last two weeks'"
|
||||
|
||||
|
||||
# COMMAND ALIASES
|
||||
#
|
||||
# Aliases are user commands called with `zk <alias> [<flags>] [<args>]`.
|
||||
#
|
||||
# The alias will be executed with `$SHELL -c`, please refer to your shell's
|
||||
# man page to see the available syntax. In most shells:
|
||||
# * $@ can be used to expand all the provided flags and arguments
|
||||
# * you can pipe commands together with the usual | character
|
||||
#
|
||||
[alias]
|
||||
# Here are a few aliases to get you started.
|
||||
|
||||
# Shortcut to a command.
|
||||
ls = "zk list --interactive --sort path+ $@"
|
||||
|
||||
e = "zk edit --interactive --sort path+ $@"
|
||||
|
||||
# Default flags for an existing command.
|
||||
#list = "zk list --quiet $@"
|
||||
|
||||
# Edit the last modified note.
|
||||
#editlast = "zk edit --limit 1 --sort modified- $@"
|
||||
|
||||
# Edit the notes selected interactively among the notes created the last two weeks.
|
||||
# This alias doesn't take any argument, so we don't use $@.
|
||||
#recent = "zk edit --sort created- --created-after 'last two weeks' --interactive"
|
||||
|
||||
# Print paths separated with colons for the notes found with the given
|
||||
# arguments. This can be useful to expand a complex search query into a flag
|
||||
# taking only paths. For example:
|
||||
# zk list --link-to "`zk path -m potatoe`"
|
||||
#path = "zk list --quiet --format {{path}} --delimiter , $@"
|
||||
|
||||
# Show a random note.
|
||||
#lucky = "zk list --quiet --format full --sort random --limit 1"
|
||||
|
||||
# Returns the Git history for the notes found with the given arguments.
|
||||
# Note the use of a pipe and the location of $@.
|
||||
#hist = "zk list --format path --delimiter0 --quiet $@ | xargs -t -0 git log --patch --"
|
||||
|
||||
# Edit this configuration file.
|
||||
#conf = '$EDITOR "$ZK_NOTEBOOK_DIR/.zk/config.toml"'
|
||||
26
chezmoi/dot_config/zsh/completions/_tea
Normal file
26
chezmoi/dot_config/zsh/completions/_tea
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#compdef $PROG
|
||||
|
||||
PROG=tea
|
||||
_CLI_ZSH_AUTOCOMPLETE_HACK=1
|
||||
|
||||
_cli_zsh_autocomplete() {
|
||||
|
||||
local -a opts
|
||||
local cur
|
||||
cur=${words[-1]}
|
||||
if [[ "$cur" == "-"* ]]; then
|
||||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
|
||||
else
|
||||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
|
||||
fi
|
||||
|
||||
if [[ "${opts[1]}" != "" ]]; then
|
||||
_describe 'values' opts
|
||||
else
|
||||
_files
|
||||
fi
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
compdef _cli_zsh_autocomplete $PROG
|
||||
20
scripts/fzf-fj
Executable file
20
scripts/fzf-fj
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ╭──────────────────────────────────────────────────────────╮
|
||||
# │ Interactivie Issue management of forgejo │
|
||||
# ╰──────────────────────────────────────────────────────────╯
|
||||
|
||||
host="git.alecodes.page"
|
||||
repo="$(git remote get-url origin | rev | cut -d '/' -f -2 | rev | cut -d '.' -f 1)"
|
||||
cache="$(mktemp --directory)"
|
||||
|
||||
# --preview "[[ -e $cache/{1}.md ]] && bat $cache/{1}.md || fj --host $host issue view \"${repo}$(echo {1} | tr -d ':')\" | tee $cache/{1}.md" \
|
||||
|
||||
# TODO: Add more keybindings to interact with issues
|
||||
fj --host "$host" issue search --repo "$repo" | tail -n +2 |
|
||||
fzf \
|
||||
--preview "id=\"$(echo "{1}" | tr -cd "[:digit:]")\"; [[ -e $cache/$id ]] && bat $cache/$id || fj --host $host issue view ${repo}#$id | tee $cache/$id" \
|
||||
--bind "ctrl-r:execute-silent(rm -f $cache/{1})+refresh-preview" \
|
||||
--bind "ctrl-o:execute-silent(tea open {1})"
|
||||
|
||||
rm -rf "$cache"
|
||||
|
|
@ -6,15 +6,13 @@
|
|||
|
||||
# ────────────────────────────────────────────────────────────
|
||||
|
||||
tea_issue_cache="/tmp/tea-issue-cache"
|
||||
|
||||
mkdir -p "$tea_issue_cache"
|
||||
tea_cache="$(mktemp --directory)"
|
||||
|
||||
# TODO: Add more keybindings to interact with issues
|
||||
tea i -o simple |
|
||||
fzf \
|
||||
--preview "[[ -e $tea_issue_cache/{1} ]] && cat $tea_issue_cache/{1} || tea issue --comments {1} | tee $tea_issue_cache/{1}" \
|
||||
--bind "ctrl-r:execute-silent(rm -f $tea_issue_cache/{1})+refresh-preview" \
|
||||
--preview "[[ -e $tea_cache/{1}.md ]] && bat -l md $tea_cache/{1}.md || tea issue --comments {1} | tee $tea_cache/{1}.md" \
|
||||
--bind "ctrl-r:execute-silent(rm -f $tea_cache/{1})+refresh-preview" \
|
||||
--bind "ctrl-o:execute-silent(tea open {1})"
|
||||
|
||||
rm -rf "$tea_issue_cache"
|
||||
rm -rf "$tea_cache"
|
||||
|
|
|
|||
38
scripts/fzf-wikis
Executable file
38
scripts/fzf-wikis
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
wikis_path="$HOME/Repos/wikis"
|
||||
initial_path=$PWD
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
current_repo_name="$1"
|
||||
shift
|
||||
elif git rev-parse --git-dir &>/dev/null; then
|
||||
current_repo_name=$(git remote get-url origin | rev | cut -d '/' -f -1 | rev | cut -d '.' -f 1)
|
||||
current_repo_name="$current_repo_name.wiki"
|
||||
else
|
||||
echo "The command was not executed in a git repository and a repo name was not provided"
|
||||
read -rn 1 -p "Press any key to exit..."
|
||||
exit
|
||||
fi
|
||||
|
||||
path="$wikis_path/$current_repo_name"
|
||||
|
||||
if [[ ! -e "$path" ]]; then
|
||||
echo "The wiki for $current_repo_name doesn't exit, please clone it first to $wikis_path"
|
||||
read -rn 1 -p "Press any key to exit..."
|
||||
exit
|
||||
fi
|
||||
|
||||
cd "$path" || exit
|
||||
|
||||
if [[ ! -e .zk/config.toml ]]; then
|
||||
echo "ZK is not initialized in $path"
|
||||
read -rn 1 -p "Press any key to exit..."
|
||||
exit
|
||||
fi
|
||||
|
||||
zk e
|
||||
|
||||
cd "$initial_path" || exit
|
||||
Loading…
Add table
Add a link
Reference in a new issue