This commit is contained in:
Michael Thomson
2026-02-05 10:11:53 -05:00
parent 73fbc14e7a
commit 004ccccc35
11 changed files with 1170 additions and 634 deletions

View File

@@ -206,70 +206,50 @@ require('lze').load {
},
{
"nvim-treesitter",
enabled = nixCats('general') or false,
event = "DeferredUIEnter",
load = function (name)
vim.cmd.packadd(name)
vim.cmd.packadd("nvim-treesitter-textobjects")
end,
after = function (plugin)
require('nvim-treesitter.configs').setup {
highlight = { enable = true, },
indent = { enable = false, },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
lazy = false,
after = function(plugin)
---@param buf integer
---@param language string
local function treesitter_try_attach(buf, language)
-- check if parser exists and load it
if not vim.treesitter.language.add(language) then
return
end
-- enables syntax highlighting and other treesitter features
vim.treesitter.start(buf, language)
-- enables treesitter based folds
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
-- enables treesitter based indentation
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
local available_parsers = require("nvim-treesitter").get_available()
vim.api.nvim_create_autocmd("FileType", {
callback = function(args)
local buf, filetype = args.buf, args.match
local language = vim.treesitter.language.get_lang(filetype)
if not language then
return
end
local installed_parsers = require("nvim-treesitter").get_installed("parsers")
if vim.tbl_contains(installed_parsers, language) then
-- enable the parser if it is installed
treesitter_try_attach(buf, language)
elseif vim.tbl_contains(available_parsers, language) then
-- if a parser is available in `nvim-treesitter` enable it after ensuring it is installed
require("nvim-treesitter").install(language):await(function()
treesitter_try_attach(buf, language)
end)
else
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
treesitter_try_attach(buf, language)
end
end,
})
end,
},
{
@@ -598,6 +578,24 @@ require('lze').load {
})
end
},
{
"obsidian.nvim",
enabled = nixCats('notes') or false,
ft = {"md"},
after = function ()
require("obsidian").setup({
workspaces = {
{
name = "everything",
path = "~/vaults/everything"
},
},
daily_notes = {
folder = "journal"
},
})
end
},
{
"zk-nvim",
enabled = nixCats('notes') or false,
@@ -612,10 +610,15 @@ require('lze').load {
-- Create a new note after asking for its title.
vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts)
-- Create note from selection
vim.api.nvim_set_keymap("v", "<leader>znt", ":'<,'>ZkNewFromTitleSelection<CR>", opts)
-- Open notes.
vim.api.nvim_set_keymap("n", "<leader>zf", "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", opts)
-- Open notes associated with the selected tags.
vim.api.nvim_set_keymap("n", "<leader>zt", "<Cmd>ZkTags<CR>", opts)
-- show links in note
vim.api.nvim_set_keymap("n", "<leader>zl", "<Cmd>ZkLinks<CR>", opts)
-- Search for the notes matching a given query.
vim.api.nvim_set_keymap("n", "<leader>zg", "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>", opts)
@@ -624,11 +627,10 @@ require('lze').load {
end
},
{
"render-markdown.nvim",
"typst-preview.nvim",
enabled = nixCats('notes') or false,
ft = "markdown",
after = function ()
require('render-markdown').setup({})
require('typst-preview').setup({})
end
}
}
@@ -751,6 +753,11 @@ require('lze').load {
},
{
"tailwindcss",
enabled = false,
lsp = {},
},
{
"cssls",
enabled = nixCats('typescript') or false,
lsp = {},
},
@@ -783,6 +790,11 @@ require('lze').load {
-- filetypes = { "go", "gomod", "gowork", "gotmpl" },
},
},
{
"tinymist",
enabled = nixCats("notes") or false,
lsp = {},
},
{
"nixd",
enabled = nixCats('nix') or false,
@@ -793,16 +805,6 @@ require('lze').load {
nixpkgs = {
expr = nixCats.extra("nixdExtras.nixpkgs") or [[import <nixpkgs> {}]],
},
options = {
nixos = {
-- nixdExtras.nixos_options = ''(builtins.getFlake "path:${builtins.toString inputs.self.outPath}").nixosConfigurations.configname.options''
expr = nixCats.extra("nixdExtras.nixos_options")
},
["home-manager"] = {
-- nixdExtras.home_manager_options = ''(builtins.getFlake "path:${builtins.toString inputs.self.outPath}").homeConfigurations.configname.options''
expr = nixCats.extra("nixdExtras.home_manager_options")
}
},
formatting = {
command = { "alejandra" }
},