set up zk stuff
This commit is contained in:
parent
8012717ace
commit
c293c29af3
|
@ -45,8 +45,18 @@ end
|
|||
-- Notes --
|
||||
if f.is_available("zk-nvim") then
|
||||
maps.n["<Leader>n"] = M.sections.n
|
||||
maps.n["<Leader>ni"] = { require("zk.commands").get("ZkIndex"), desc = "Index Notes" }
|
||||
maps.n["<Leader>nn"] = { require("zk.commands").get("ZkIndex"), desc = "Index Notes" }
|
||||
maps.n["<Leader>nn"] = {
|
||||
function() require("zk").new({ notebook_path = vim.g.wikidir, title = vim.fn.input('Title: ') }) end,
|
||||
desc = "New Note"
|
||||
}
|
||||
maps.n["<Leader>no"] = {
|
||||
function() require("zk").edit({ notebook_path = vim.g.wikidir }) end,
|
||||
desc = "Open Note"
|
||||
}
|
||||
maps.n["<Leader>ni"] = {
|
||||
function() require("zk").index({ notebook_path = vim.g.wikidir }) end,
|
||||
desc = "Index Notes"
|
||||
}
|
||||
end
|
||||
|
||||
-- Window Navigation --
|
||||
|
@ -180,7 +190,11 @@ if f.is_available("telescope.nvim") then
|
|||
maps.n["<Leader>fr"] = { function() require("telescope.builtin").registers() end, desc = "Find registers" }
|
||||
maps.n["<Leader>fw"] = { function() require("telescope.builtin").live_grep() end, desc = "Find words" }
|
||||
-- maps.n["<Leader>fb"] = { function() require("telescope.builtin").buffers() end, desc = "Find buffers" }
|
||||
maps.n["<Leader>ft"] = { function() require("telescope").extensions["todo-comments"].todo() end, desc = "Find buffers" }
|
||||
maps.n["<Leader>ft"] = {
|
||||
function() require("telescope").extensions["todo-comments"].todo() end,
|
||||
desc =
|
||||
"Find buffers"
|
||||
}
|
||||
maps.n["<Leader>fW"] = {
|
||||
function()
|
||||
require("telescope.builtin").live_grep({
|
||||
|
|
|
@ -16,7 +16,7 @@ conf.handlers["bashls"] = {
|
|||
}
|
||||
}
|
||||
|
||||
conf.required = { "lua_ls" }
|
||||
conf.required = { "lua_ls", "zk" }
|
||||
|
||||
conf.ignore = { "rust_analyzer" } -- This will be setup by rustacean.nvim
|
||||
return conf
|
||||
|
|
|
@ -2,6 +2,7 @@ local g = vim.g
|
|||
local o = vim.opt
|
||||
local d = vim.diagnostic.config
|
||||
|
||||
g.wikidir = os.getenv("XDG_DOCUMENTS_DIR") .. "/wiki"
|
||||
g.mapleader = " "
|
||||
g.maplocalleader = " "
|
||||
g.vim_json_conceal = 0
|
||||
|
|
|
@ -212,46 +212,46 @@ end
|
|||
function M.lsp_on_attach(client, bufnr)
|
||||
local lsp_mappings = M.empty_map_table()
|
||||
|
||||
lsp_mappings.n["<leader>ld"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }
|
||||
lsp_mappings.n["<Leader>ld"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }
|
||||
lsp_mappings.n["[d"] = { function() vim.diagnostic.goto_prev() end, desc = "Previous diagnostic" }
|
||||
lsp_mappings.n["]d"] = { function() vim.diagnostic.goto_next() end, desc = "Next diagnostic" }
|
||||
lsp_mappings.n["gl"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }
|
||||
|
||||
if M.is_available("telescope.nvim") then
|
||||
lsp_mappings.n["<leader>lD"] = {
|
||||
lsp_mappings.n["<Leader>lD"] = {
|
||||
function() require("telescope.builtin").diagnostics() end,
|
||||
desc = "Search diagnostics",
|
||||
}
|
||||
end
|
||||
|
||||
if M.is_available("mason-lspconfig.nvim") then
|
||||
lsp_mappings.n["<leader>li"] = { "<cmd>LspInfo<cr>", desc = "LSP information" }
|
||||
lsp_mappings.n["<Leader>li"] = { "<cmd>LspInfo<cr>", desc = "LSP information" }
|
||||
end
|
||||
|
||||
if M.is_available("none-ls.nvim") then
|
||||
lsp_mappings.n["<leader>lI"] = { "<cmd>NullLsInfo<cr>", desc = "Null-ls information" }
|
||||
lsp_mappings.n["<Leader>lI"] = { "<cmd>NullLsInfo<cr>", desc = "Null-ls information" }
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/codeAction") then
|
||||
lsp_mappings.n["<leader>la"] = {
|
||||
lsp_mappings.n["<Leader>la"] = {
|
||||
function() vim.lsp.buf.code_action() end,
|
||||
desc = "Code action",
|
||||
}
|
||||
lsp_mappings.v["<leader>la"] = lsp_mappings.n["<leader>la"]
|
||||
lsp_mappings.v["<Leader>la"] = lsp_mappings.n["<Leader>la"]
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/codeLens") then
|
||||
vim.lsp.codelens.refresh()
|
||||
lsp_mappings.n["<leader>ll"] = {
|
||||
lsp_mappings.n["<Leader>ll"] = {
|
||||
function() vim.lsp.codelens.refresh() end,
|
||||
desc = "Refresh CodeLens",
|
||||
}
|
||||
lsp_mappings.n["<leader>lL"] = {
|
||||
lsp_mappings.n["<Leader>lL"] = {
|
||||
function() vim.lsp.codelens.run() end,
|
||||
desc = "Run CodeLens",
|
||||
}
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<leader>uL"] = {
|
||||
lsp_mappings.n["<Leader>uL"] = {
|
||||
function() vim.lsp.codelens.clear() end,
|
||||
desc = "Toggle CodeLens"
|
||||
}
|
||||
|
@ -293,14 +293,14 @@ function M.lsp_on_attach(client, bufnr)
|
|||
end
|
||||
|
||||
if client.supports_method "workspace/symbol" then
|
||||
lsp_mappings.n["<leader>lG"] = {
|
||||
lsp_mappings.n["<Leader>lG"] = {
|
||||
function() vim.lsp.buf.workspace_symbol() end,
|
||||
desc = "List symbols"
|
||||
}
|
||||
end
|
||||
|
||||
if client.supports_method "textDocument/rename" then
|
||||
lsp_mappings.n["<leader>lr"] = {
|
||||
lsp_mappings.n["<Leader>lr"] = {
|
||||
function() vim.lsp.buf.rename() end,
|
||||
desc = "Rename symbol",
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
if client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens then
|
||||
vim.b[bufnr].semantic_tokens_enabled = true
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<leader>uY"] = {
|
||||
lsp_mappings.n["<Leader>uY"] = {
|
||||
function()
|
||||
vim.b[bufnr].semantic_tokens_enabled = not vim.b[bufnr].semantic_tokens_enabled
|
||||
for _, active_client in ipairs(vim.lsp.get_active_clients { bufnr = bufnr }) do
|
||||
|
@ -325,7 +325,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
end
|
||||
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
lsp_mappings.n["<leader>lf"] = {
|
||||
lsp_mappings.n["<Leader>lf"] = {
|
||||
function()
|
||||
vim.lsp.buf.format({
|
||||
filter = function(c)
|
||||
|
@ -343,7 +343,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
end,
|
||||
desc = "Format buffer",
|
||||
}
|
||||
lsp_mappings.v["<leader>lf"] = lsp_mappings.n["<leader>lf"]
|
||||
lsp_mappings.v["<Leader>lf"] = lsp_mappings.n["<Leader>lf"]
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/documentHighlight") then
|
||||
|
@ -383,7 +383,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
if vim.lsp.inlay_hint then
|
||||
if vim.b.inlay_hints_enabled then vim.lsp.inlay_hint.enable(bufnr, true) end
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<leader>uH"] = {
|
||||
lsp_mappings.n["<Leader>uH"] = {
|
||||
function()
|
||||
vim.b[bufnr].inlay_hints_enabled = not vim.b[bufnr].inlay_hints_enabled
|
||||
if vim.lsp.inlay_hint then
|
||||
|
@ -396,7 +396,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
end
|
||||
|
||||
if client.supports_method "textDocument/signatureHelp" then
|
||||
lsp_mappings.n["<leader>lh"] = {
|
||||
lsp_mappings.n["<Leader>lh"] = {
|
||||
function() vim.lsp.buf.signature_help() end,
|
||||
desc = "Signature help",
|
||||
}
|
||||
|
@ -412,14 +412,14 @@ function M.lsp_on_attach(client, bufnr)
|
|||
if lsp_mappings.n.gr then
|
||||
lsp_mappings.n.gr[1] = function() require("telescope.builtin").lsp_references() end
|
||||
end
|
||||
if lsp_mappings.n["<leader>lR"] then
|
||||
lsp_mappings.n["<leader>lR"][1] = function() require("telescope.builtin").lsp_references() end
|
||||
if lsp_mappings.n["<Leader>lR"] then
|
||||
lsp_mappings.n["<Leader>lR"][1] = function() require("telescope.builtin").lsp_references() end
|
||||
end
|
||||
if lsp_mappings.n.gy then
|
||||
lsp_mappings.n.gy[1] = function() require("telescope.builtin").lsp_type_definitions() end
|
||||
end
|
||||
if lsp_mappings.n["<leader>lG"] then
|
||||
lsp_mappings.n["<leader>lG"][1] = function()
|
||||
if lsp_mappings.n["<Leader>lG"] then
|
||||
lsp_mappings.n["<Leader>lG"][1] = function()
|
||||
vim.ui.input({ prompt = "Symbol Query: (leave empty for word under cursor)" }, function(query)
|
||||
if query then
|
||||
-- word under cursor if given query is empty
|
||||
|
@ -435,14 +435,14 @@ function M.lsp_on_attach(client, bufnr)
|
|||
end
|
||||
|
||||
if not vim.tbl_isempty(lsp_mappings.v) then
|
||||
if lsp_mappings.v["<leader>l"] then lsp_mappings.v["<leader>l"] = { desc = icons.Code .. " LSP" } end
|
||||
if lsp_mappings.v["<leader>u"] then lsp_mappings.v["<leader>u"] = { desc = icons.Code .. " LSP" } end
|
||||
if lsp_mappings.v["<Leader>l"] then lsp_mappings.v["<Leader>l"] = { desc = icons.Code .. " LSP" } end
|
||||
if lsp_mappings.v["<Leader>u"] then lsp_mappings.v["<Leader>u"] = { desc = icons.Code .. " LSP" } end
|
||||
end
|
||||
|
||||
M.set_maps(lsp_mappings, { buffer = bufnr })
|
||||
end
|
||||
|
||||
function M.has_value (table, value)
|
||||
function M.has_value(table, value)
|
||||
for _, v in ipairs(table) do
|
||||
if v == value then
|
||||
return true
|
||||
|
|
|
@ -25,5 +25,4 @@ return {
|
|||
require('plugins.misc.ufo'),
|
||||
require('plugins.misc.vimtex'),
|
||||
require('plugins.misc.which-key'),
|
||||
require('plugins.misc.wiki'),
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
local M = { "lervag/wiki.vim" }
|
||||
|
||||
M.cmd = {
|
||||
"WikiIndex",
|
||||
"WikiJournal",
|
||||
"WikiPages",
|
||||
"WikiTags",
|
||||
"WikiToc",
|
||||
"WikiTocGenerate",
|
||||
}
|
||||
|
||||
M.init = function()
|
||||
vim.g.wiki_root = "~/Documents/wiki"
|
||||
end
|
||||
|
||||
return M
|
Loading…
Reference in New Issue