diff options
| -rw-r--r-- | .config/luastatus/alsa.lua | 12 | ||||
| -rw-r--r-- | .config/nvim/ftplugin/markdown.lua | 10 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/cmp.lua | 10 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/colorizer.lua | 15 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/image.lua | 20 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/render-markdown.lua | 114 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/ui.lua | 18 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/zk.lua | 26 | ||||
| -rw-r--r-- | .config/shell/alias | 2 | ||||
| -rw-r--r-- | .config/shell/vars | 1 | ||||
| -rw-r--r-- | .config/sway/config | 2 | ||||
| -rw-r--r-- | .config/zk/config.toml | 35 | ||||
| -rw-r--r-- | .config/zk/templates/note.md | 6 | ||||
| -rwxr-xr-x | .local/bin/rofi-notes | 104 |
14 files changed, 266 insertions, 109 deletions
diff --git a/.config/luastatus/alsa.lua b/.config/luastatus/alsa.lua index fb97270..fc0f13b 100644 --- a/.config/luastatus/alsa.lua +++ b/.config/luastatus/alsa.lua @@ -10,8 +10,18 @@ widget = { symbol = '' elseif percent >= 70 then symbol = '' + if percent >= 99.5 then + return { + full_text = string.format('%s %d%%', symbol, math.floor(0.5 + percent)), + color = '#b7bdf8' + } + 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, event = [[ diff --git a/.config/nvim/ftplugin/markdown.lua b/.config/nvim/ftplugin/markdown.lua new file mode 100644 index 0000000..4f658e4 --- /dev/null +++ b/.config/nvim/ftplugin/markdown.lua @@ -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') diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index 541e62c..7728d19 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua @@ -15,6 +15,8 @@ return { -- preselect = cmp.PreselectMode.None, completion = { completeopt = "menu,menuone,noinsert", + callSnippet = "Replace", + keywordSnippet = "Replace", }, window = { completion = cmp.config.window.bordered({}), @@ -37,11 +39,11 @@ return { }, { { name = 'path' }, - }, - { - { name = 'buffer' }, - { name = 'rg', keyword_length = 3 } } + -- { + -- { name = 'buffer' }, + -- { name = 'rg', keyword_length = 3 } + -- } ), formatting = { format = lspkind.cmp_format({ diff --git a/.config/nvim/lua/plugins/colorizer.lua b/.config/nvim/lua/plugins/colorizer.lua new file mode 100644 index 0000000..460eb5c --- /dev/null +++ b/.config/nvim/lua/plugins/colorizer.lua @@ -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 +} diff --git a/.config/nvim/lua/plugins/image.lua b/.config/nvim/lua/plugins/image.lua new file mode 100644 index 0000000..32c3540 --- /dev/null +++ b/.config/nvim/lua/plugins/image.lua @@ -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 + +} diff --git a/.config/nvim/lua/plugins/render-markdown.lua b/.config/nvim/lua/plugins/render-markdown.lua index 65408bc..9d52c5b 100644 --- a/.config/nvim/lua/plugins/render-markdown.lua +++ b/.config/nvim/lua/plugins/render-markdown.lua @@ -1,7 +1,111 @@ return { - 'MeanderingProgrammer/render-markdown.nvim', - dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons - ---@module 'render-markdown' - ---@type render.md.UserConfig - opts = {}, + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, + config = function() + require('render-markdown').setup({ + 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 } diff --git a/.config/nvim/lua/plugins/ui.lua b/.config/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..96e9404 --- /dev/null +++ b/.config/nvim/lua/plugins/ui.lua @@ -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, +}; diff --git a/.config/nvim/lua/plugins/zk.lua b/.config/nvim/lua/plugins/zk.lua new file mode 100644 index 0000000..ce2e11a --- /dev/null +++ b/.config/nvim/lua/plugins/zk.lua @@ -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" }, + } +} diff --git a/.config/shell/alias b/.config/shell/alias index 627e915..931c115 100644 --- a/.config/shell/alias +++ b/.config/shell/alias @@ -7,3 +7,5 @@ alias man='batman' alias diff='batdiff' alias fzf="fzf --preview 'bat --style=numbers --color=always {}'" alias tlbx="toolbox enter" +alias vi="nvim" +alias vim="nvim" diff --git a/.config/shell/vars b/.config/shell/vars index 2f9c223..974c435 100644 --- a/.config/shell/vars +++ b/.config/shell/vars @@ -1 +1,2 @@ export EDITOR=nvim +export ZK_NOTEBOOK_DIR=/home/venomade/Documents/Notes diff --git a/.config/sway/config b/.config/sway/config index 6747a42..a5d6b0f 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -15,7 +15,7 @@ set $rofi_drun rofi -show drun -show-icons # This is a little hacky but I don't know if # any other way is possible on wayland. set $rofi_cliphist cliphist list \ - | rofi -dmenu -p "" \ + | rofi -dmenu -i -p "" \ | cliphist decode \ | wl-copy \ && wtype -M ctrl -M shift -k v -m shift -m ctrl diff --git a/.config/zk/config.toml b/.config/zk/config.toml new file mode 100644 index 0000000..1e6df92 --- /dev/null +++ b/.config/zk/config.toml @@ -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" } diff --git a/.config/zk/templates/note.md b/.config/zk/templates/note.md new file mode 100644 index 0000000..be4c1d2 --- /dev/null +++ b/.config/zk/templates/note.md @@ -0,0 +1,6 @@ +--- +title: {{title}} +tags: [] +--- + +{{content}} diff --git a/.local/bin/rofi-notes b/.local/bin/rofi-notes index 876bc66..840dea6 100755 --- a/.local/bin/rofi-notes +++ b/.local/bin/rofi-notes @@ -1,101 +1,9 @@ -#!/usr/bin/env lua +#!/usr/bin/env sh -local HOME = os.getenv("HOME") -local NOTES = HOME .. "/Documents/Notes" -local TERM = "foot -a=floating_foot" -local EDITOR = "nvim" +note_list=$(zk list -f "{{ title }}" -d $'\n' -q) -local MODE = arg[1] -- nil | "--delete" | "-d" +selected=$(printf "%s\n" "$note_list" | rofi -dmenu -i -p " ") -local function rofi(prompt, lines) - local cmd = string.format( - 'printf "%s" | rofi -dmenu -i -p "%s"', - 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) +if [[ -n $selected ]]; then + foot -a=floating_foot -e sh -c "zk edit --match \"${selected}\"" +fi |
