ZK, NVIM and Misc
Add ZK config, template and script. Add various Neovim plugins, and some markdown specific settings. Add Neovim aliases. Fix 100% in alsa luastatus plugin.
This commit is contained in:
1 parent
0bd1501855
commit
4b8cc0b9a9
14 files changed
+266
-109
No files matched your search
@@ -10,8 +10,18 @@ widget = {
|
|||||||
symbol = ''
|
symbol = ''
|
||||||
elseif percent >= 70 then
|
elseif percent >= 70 then
|
||||||
symbol = ''
|
symbol = ''
|
||||||
|
if percent >= 99.5 then
|
||||||
|
return {
|
||||||
|
full_text = string.format('%s %d%%', symbol, math.floor(0.5 + percent)),
|
||||||
|
color = '#b7bdf8'
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return { full_text = string.format('%s%3d%%', symbol, math.floor(0.5 + percent)), color = '#b7bdf8' }
|
|
||||||
|
return {
|
||||||
|
full_text = string.format('%s%3d%%', symbol, math.floor(0.5 + percent)),
|
||||||
|
color = '#b7bdf8'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
event = [[
|
event = [[
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
vim.keymap.set('n', 'n', 'gj', { buffer = true, noremap = true })
|
||||||
|
vim.keymap.set('n', 'e', 'gk', { buffer = true, noremap = true })
|
||||||
|
|
||||||
|
vim.opt_local.wrap = true
|
||||||
|
vim.opt_local.linebreak = true
|
||||||
|
|
||||||
|
vim.opt_local.number = false
|
||||||
|
vim.opt_local.relativenumber = false
|
||||||
|
|
||||||
|
vim.treesitter.start(vim.api.nvim_get_current_buf(), 'markdown')
|
||||||
@@ -15,6 +15,8 @@ return {
|
|||||||
-- preselect = cmp.PreselectMode.None,
|
-- preselect = cmp.PreselectMode.None,
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = "menu,menuone,noinsert",
|
completeopt = "menu,menuone,noinsert",
|
||||||
|
callSnippet = "Replace",
|
||||||
|
keywordSnippet = "Replace",
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
completion = cmp.config.window.bordered({}),
|
completion = cmp.config.window.bordered({}),
|
||||||
@@ -37,11 +39,11 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
},
|
|
||||||
{
|
|
||||||
{ name = 'buffer' },
|
|
||||||
{ name = 'rg', keyword_length = 3 }
|
|
||||||
}
|
}
|
||||||
|
-- {
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'rg', keyword_length = 3 }
|
||||||
|
-- }
|
||||||
),
|
),
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
return {
|
||||||
|
'norcalli/nvim-colorizer.lua',
|
||||||
|
config = function()
|
||||||
|
require("colorizer").setup({ "*" }, {
|
||||||
|
RGB = true,
|
||||||
|
RRGGBB = true,
|
||||||
|
names = false,
|
||||||
|
RRGGBBAA = true,
|
||||||
|
rgb_fn = true,
|
||||||
|
hsl_fn = true,
|
||||||
|
css = false,
|
||||||
|
css_fn = false,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
return {
|
||||||
|
'3rd/image.nvim',
|
||||||
|
config = function()
|
||||||
|
require("image").setup({
|
||||||
|
backend = "sixel",
|
||||||
|
processor = "magick_cli",
|
||||||
|
integrations = {
|
||||||
|
markdown = {
|
||||||
|
enabled = true,
|
||||||
|
only_render_image_at_cursor = true,
|
||||||
|
only_render_image_at_cursor_mode = "popup", -- or "inline"
|
||||||
|
floating_windows = true, -- if true, images will be rendered in floating markdown windows
|
||||||
|
},
|
||||||
|
},
|
||||||
|
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs" },
|
||||||
|
editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,111 @@
|
|||||||
return {
|
return {
|
||||||
'MeanderingProgrammer/render-markdown.nvim',
|
'MeanderingProgrammer/render-markdown.nvim',
|
||||||
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
|
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' },
|
||||||
---@module 'render-markdown'
|
config = function()
|
||||||
---@type render.md.UserConfig
|
require('render-markdown').setup({
|
||||||
opts = {},
|
link = {
|
||||||
|
enabled = true,
|
||||||
|
render_modes = false,
|
||||||
|
footnote = {
|
||||||
|
enabled = true,
|
||||||
|
superscript = true,
|
||||||
|
prefix = '',
|
||||||
|
suffix = '',
|
||||||
|
},
|
||||||
|
image = ' ',
|
||||||
|
email = ' ',
|
||||||
|
hyperlink = ' ',
|
||||||
|
highlight = 'RenderMarkdownLink',
|
||||||
|
wiki = {
|
||||||
|
icon = ' ',
|
||||||
|
body = function()
|
||||||
|
return nil
|
||||||
|
end,
|
||||||
|
highlight = 'RenderMarkdownWikiLink',
|
||||||
|
},
|
||||||
|
custom = {
|
||||||
|
web = { pattern = '^http', icon = ' ' },
|
||||||
|
github = { pattern = 'github%.com', icon = ' ' },
|
||||||
|
stackoverflow = { pattern = 'stackoverflow%.com', icon = ' ' },
|
||||||
|
wikipedia = { pattern = 'wikipedia%.org', icon = ' ' },
|
||||||
|
youtube = { pattern = 'youtube%.com', icon = ' ' },
|
||||||
|
reddit = { pattern = 'reddit%.com', icon = ' ' },
|
||||||
|
old_reddit = { pattern = 'old.reddit%.com', icon = ' ' },
|
||||||
|
gvc = { pattern = 'git%.venomade%.com', icon = ' ' },
|
||||||
|
catechism = { pattern = 'ccc%.directory', icon = ' ' },
|
||||||
|
bible = { pattern = 'biblenow%.net', icon = ' ' },
|
||||||
|
luarocks = { pattern = 'luarocks%.org', icon = ' ' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
callout = {
|
||||||
|
note = { raw = '[!NOTE]', rendered = ' Note', highlight = 'RenderMarkdownInfo' },
|
||||||
|
tip = { raw = '[!TIP]', rendered = ' Tip', highlight = 'RenderMarkdownSuccess' },
|
||||||
|
important = { raw = '[!IMPORTANT]', rendered = ' Important', highlight = 'RenderMarkdownHint' },
|
||||||
|
warning = { raw = '[!WARNING]', rendered = ' Warning', highlight = 'RenderMarkdownWarn' },
|
||||||
|
caution = { raw = '[!CAUTION]', rendered = ' Caution', highlight = 'RenderMarkdownError' },
|
||||||
|
abstract = { raw = '[!ABSTRACT]', rendered = ' Abstract', highlight = 'RenderMarkdownInfo' },
|
||||||
|
summary = { raw = '[!SUMMARY]', rendered = ' Summary', highlight = 'RenderMarkdownInfo' },
|
||||||
|
tldr = { raw = '[!TLDR]', rendered = ' Tldr', highlight = 'RenderMarkdownInfo' },
|
||||||
|
info = { raw = '[!INFO]', rendered = ' Info', highlight = 'RenderMarkdownInfo' },
|
||||||
|
todo = { raw = '[!TODO]', rendered = ' Todo', highlight = 'RenderMarkdownInfo' },
|
||||||
|
hint = { raw = '[!HINT]', rendered = ' Hint', highlight = 'RenderMarkdownSuccess' },
|
||||||
|
success = { raw = '[!SUCCESS]', rendered = ' Success', highlight = 'RenderMarkdownSuccess' },
|
||||||
|
check = { raw = '[!CHECK]', rendered = ' Check', highlight = 'RenderMarkdownSuccess' },
|
||||||
|
done = { raw = '[!DONE]', rendered = ' Done', highlight = 'RenderMarkdownSuccess' },
|
||||||
|
question = { raw = '[!QUESTION]', rendered = ' Question', highlight = 'RenderMarkdownWarn' },
|
||||||
|
help = { raw = '[!HELP]', rendered = ' Help', highlight = 'RenderMarkdownWarn' },
|
||||||
|
faq = { raw = '[!FAQ]', rendered = ' Faq', highlight = 'RenderMarkdownWarn' },
|
||||||
|
attention = { raw = '[!ATTENTION]', rendered = ' Attention', highlight = 'RenderMarkdownWarn' },
|
||||||
|
failure = { raw = '[!FAILURE]', rendered = ' Failure', highlight = 'RenderMarkdownError' },
|
||||||
|
fail = { raw = '[!FAIL]', rendered = ' Fail', highlight = 'RenderMarkdownError' },
|
||||||
|
missing = { raw = '[!MISSING]', rendered = ' Missing', highlight = 'RenderMarkdownError' },
|
||||||
|
danger = { raw = '[!DANGER]', rendered = ' Danger', highlight = 'RenderMarkdownError' },
|
||||||
|
error = { raw = '[!ERROR]', rendered = ' Error', highlight = 'RenderMarkdownError' },
|
||||||
|
bug = { raw = '[!BUG]', rendered = ' Bug', highlight = 'RenderMarkdownError' },
|
||||||
|
example = { raw = '[!EXAMPLE]', rendered = ' Example', highlight = 'RenderMarkdownHint' },
|
||||||
|
quote = { raw = '[!QUOTE]', rendered = ' Quote', highlight = 'RenderMarkdownQuote' },
|
||||||
|
cite = { raw = '[!CITE]', rendered = ' Cite', highlight = 'RenderMarkdownQuote' },
|
||||||
|
},
|
||||||
|
checkbox = {
|
||||||
|
enabled = true,
|
||||||
|
render_modes = false,
|
||||||
|
bullet = false,
|
||||||
|
right_pad = 1,
|
||||||
|
unchecked = {
|
||||||
|
icon = ' ',
|
||||||
|
highlight = 'RenderMarkdownUnchecked',
|
||||||
|
scope_highlight = nil,
|
||||||
|
},
|
||||||
|
checked = {
|
||||||
|
icon = ' ',
|
||||||
|
highlight = 'RenderMarkdownChecked',
|
||||||
|
scope_highlight = nil,
|
||||||
|
},
|
||||||
|
custom = {
|
||||||
|
todo = { raw = '[-]', rendered = ' ', highlight = 'RenderMarkdownTodo', scope_highlight = nil },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
bullet = {
|
||||||
|
enabled = true,
|
||||||
|
render_modes = false,
|
||||||
|
icons = { '●', '○', '◆', '◇' },
|
||||||
|
ordered_icons = function(ctx)
|
||||||
|
local value = vim.trim(ctx.value)
|
||||||
|
local index = tonumber(value:sub(1, #value - 1))
|
||||||
|
return ('%d.'):format(index > 1 and index or ctx.index)
|
||||||
|
end,
|
||||||
|
left_pad = 0,
|
||||||
|
right_pad = 0,
|
||||||
|
highlight = 'RenderMarkdownBullet',
|
||||||
|
scope_highlight = {},
|
||||||
|
},
|
||||||
|
quote = { icon = '▋' },
|
||||||
|
anti_conceal = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
heading = {
|
||||||
|
width = 'block',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
return {
|
||||||
|
"OXY2DEV/ui.nvim",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require("ui").setup({
|
||||||
|
cmdline = {
|
||||||
|
enable = true,
|
||||||
|
row_offset = 0,
|
||||||
|
},
|
||||||
|
messages = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
popupmenu = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
end,
|
||||||
|
};
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
return {
|
||||||
|
"zk-org/zk-nvim",
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require("zk").setup({
|
||||||
|
picker = "telescope",
|
||||||
|
lsp = {
|
||||||
|
config = {
|
||||||
|
name = "zk",
|
||||||
|
cmd = { "zk", "lsp" },
|
||||||
|
filetypes = { "markdown" },
|
||||||
|
},
|
||||||
|
auto_attach = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{ "<leader>zz", "<cmd>ZkNotes<cr>", desc = "Notes" },
|
||||||
|
{ "<leader>zl", "<cmd>ZkLinks<cr>", desc = "Links" },
|
||||||
|
{ "<leader>zb", "<cmd>ZkBacklinks<cr>", desc = "Backlinks" },
|
||||||
|
{ "<leader>zi", "<cmd>ZkInsertLink<cr>", desc = "Insert Link" },
|
||||||
|
{ "<leader>zd", "<cmd>ZkCd<cr>", desc = "Enter Directory" },
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,3 +7,5 @@ alias man='batman'
|
|||||||
alias diff='batdiff'
|
alias diff='batdiff'
|
||||||
alias fzf="fzf --preview 'bat --style=numbers --color=always {}'"
|
alias fzf="fzf --preview 'bat --style=numbers --color=always {}'"
|
||||||
alias tlbx="toolbox enter"
|
alias tlbx="toolbox enter"
|
||||||
|
alias vi="nvim"
|
||||||
|
alias vim="nvim"
|
||||||
@@ -1 +1,2 @@
|
|||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
|
export ZK_NOTEBOOK_DIR=/home/venomade/Documents/Notes
|
||||||
+1
-1
@@ -15,7 +15,7 @@ set $rofi_drun rofi -show drun -show-icons
|
|||||||
# This is a little hacky but I don't know if
|
# This is a little hacky but I don't know if
|
||||||
# any other way is possible on wayland.
|
# any other way is possible on wayland.
|
||||||
set $rofi_cliphist cliphist list \
|
set $rofi_cliphist cliphist list \
|
||||||
| rofi -dmenu -p "" \
|
| rofi -dmenu -i -p "" \
|
||||||
| cliphist decode \
|
| cliphist decode \
|
||||||
| wl-copy \
|
| wl-copy \
|
||||||
&& wtype -M ctrl -M shift -k v -m shift -m ctrl
|
&& wtype -M ctrl -M shift -k v -m shift -m ctrl
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
[notebook]
|
||||||
|
dir = "~/Documents/Notes"
|
||||||
|
|
||||||
|
[note]
|
||||||
|
filename = "{{slug title}}"
|
||||||
|
template = "note.md"
|
||||||
|
|
||||||
|
[extra]
|
||||||
|
author = "Venomade"
|
||||||
|
|
||||||
|
[format.markdown]
|
||||||
|
link-format = "wiki"
|
||||||
|
hashtags = true
|
||||||
|
colon-tags = false
|
||||||
|
multiword-tags = true
|
||||||
|
|
||||||
|
[tool]
|
||||||
|
editor = "nvim"
|
||||||
|
shell = "/bin/bash"
|
||||||
|
fzf-preview = "bat -p --color always {-1}"
|
||||||
|
|
||||||
|
[alias]
|
||||||
|
todo = "zk edit TODO"
|
||||||
|
|
||||||
|
push = "git fetch && if [ \"$(git rev-parse @)\" = \"$(git rev-parse @{u})\" ]; then git add -A && git commit -m \"Update: $(date '+%Y-%m-%d %H:%M:%S')\" && git push; else echo \"Local branch is not up‑to‑date with the remote; aborting.\"; fi"
|
||||||
|
pull = "git pull"
|
||||||
|
history = "git log --pretty=format:\"%s\" | tail -10; echo"
|
||||||
|
|
||||||
|
rm = "rm -i $@.md"
|
||||||
|
|
||||||
|
[lsp]
|
||||||
|
[lsp.diagnostics]
|
||||||
|
wiki-title = "hint"
|
||||||
|
dead-link = "error"
|
||||||
|
missing-backlink = { level = "warning", position = "bottom" }
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
title: {{title}}
|
||||||
|
tags: []
|
||||||
|
---
|
||||||
|
|
||||||
|
{{content}}
|
||||||
+6
-98
@@ -1,101 +1,9 @@
|
|||||||
#!/usr/bin/env lua
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
local HOME = os.getenv("HOME")
|
note_list=$(zk list -f "{{ title }}" -d $'\n' -q)
|
||||||
local NOTES = HOME .. "/Documents/Notes"
|
|
||||||
local TERM = "foot -a=floating_foot"
|
|
||||||
local EDITOR = "nvim"
|
|
||||||
|
|
||||||
local MODE = arg[1] -- nil | "--delete" | "-d"
|
selected=$(printf "%s\n" "$note_list" | rofi -dmenu -i -p " ")
|
||||||
|
|
||||||
local function rofi(prompt, lines)
|
if [[ -n $selected ]]; then
|
||||||
local cmd = string.format(
|
foot -a=floating_foot -e sh -c "zk edit --match \"${selected}\""
|
||||||
'printf "%s" | rofi -dmenu -i -p "%s"',
|
fi
|
||||||
table.concat(lines, "\n"),
|
|
||||||
prompt
|
|
||||||
)
|
|
||||||
local handle = io.popen(cmd)
|
|
||||||
local selection = handle:read("*a")
|
|
||||||
handle:close()
|
|
||||||
selection = selection:gsub("%s+$", "")
|
|
||||||
if selection == "" then return nil end
|
|
||||||
return selection
|
|
||||||
end
|
|
||||||
|
|
||||||
local function list_notes()
|
|
||||||
local display = {}
|
|
||||||
local lookup = {}
|
|
||||||
|
|
||||||
local cmd = string.format('find "%s" -type f', NOTES)
|
|
||||||
local pipe = assert(io.popen(cmd, "r"))
|
|
||||||
|
|
||||||
for fullPath in pipe:lines() do
|
|
||||||
local relPath = fullPath:gsub("^" .. NOTES .. "/", "")
|
|
||||||
local noteName = relPath:gsub("%.[^./]*$", "")
|
|
||||||
|
|
||||||
table.insert(display, noteName)
|
|
||||||
lookup[noteName] = fullPath
|
|
||||||
end
|
|
||||||
|
|
||||||
pipe:close()
|
|
||||||
return display, lookup
|
|
||||||
end
|
|
||||||
|
|
||||||
local function normalize_path(input)
|
|
||||||
input = input:gsub("^/", "")
|
|
||||||
if not input:match("%.md$") then
|
|
||||||
input = input .. ".md"
|
|
||||||
end
|
|
||||||
return NOTES .. "/" .. input
|
|
||||||
end
|
|
||||||
|
|
||||||
local function ensure_parent_dir(path)
|
|
||||||
local dir = path:match("(.+)/[^/]+$")
|
|
||||||
if dir then
|
|
||||||
os.execute(string.format('mkdir -p "%s"', dir))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function open_in_nvim(path)
|
|
||||||
local cmd = string.format(
|
|
||||||
'%s -e %s "%s"',
|
|
||||||
TERM,
|
|
||||||
EDITOR,
|
|
||||||
path
|
|
||||||
)
|
|
||||||
os.execute(cmd)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function delete_note(path, name)
|
|
||||||
local confirm = rofi("Delete " .. name .. "?", { "No", "Yes" })
|
|
||||||
if confirm == "Yes" then
|
|
||||||
os.execute(string.format('rm -- "%s"', path))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- ---- main ----
|
|
||||||
|
|
||||||
local notes, paths = list_notes()
|
|
||||||
|
|
||||||
if MODE == "--delete" or MODE == "-d" then
|
|
||||||
local choice = rofi(" ", notes)
|
|
||||||
if not choice then os.exit(0) end
|
|
||||||
|
|
||||||
local path = paths[choice]
|
|
||||||
if path then
|
|
||||||
delete_note(path, choice)
|
|
||||||
end
|
|
||||||
|
|
||||||
os.exit(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- default: open / create
|
|
||||||
local choice = rofi(" ", notes)
|
|
||||||
if not choice then os.exit(0) end
|
|
||||||
|
|
||||||
local path = paths[choice]
|
|
||||||
if not path then
|
|
||||||
path = normalize_path(choice)
|
|
||||||
ensure_parent_dir(path)
|
|
||||||
end
|
|
||||||
|
|
||||||
open_in_nvim(path)
|
|
||||||
Reference in new issue
Block a user