Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 63 additions & 62 deletions .codebook.toml
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
words = [
"autocmd",
"bigfile",
"keymapdoc",
"bufferline",
"bufmap",
"bufnr",
"buftype",
"catppuccin",
"codelenses",
"copyfile",
"devenv",
"direnv",
"errnm",
"etype",
"filecopy",
"fileformat",
"filekey",
"fnamemodify",
"gitsigns",
"glab",
"globalstatus",
"gopls",
"hardlinks",
"inlinedoc",
"isdirectory",
"iswin",
"joinpath",
"justinmk",
"keymaps",
"lazygit",
"lnum",
"lpeg",
"luacheck",
"lualine",
"luarc",
"neotest",
"neovim",
"netrw",
"nvim",
"nvim's",
"oldfiles",
"performantly",
"pyproject",
"pyright",
"quickfile",
"readblob",
"realpath",
"relpath",
"ripgrep",
"scandir",
"startinsert",
"statuscolumn",
"statusline",
"stdpath",
"stylua",
"sysname",
"tabline",
"tmux",
"tst",
"unc",
"winbar",
"xdg",
"autocmd",
"bigfile",
"bufferline",
"bufmap",
"bufnr",
"buftype",
"catppuccin",
"codelenses",
"copyfile",
"devenv",
"direnv",
"errnm",
"etype",
"filecopy",
"fileformat",
"filekey",
"fnamemodify",
"gitsigns",
"glab",
"globalstatus",
"gopls",
"hardlinks",
"inlinedoc",
"isdirectory",
"iswin",
"joinpath",
"justinmk",
"keymapdoc",
"keymaps",
"lazygit",
"lnum",
"lpeg",
"luacheck",
"lualine",
"luarc",
"neotest",
"neovim",
"netrw",
"noremap",
"nvim",
"nvim's",
"oldfiles",
"performantly",
"pyproject",
"pyright",
"quickfile",
"readblob",
"realpath",
"relpath",
"ripgrep",
"scandir",
"startinsert",
"statuscolumn",
"statusline",
"stdpath",
"stylua",
"sysname",
"tabline",
"tmux",
"tst",
"unc",
"winbar",
"xdg",
]
21 changes: 0 additions & 21 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,8 @@
# https://devenv.sh/packages/
packages = [ pkgs.git ];

# https://devenv.sh/languages/
# languages.rust.enable = true;

# https://devenv.sh/processes/
# processes.dev.exec = "${lib.getExe pkgs.watchexec} -n -- ls -la";

# https://devenv.sh/services/
# services.postgres.enable = true;

# https://devenv.sh/scripts/
scripts.hello.exec = ''
echo hello from $GREET
'';

# https://devenv.sh/basics/
enterShell = ''
hello # Run scripts directly
git --version # Use packages
'';

Expand All @@ -38,9 +23,3 @@
echo "Running tests"
git --version | grep --color=auto "${pkgs.git.version}"
'';

# https://devenv.sh/git-hooks/
# git-hooks.hooks.shellcheck.enable = true;

# See full reference at https://devenv.sh/reference/options/
}
67 changes: 11 additions & 56 deletions lua/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,23 @@ local augroup = vim.api.nvim_create_augroup("UserConfig", { clear = true })
vim.filetype.add({
extension = {
tofu = "terraform",
-- Go templates (gopls + treesitter `gotmpl`).
gotmpl = "gotmpl",
tmpl = "gotmpl",
},
pattern = {
[".*%.tofu%.json"] = "json",
-- Helm chart templates (treesitter `helm`); only inside a chart, so other
-- templates/ dirs stay yaml.
[".*/templates/.*%.ya?ml"] = function(path)
return vim.fs.root(path, "Chart.yaml") and "helm" or nil
end,
[".*/templates/.*%.tpl"] = function(path)
return vim.fs.root(path, "Chart.yaml") and "helm" or nil
end,
},
})

-- Format on save (ONLY real file buffers, ONLY when efm is attached)
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
pattern = {
"*.lua",
"*.py",
"*.go",
"*.js",
"*.jsx",
"*.ts",
"*.tsx",
"*.json",
"*.css",
"*.scss",
"*.html",
"*.sh",
"*.bash",
"*.zsh",
"*.c",
"*.cpp",
"*.h",
"*.hpp",
},
callback = function(args)
-- avoid formatting non-file buffers (helps prevent weird write prompts)
if vim.bo[args.buf].buftype ~= "" then
return
end
if not vim.bo[args.buf].modifiable then
return
end
if vim.api.nvim_buf_get_name(args.buf) == "" then
return
end

local has_efm = false
for _, c in ipairs(vim.lsp.get_clients({ bufnr = args.buf })) do
if c.name == "efm" then
has_efm = true
break
end
end
if not has_efm then
return
end

pcall(vim.lsp.buf.format, {
bufnr = args.buf,
timeout_ms = 2000,
filter = function(c)
return c.name == "efm"
end,
})
end,
})

-- highlight yanked text
vim.api.nvim_create_autocmd("TextYankPost", {
group = augroup,
Expand Down
Loading
Loading