diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua b/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua index 72cabe5..162d03b 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/misc.lua @@ -25,9 +25,29 @@ function M.resolve_tsserver_deno(client) end end +function M.disable_others_when_zk(client) + local active_clients = vim.lsp.get_active_clients() + if client.name == "zk" then + for _, client_ in pairs(active_clients) do + -- stop ltex if zk is already active + if client_.name == "ltex" then + client_.stop() + end + end + elseif client.name == "ltex" then + for _, client_ in pairs(active_clients) do + -- prevent ltex from starting if zk is already active + if client_.name == "zk" then + client.stop() + end + end + end +end + function M.on_attach(client, bufnr) M.disable_deno_formatting(client) M.resolve_tsserver_deno(client) + M.disable_others_when_zk(client) end return M diff --git a/.config/nvim/lua/lazyvim/plugins/neorg.lua b/.config/nvim/lua/lazyvim/plugins/neorg.lua index 62da60d..69c1372 100644 --- a/.config/nvim/lua/lazyvim/plugins/neorg.lua +++ b/.config/nvim/lua/lazyvim/plugins/neorg.lua @@ -11,9 +11,9 @@ return { ["core.norg.dirman"] = { config = { workspaces = { - work = "~/work", - personal = "~/notes", - journal = "~/notes/journal/", + work = "~/work/neorg/", + personal = "~/notes/neorg/", + journal = "~/notes/neorg/journal/", }, }, }, diff --git a/.config/nvim/lua/lazyvim/plugins/whichkey.lua b/.config/nvim/lua/lazyvim/plugins/whichkey.lua index 2827034..55cf001 100644 --- a/.config/nvim/lua/lazyvim/plugins/whichkey.lua +++ b/.config/nvim/lua/lazyvim/plugins/whichkey.lua @@ -71,7 +71,7 @@ return { N = { name = "+noice" }, e = { "NvimTreeToggle", "Explorer" }, - z = { "ZenMode", "Zen" }, + Z = { "ZenMode", "Zen" }, u = { "UndotreeToggle", "Undo Tree" }, ["'"] = { "close", "Close split" }, @@ -173,6 +173,13 @@ return { end, "Toggle conceal", }, + h = { + function() + local sidescrolloff = vim.o.sidescrolloff > 0 and vim.o.sidescrolloff or 8 + utils.toggle("sidescrolloff", false, { 0, sidescrolloff }) + end, + "Toggle side scroll off", + }, }, g = { @@ -191,6 +198,46 @@ return { }, }, + z = { + name = "+zk", + I = { "ZkIndex", "Index Notebook" }, + n = { + "+new", + n = { "ZkNew { title = vim.fn.input('Title: ') }", "New Note (zk dir)" }, + N = { + "ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", + "New Note (cwd)", + }, + t = { + "ZkNewFromTitleSelection { title = vim.fn.input('Title: ') }", + "New, Title from selection (zk dir)", + }, + T = { + "ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') title = vim.fn.input('Title: ') }", + "New, Title from selection (cwd)", + }, + c = { + "ZkNewFromContentSelection { title = vim.fn.input('Title: ') }", + "New, Content from selection (zk dir)", + }, + C = { + "ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h') title = vim.fn.input('Title: ') }", + "New, Content from selection (cwd)", + }, + }, + c = { "ZkCd", "cd 'root'" }, + s = { "ZkNotes", "List Notes" }, + b = { "ZkBacklinks", "Backlinks" }, + l = { "ZkLinks", "Links" }, + j = { + "ZkNew { dir = 'journal', date = 'today', title = vim.fn.input('Title: ') }", + "New Journal", + }, + i = { + { "ZkInsertLink", "Insert Link" }, + }, + }, + -- TODO: Add dap back into the project, bashbunni's dotfiles are a good resource. -- d = { -- name = "Debug", diff --git a/.config/nvim/lua/lazyvim/plugins/zk.lua b/.config/nvim/lua/lazyvim/plugins/zk.lua new file mode 100644 index 0000000..e39ee4e --- /dev/null +++ b/.config/nvim/lua/lazyvim/plugins/zk.lua @@ -0,0 +1,32 @@ +return { + { + "mickael-menu/zk-nvim", + event = "VeryLazy", + opts = { + picker = "telescope", + }, + config = function(_, opts) + require("zk").setup(opts) + + local function yankName(options, picker_options) + require("zk").pick_notes(options, picker_options, function(notes) + local pos = vim.api.nvim_win_get_cursor(0)[2] + local line = vim.api.nvim_get_current_line() + + if picker_options.multi_select == false then + notes = { notes } + end + for _, note in ipairs(notes) do + -- stylua: ignore + local nline = line:sub(0, pos) .. "[" .. note.title .. "]" .. "(" .. note.path .. ")" .. line:sub(pos + 1) + vim.api.nvim_set_current_line(nline) + end + end) + end + + require("zk.commands").add("ZkInsertLink", function(options) + yankName(options, { title = "Zk Yank" }) + end) + end, + }, +} diff --git a/.config/nvim/lua/lazyvim/utils/teletest.lua b/.config/nvim/lua/lazyvim/utils/teletest.lua deleted file mode 100644 index de58253..0000000 --- a/.config/nvim/lua/lazyvim/utils/teletest.lua +++ /dev/null @@ -1,38 +0,0 @@ -local pickers = require("telescope.pickers") -local finders = require("telescope.finders") -local actions = require("telescope.actions") -local action_state = require("telescope.actions.state") -local conf = require("telescope.config").values - -local prompt = function(opts, prompt, inputs, callback) - opts = opts or require("telescope.themes").get_dropdown({}) - pickers - .new(opts, { - prompt_title = prompt, - finder = finders.new_table({ - results = inputs, - entry_maker = function(entry) - return { - value = entry, - display = entry[1], - ordinal = entry[1], - } - end, - }), - sorter = conf.generic_sorter(opts), - attach_mappings = function(promnt_bufnr, map) - actions.select_default:replace(function() - actions.close(promnt_bufnr) - local selection = action_state.get_selected_entry() - vim.notify(selection) - end) - return true - end, - }) - :find() -end - -prompt(nil, "test", { - { "one", "1" }, - { "two", "2" }, -}, nil)