Merge commit '85165468f589dbb395b73f0cb17b758ac6fe33aa'

This commit is contained in:
2025-11-10 17:46:25 +01:00
38 changed files with 1388 additions and 144 deletions

View File

@@ -1 +1,3 @@
require("auto-session").setup({})
require("auto-session").setup({
auto_session_enabled = vim.env.KITTY_SCROLLBACK_NVIM ~= "true", -- See kitty-scrollback.nvim
})

View File

@@ -1,6 +1,6 @@
require("conform").setup({
format_on_save = {
lsp_fallback = true,
format_after_save = {
lsp_fallback = false,
async = false,
timeout_ms = 500,
},
@@ -16,14 +16,14 @@ require("conform").setup({
lua = { "stylua" }, -- configured in stylua.toml
markdown = { "prettierd", "prettier", stop_after_first = true },
nix = { "nixfmt" },
javascript = { "prettierd", "prettier", stop_after_first = true },
javascriptreact = { "prettierd", "prettier", stop_after_first = true },
javascript = { "eslint_d", "eslint", "prettierd", "prettier", stop_after_first = true },
javascriptreact = { "eslint_d", "eslint", "prettierd", "prettier", stop_after_first = true },
json = { "prettierd", "prettier", stop_after_first = true },
jsonc = { "prettierd", "prettier", stop_after_first = true },
python = { "isort", "black" },
svelte = { "prettierd", "prettier", stop_after_first = true },
typescript = { "prettierd", "prettier", stop_after_first = true },
typescriptreact = { "prettierd", "prettier", stop_after_first = true },
yaml = { "prettierd", "prettier", stop_after_first = true },
svelte = { "eslint_d", "prettierd", "prettier", stop_after_first = true },
typescript = { "eslint_d", "prettierd", "prettier", stop_after_first = true },
typescriptreact = { "eslint_d", "eslint", "prettierd", "prettier", stop_after_first = true },
-- yaml = { "prettierd", "prettier", stop_after_first = true },
},
})

View File

@@ -1,8 +1,12 @@
local gitsigns = require("gitsigns")
gitsigns.setup({
current_line_blame_opts = { delay = 0 },
current_line_blame_formatter = "<author>, <author_time:%R> - <summary>",
linehl = true,
current_line_blame_opts = {
delay = 0,
virt_text_pos = "right_align",
},
})
vim.api.nvim_create_user_command("Blame", gitsigns.toggle_current_line_blame, { nargs = "?" })

View File

@@ -0,0 +1 @@
require("kitty-scrollback").setup()

View File

@@ -1,7 +1,5 @@
require("neodev").setup() -- should setup before lspconfig
local lspconfig = require("lspconfig")
-- vim.g.coq_settings = { auto_start = 'shut-up' }
-- local capabilities = coq.lsp_ensure_capabilities()
@@ -34,7 +32,38 @@ local servers = {
},
},
},
lua_ls = {},
lua_ls = {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if
path ~= vim.fn.stdpath("config")
and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc"))
then
return
end
end
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
runtime = {
version = "LuaJIT",
path = {
"lua/?.lua",
"lua/?/init.lua",
},
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
},
},
})
end,
settings = {
Lua = {},
},
},
-- marksman = {},
nixd = {},
pyright = {},
@@ -104,9 +133,11 @@ local servers = {
for server, config in pairs(servers) do
config.capabilities = capabilities
lspconfig[server].setup(config)
vim.lsp.config(server, config)
end
vim.lsp.enable(vim.tbl_keys(servers))
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(e)
local opts = { buffer = e.bufnr }

View File

@@ -63,6 +63,7 @@ cmp.setup({
}),
sources = {
{ name = "copilot", group_index = 2 },
{ name = "zk" },
{ name = "nvim_lsp", keyword_length = 8 },
{ name = "luasnip", max_item_count = 16 },
{ name = "path" },

View File

@@ -1,6 +0,0 @@
vim.cmd([[
let g:taskwiki_taskrc_location='/home/h/.config/task/taskrc'
let g:taskwiki_disable_concealcursor=1
let g:taskwiki_dont_preserve_folds=1
let g:taskwiki_dont_fold=1
]])

View File

@@ -14,13 +14,6 @@ syn match Cloze /\({{c\d\+::\)\@<=\(\_[A-Za-z0-9$\ \\\-\*,_`()]*\)\(}}\)\@=/ con
hi! link ClozeDelimiter Special
hi! link Cloze Special
" Fix task UUIDs not being highlighted correctly in pandoc lists
syn match pandocUListItem /^>\=\s*[*+-]\s\+-\@!.*$/ nextgroup=pandocUListItem,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocDelimitedCodeBlock,pandocListItemContinuation contains=@Spell,pandocEmphasis,pandocStrong,pandocNoFormatted,pandocStrikeout,pandocSubscript,pandocSuperscript,pandocStrongEmphasis,pandocStrongEmphasis,pandocPCite,pandocICite,pandocCiteKey,pandocReferenceLabel,pandocLaTeXCommand,pandocLaTeXMathBlock,pandocLaTeXInlineMath,pandocEscapedDollar,pandocReferenceURL,pandocAutomaticLink,pandocFootnoteDef,pandocFootnoteBlock,pandocFootnoteID,pandocAmpersandEscape,TaskWikiTaskUuid skipempty display
syn match TaskWikiTaskUuid containedin=TaskWikiTask /\v#([A-Z]:)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/
syn match TaskWikiTaskUuid containedin=TaskWikiTask /\v#([A-Z]:)?[0-9a-fA-F]{8}$/
highlight link TaskWikiTaskUuid Comment
]])
vim.cmd.runtime("syntax/_comment_keywords.lua")

View File

@@ -8,5 +8,6 @@ vim.filetype.add({
[".*/%.ssh/config%.d/.*"] = "sshconfig",
["%.env.*"] = "dotenv",
["%.pl$"] = "prolog",
[".*.containerfile.*"] = "dockerfile",
},
})

View File

@@ -42,4 +42,5 @@ require("nixCatsUtils.catPacker").setup({
{ "zbirenbaum/copilot.lua" },
{ "zbirenbaum/copilot-cmp" },
{ "qvalentin/helm-ls.nvim", ft = "helm" },
{ "mikesmithgh/kitty-scrollback.nvim" },
})

View File

@@ -12,7 +12,6 @@ Plug 'quarto-dev/quarto-vim'
Plug 'lervag/vimtex'
" Wiki
Plug 'lervag/wiki.vim'
Plug 'hektor/taskwiki'
" Markdown
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'

View File

@@ -0,0 +1,11 @@
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufNewFile", {
pattern = "shell.nix",
command = "0r ~/.config/nvim/skeletons/shell.nix",
})
autocmd("BufNewFile", {
pattern = "flake.nix",
command = "0r ~/.config/nvim/skeletons/flake.nix",
})

View File

@@ -0,0 +1,49 @@
local cmp = require("cmp")
local source = {}
local function get_markdown_files(base)
local items = {}
local pattern = base .. "/**/*.md"
local files = vim.fn.glob(pattern, false, true)
for _, file in ipairs(files) do
local label = file:gsub("^%./", ""):gsub("%.md$", "")
table.insert(items, { label = label })
end
return items
end
function source:complete(params, callback)
local cursor_before_line = params.context.cursor_before_line
local cursor_after_line = params.context.cursor_after_line or ""
local trigger = cursor_before_line:match("%[[^%]]*%]%(([^)]*)$")
if trigger ~= nil then
local items = get_markdown_files(".")
local next_char = cursor_after_line:sub(1, 1)
for _, item in ipairs(items) do
if next_char == ")" then
item.insertText = item.label
else
item.insertText = item.label .. ")"
end
end
callback(items)
else
callback({})
end
end
function source:get_trigger_characters()
return { "(" }
end
function source:is_available()
local ft = vim.bo.filetype
return ft == "markdown" or ft == "pandoc"
end
cmp.register_source("zk", source)

View File

@@ -1,3 +1,5 @@
require("zk.cmp")
vim.cmd([[
let s:zk_preview_enabled = 0
let s:live_server_job = -1

View File

@@ -0,0 +1,10 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs =
{ self, nixpkgs }:
{
};
}

View File

@@ -0,0 +1,6 @@
{
pkgs ? import <nixpkgs> { },
}:
pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [ ];
}

View File

@@ -0,0 +1,12 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
return {
s({ trig = "^M.", regTrig = true, snippetType = "autosnippet" }, {
t("local M = {"),
i(1),
t({ "}", "", "", "return M" }),
}),
}

View File

@@ -700,10 +700,6 @@ local fmta = require("luasnip.extras.fmt").fmta
-- \`\`\`
-- endsnippet
--
-- snippet task "Task" i
-- * [ ] $1 -- pro:$2
-- endsnippet
--
-- snippet "(\b)fn(\d+)" "" ir
-- `!p snip.rv = snip.basename + "_" + match.group(2).zfill(2)`$1
-- endsnippet