added zk integration, again
This commit is contained in:
parent
f3b397adc1
commit
50cbee95d4
@ -25,9 +25,29 @@ function M.resolve_tsserver_deno(client)
|
|||||||
end
|
end
|
||||||
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)
|
function M.on_attach(client, bufnr)
|
||||||
M.disable_deno_formatting(client)
|
M.disable_deno_formatting(client)
|
||||||
M.resolve_tsserver_deno(client)
|
M.resolve_tsserver_deno(client)
|
||||||
|
M.disable_others_when_zk(client)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@ -11,9 +11,9 @@ return {
|
|||||||
["core.norg.dirman"] = {
|
["core.norg.dirman"] = {
|
||||||
config = {
|
config = {
|
||||||
workspaces = {
|
workspaces = {
|
||||||
work = "~/work",
|
work = "~/work/neorg/",
|
||||||
personal = "~/notes",
|
personal = "~/notes/neorg/",
|
||||||
journal = "~/notes/journal/",
|
journal = "~/notes/neorg/journal/",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -71,7 +71,7 @@ return {
|
|||||||
N = { name = "+noice" },
|
N = { name = "+noice" },
|
||||||
|
|
||||||
e = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
|
e = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
|
||||||
z = { "<cmd>ZenMode<cr>", "Zen" },
|
Z = { "<cmd>ZenMode<cr>", "Zen" },
|
||||||
u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" },
|
u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" },
|
||||||
["'"] = { "<cmd>close<CR>", "Close split" },
|
["'"] = { "<cmd>close<CR>", "Close split" },
|
||||||
|
|
||||||
@ -173,6 +173,13 @@ return {
|
|||||||
end,
|
end,
|
||||||
"Toggle conceal",
|
"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 = {
|
g = {
|
||||||
@ -191,6 +198,46 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
z = {
|
||||||
|
name = "+zk",
|
||||||
|
I = { "<cmd>ZkIndex<cr>", "Index Notebook" },
|
||||||
|
n = {
|
||||||
|
"+new",
|
||||||
|
n = { "<cmd>ZkNew { title = vim.fn.input('Title: ') }<cr>", "New Note (zk dir)" },
|
||||||
|
N = {
|
||||||
|
"<cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<cr>",
|
||||||
|
"New Note (cwd)",
|
||||||
|
},
|
||||||
|
t = {
|
||||||
|
"<cmd>ZkNewFromTitleSelection { title = vim.fn.input('Title: ') }<cr>",
|
||||||
|
"New, Title from selection (zk dir)",
|
||||||
|
},
|
||||||
|
T = {
|
||||||
|
"<cmd>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') title = vim.fn.input('Title: ') }<cr>",
|
||||||
|
"New, Title from selection (cwd)",
|
||||||
|
},
|
||||||
|
c = {
|
||||||
|
"<cmd>ZkNewFromContentSelection { title = vim.fn.input('Title: ') }<cr>",
|
||||||
|
"New, Content from selection (zk dir)",
|
||||||
|
},
|
||||||
|
C = {
|
||||||
|
"<cmd>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h') title = vim.fn.input('Title: ') }<cr>",
|
||||||
|
"New, Content from selection (cwd)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
c = { "<cmd>ZkCd<cr>", "cd 'root'" },
|
||||||
|
s = { "<cmd>ZkNotes<cr>", "List Notes" },
|
||||||
|
b = { "<cmd>ZkBacklinks<cr>", "Backlinks" },
|
||||||
|
l = { "<cmd>ZkLinks<cr>", "Links" },
|
||||||
|
j = {
|
||||||
|
"<cmd>ZkNew { dir = 'journal', date = 'today', title = vim.fn.input('Title: ') }<cr>",
|
||||||
|
"New Journal",
|
||||||
|
},
|
||||||
|
i = {
|
||||||
|
{ "<cmd>ZkInsertLink<cr>", "Insert Link" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
-- TODO: Add dap back into the project, bashbunni's dotfiles are a good resource.
|
-- TODO: Add dap back into the project, bashbunni's dotfiles are a good resource.
|
||||||
-- d = {
|
-- d = {
|
||||||
-- name = "Debug",
|
-- name = "Debug",
|
||||||
|
|||||||
32
.config/nvim/lua/lazyvim/plugins/zk.lua
Normal file
32
.config/nvim/lua/lazyvim/plugins/zk.lua
Normal file
@ -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,
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -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)
|
|
||||||
Loading…
Reference in New Issue
Block a user