diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 207b8c5..a9d1cc3 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -3,76 +3,77 @@ "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" }, - "blink.cmp": { "branch": "main", "commit": "b6f11a0aa33e601c469a126e3ed6e35208fe3ea3" }, + "blink.cmp": { "branch": "main", "commit": "dcda20d3aa345025699a920c45b0a0603551f41d" }, "blink.compat": { "branch": "main", "commit": "b0c87b64f9c669d3bcfaea8a80396fbc16e0fcb5" }, "cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" }, "cmp-pandoc.nvim": { "branch": "main", "commit": "30faa4456a7643c4cb02d8fa18438fd484ed7602" }, "cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" }, - "codecompanion.nvim": { "branch": "main", "commit": "8f4dd59db41eb7e1574dceb31ceee0631f49c5dc" }, + "codecompanion.nvim": { "branch": "main", "commit": "855c4bce42eca5209a0ef53f7a4188d78d520ed1" }, "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, - "copilot.vim": { "branch": "release", "commit": "cd7f01009fb7b30e22840cadc4faad88b05c6eef" }, + "copilot.vim": { "branch": "release", "commit": "5015939f131627a6a332c9e3ecad9a7cb4c2e549" }, "dial.nvim": { "branch": "master", "commit": "34bbd9c387c358190e61ce71017faad3dffa7a74" }, "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, "fidget.nvim": { "branch": "main", "commit": "b61e8af9b8b68ee0ec7da5fb7a8c203aae854f2e" }, "flash.nvim": { "branch": "main", "commit": "ec0bf2842189f65f60fd40bf3557cac1029cc932" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, - "fzf-lua": { "branch": "main", "commit": "9b84b53f3297d4912d7eb95b979e9b27e2e61281" }, + "fzf-lua": { "branch": "main", "commit": "15d5cd9a74da7f8739030a5c411c046c70f66a60" }, "git-conflict.nvim": { "branch": "main", "commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4" }, "gitsigns.nvim": { "branch": "main", "commit": "6668f379ca634c36b8e11453118590b91bf8b295" }, - "glance.nvim": { "branch": "master", "commit": "583dc1a6a3f86247d6ca4923b8961e0c27fd1c8c" }, - "grug-far.nvim": { "branch": "main", "commit": "0e391cc375702299b8dac101ff5a7d418fb193b9" }, - "helpview.nvim": { "branch": "main", "commit": "2bc021a2cf1e6ce103f95ceffc172cfefbbf9cfc" }, - "hererocks": { "branch": "master", "commit": "9e0989754de188ce9039ad3afe24fe4c5f174b76" }, + "glance.nvim": { "branch": "master", "commit": "cb19b86349cbe634eec0ea768b9a27fdd6d24f34" }, + "grug-far.nvim": { "branch": "main", "commit": "3e72486d0123d08f5b253847ab6e00ca12353242" }, + "helpview.nvim": { "branch": "main", "commit": "49e8d4782ae73274a35d606fde2844b6e958a0c7" }, "hunk.nvim": { "branch": "master", "commit": "b475ba0011e4b8ef7d7ddecd9764ee1a5f41366d" }, "image.nvim": { "branch": "master", "commit": "6ffafab2e98b5bda46bf227055aa84b90add8cdc" }, "img-clip.nvim": { "branch": "main", "commit": "0bb8b5ced45c2672c70184c87d014194b0705815" }, "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, - "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, "ltex_extra.nvim": { "branch": "dev", "commit": "09dc879b1873001f855bca5ad1f024ca15b9bbaf" }, "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, - "luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, + "magick": { "branch": "master", "commit": "aa96e77b6d08983707941727a574752445de0d70" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" }, - "mason-conform.nvim": { "branch": "main", "commit": "abce2be529f3b4b336c56d0ba6336a9144e0fee6" }, + "mason-conform.nvim": { "branch": "main", "commit": "1983f353b29d8716751665c18d57e1ac0473a59a" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, "mason-nvim-lint": { "branch": "main", "commit": "b579a00ee39dcd590b1023028dc8fb3d203a67b0" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "mdeval.nvim": { "branch": "master", "commit": "0e1b248db174a9659a9ab16eb8c90ff3aec55264" }, "mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" }, "molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" }, - "neo-tree.nvim": { "branch": "main", "commit": "e96fd85bf18bc345dab332b345098fa5460dffac" }, + "neo-tree.nvim": { "branch": "main", "commit": "16854ed5559b940f69a6f7138906ebb22c15c553" }, "neogen": { "branch": "main", "commit": "b2e78708876f4da507839726816010a68e33fec8" }, "neotest": { "branch": "master", "commit": "d66cf4e05a116957f0d3a7755a24291c7d1e1f72" }, "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, "nvim-FeMaco.lua": { "branch": "main", "commit": "96bbf843595dbe865838b3f2484b73557f34700c" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "943be69156b94fbc96064f4913d653f0c7fb299f" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, "nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" }, "nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, "nvim-lspconfig": { "branch": "master", "commit": "6b63bdf2399b9bedf93297d98419550523a9ad68" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, - "nvim-treesitter": { "branch": "master", "commit": "cfc6f2c117aaaa82f19bcce44deec2c194d900ab" }, + "nvim-treesitter": { "branch": "master", "commit": "8b79cddc708cb8549562f0101f7f509ad7cebf97" }, "nvim-treesitter-context": { "branch": "master", "commit": "198720b4016af04c9590f375d714d5bf8afecc1a" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "cb718aab7fa66e43187674e875713097492a6618" }, - "nvim-treesitter-textsubjects": { "branch": "master", "commit": "9de6c64c41dff29d353ebbedefd033996f29d349" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "143856b1cee509a190cc8c17ddb0638002171235" }, + "nvim-treesitter-textsubjects": { "branch": "master", "commit": "abcbb0e537c9c24800b03b9ca33bee5806604629" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, - "otter.nvim": { "branch": "main", "commit": "0e42fa795c35c7190935e3beda3791189c41bb72" }, + "otter.nvim": { "branch": "main", "commit": "34b0575c6eb2ca30eb064493bf93bccf608953c0" }, "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "quarto-nvim": { "branch": "main", "commit": "abc417c7e7422033f1090c0da5f30ef3ecb0c7ca" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "dc788723f717bdd3041838b8db34cce53c9aa920" }, - "render-markdown": { "branch": "main", "commit": "f2bdf9f866671456f7a6119cc94501048d9d172c" }, + "render-markdown": { "branch": "main", "commit": "a03ed82dfdeb1a4980093609ffe94c171ace8059" }, "smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" }, "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" }, "texpresso.vim": { "branch": "main", "commit": "907838c08bbf99ad6bed3c908f1d0551a92ab4e0" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "tree-sitter-nu": { "branch": "main", "commit": "c10340b5bb3789f69182acf8f34c3d4fc24d2fe1" }, "trouble.nvim": { "branch": "main", "commit": "748ca2789044607f19786b1d837044544c55e80a" }, "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" }, "typst-preview.nvim": { "branch": "master", "commit": "00ff6829030f302e8ff24d0e3a68625dd1a3ac40" }, diff --git a/nvim/.config/nvim/lua/core/init.lua b/nvim/.config/nvim/lua/core/init.lua index 577c6e5..8fc1b9b 100644 --- a/nvim/.config/nvim/lua/core/init.lua +++ b/nvim/.config/nvim/lua/core/init.lua @@ -1,5 +1,6 @@ for _, source in ipairs({ "core.settings", + "core.languages", "core.lazy", "core.commands", "core.mappings", diff --git a/nvim/.config/nvim/lua/core/languages.lua b/nvim/.config/nvim/lua/core/languages.lua new file mode 100644 index 0000000..ad2b5bb --- /dev/null +++ b/nvim/.config/nvim/lua/core/languages.lua @@ -0,0 +1,376 @@ +-- A list of all languages for which I have support for any of: +-- an LSP +-- Treesitter +-- linting +-- formatting +-- +-- with their respective names used by lspconfig, nvim-treesitter, nvim-lint and conform. +-- + +local nushell = { lsp = { nushell = {} }, ts = { "nu" } } +if vim.fn.executable("nufmt") == 1 then + nushell.format = {nu = {"nufmt"}} +end + +local languages = { + arduino = { lsp = { arduino_language_server = {} }, ts = { "arduino" } }, + awk = { ts = { "awk" }, format = { awk = { "gawk" } } }, + astro = { + lsp = { astro = {} }, + ts = { "astro" }, + lint = { astro = { "eslint_d" } }, + format = { astro = { + "prettier", + } }, + }, + bash = { + lsp = { bashls = {} }, + ts = { "bash" }, + lint = { bash = { "shellcheck" } }, + format = { bash = { "shellharden", "shfmt" } }, + }, + beancount = { lsp = { beancount = {} }, ts = { "beancount" }, format = { beancount = { "bean-format" } } }, + bibtex = { ts = { "bibtex" }, format = { bib = { "bibtex-tidy" } } }, + c = { lsp = { clangd = {} }, ts = { "c" } }, + css = { lsp = { cssls = {} }, ts = { "css" }, format = { css = { "prettier", "rustywind" } } }, + csv = { ts = { "csv" } }, + d = { lsp = { serve_d = {} }, ts = { "d" } }, + dart = { ts = { "dart" } }, + dhall = { ts = { "dhall" } }, + diff = { ts = { "diff" } }, + djot = { ts = { "djot" } }, + docker_compose = { lsp = { docker_compose_language_service = {} } }, + docker = { lsp = { dockerls = {} }, ts = { "dockerfile" } }, + dot = { ts = { "dot" } }, + emmet = { lsp = { emmet_ls = {} } }, + javascript = { + lsp = { eslint = {} }, + ts = { "javascript" }, + lint = { javascript = { "eslint_d" }, javascriptreact = { "eslint_d" } }, + format = { javascript = { "prettier" }, javascriptreact = { "prettier" } }, + }, + git = { ts = { "git_config", "git_rebase", "gitattributes", "gitcommit", "gitignore" } }, + go = { lsp = { gopls = {} }, ts = { "go" }, lint = { go = { "revive" } }, format = { go = { "gofumpt" } } }, + graphql = { format = { graphql = { "prettier" } } }, + html = { format = { html = { "prettier", "rustywind" } } }, + julia = { lsp = { julials = {} }, ts = { "julia" } }, + json = { + lsp = { jsonls = {} }, + ts = { "hjson", "json", "json5", "jsonc", "jsonnet" }, + format = { json = { "jq" } }, + }, + latex = { + -- TODO: May need to switch to ltex_plus at some point since ltex is unmaintained + lsp = { ltex = { autostart = false }, texlab = {} }, + ts = { "latex" }, + }, + lua = { + lsp = { + lua_ls = { + settings = { + Lua = { + diagnostics = { globals = { "vim" } }, + telemetry = { enable = false }, + hint = { enable = true, setType = true }, + }, + }, + }, + }, + ts = { "fennel", "luadoc", "luap", "luau" }, + format = { lua = { "stylua" } }, + }, + markdown = { + lsp = { marksman = {} }, + ts = { "markdown", "markdown_inline" }, + lint = { markdown = { "markdownlint" } }, + format = { markdown = { "prettier", "injected" } }, + }, + nim = { lsp = { nim_langserver = {} }, ts = { "nim", "nim_format_string" }, format = { nim = { "nimpretty" } } }, + nu = nushell, + python = { + lsp = { basedpyright = {}, ruff = {} }, + ts = { "python" }, + format = { python = { "ruff_format", "ruff_organize_imports" } }, + }, + quarto = { lint = { quarto = { "markdownlint" } }, format = { quarto = { "prettier", "injected" } } }, + sh = { lint = { sh = { "shellcheck" } }, format = { sh = { "shellharden", "shfmt" } } }, + sql = { format = { sql = { "sleek" } } }, + svelte = { lint = { svelte = { "eslint_d" } }, format = { svelte = { "prettier" } } }, + toml = { lsp = { taplo = {} }, ts = { "toml" } }, + typescript = { + lsp = { ts_ls = {} }, + ts = { "typescript" }, + lint = { typescript = { "eslint_d" }, typescriptreact = { "eslint_d" } }, + format = { typescript = { "prettier" }, typescriptreact = { "prettier" } }, + }, + typst = { lsp = { tinymist = { settings = { formatterMode = "typstyle" } } }, ts = { "typst" } }, + vue = { format = { vue = { "prettier", "rustywind" } } }, + yaml = { lsp = { yamlls = {}, ansiblels = {} }, ts = { "yaml" }, format = { yaml = { "prettier" } } }, + zsh = { format = { zsh = { "shfmt" } } }, + + -- TODO: For an easier migration from having 'all' in treesitter config + -- Should be migrated away from over time until it is completely removed + _additional_treesitters = { + ts = { + "cmake", + "comment", + "commonlisp", + "cooklang", + "corn", + "cpon", + "cpp", + "cuda", + "cue", + "cylc", + "desktop", + "devicetree", + "disassembly", + "doxygen", + "dtd", + "earthfile", + "ebnf", + "editorconfig", + "eds", + "eex", + "elixir", + "elm", + "elsa", + "elvish", + "embedded_template", + "enforce", + "erlang", + "facility", + "faust", + "fidl", + "firrtl", + "fish", + "foam", + "forth", + "fortran", + "fsh", + "fsharp", + "func", + "fusion", + "gap", + "gaptst", + "gdscript", + "gdshader", + "gleam", + "glimmer", + "glimmer_javascript", + "glimmer_typescript", + "glsl", + "gn", + "gnuplot", + "goctl", + "godot_resource", + "gomod", + "gosum", + "gotmpl", + "gowork", + "gpg", + "graphql", + "gren", + "groovy", + "gstlaunch", + "hack", + "hare", + "haskell", + "haskell_persistent", + "hcl", + "heex", + "helm", + "hlsl", + "hlsplaylist", + "hocon", + "hoon", + "html", + "htmldjango", + "http", + "hurl", + "hyprlang", + "idl", + "idris", + "ini", + "inko", + "ipkg", + "ispc", + "janet_simple", + "java", + "javascript", + "jinja", + "jinja_inline", + "jq", + "jsdoc", + "just", + "kcl", + "kconfig", + "kdl", + "kotlin", + "koto", + "kusto", + "lalrpop", + "ledger", + "leo", + "linkerscript", + "liquid", + "liquidsoap", + "llvm", + "luau", + "m68k", + "make", + "matlab", + "menhir", + "mermaid", + "meson", + "mlir", + "muttrc", + "nasm", + "nginx", + "nickel", + "ninja", + "nix", + "norg", + "nqc", + "nu", + "objc", + "objdump", + "ocaml", + "ocaml_interface", + "ocamllex", + "odin", + "pascal", + "passwd", + "pem", + "perl", + "php", + "php_only", + "phpdoc", + "pioasm", + "po", + "pod", + "poe_filter", + "pony", + "powershell", + "printf", + "prisma", + "problog", + "prolog", + "promql", + "properties", + "proto", + "prql", + "psv", + "pug", + "puppet", + "purescript", + "pymanifest", + "python", + "ql", + "qmldir", + "qmljs", + "query", + "r", + "racket", + "ralph", + "rasi", + "razor", + "rbs", + "re2c", + "readline", + "regex", + "rego", + "requirements", + "rescript", + "rnoweb", + "robot", + "robots", + "roc", + "ron", + "rst", + "ruby", + "runescript", + "rust", + "scala", + "scfg", + "scheme", + "scss", + "sflog", + "slang", + "slim", + "slint", + "smali", + "smithy", + "snakemake", + "solidity", + "soql", + "sosl", + "sourcepawn", + "sparql", + "sql", + "squirrel", + "ssh_config", + "starlark", + "strace", + "styled", + "supercollider", + "superhtml", + "surface", + "svelte", + "sway", + "swift", + "sxhkdrc", + "systemtap", + "t32", + "tablegen", + "tact", + "tcl", + "teal", + "templ", + "tera", + "terraform", + "textproto", + "thrift", + "tiger", + "tlaplus", + "tmux", + "todotxt", + "tsv", + "tsx", + "turtle", + "twig", + "typespec", + "typoscript", + "udev", + "ungrammar", + "unison", + "usd", + "uxntal", + "v", + "vala", + "vento", + "verilog", + "vhdl", + "vhs", + "vim", + "vimdoc", + "vrl", + "vue", + "wgsl", + "wgsl_bevy", + "wing", + "wit", + "xcompose", + "xml", + "xresources", + "yang", + "yuck", + "zathurarc", + "zig", + "ziggy", + "ziggy_schema", + }, + }, +} + +Languages = languages diff --git a/nvim/.config/nvim/lua/plugins/base.lua b/nvim/.config/nvim/lua/plugins/base.lua index 4cecdab..da44839 100644 --- a/nvim/.config/nvim/lua/plugins/base.lua +++ b/nvim/.config/nvim/lua/plugins/base.lua @@ -82,6 +82,24 @@ return { }, }, + -- generic tool installer; automatic external dependency mgmt for neovim + -- used in my config for LSPs, formatters and linters + { + "williamboman/mason.nvim", + cmd = { + "Mason", + "MasonInstall", + "MasonUninstall", + "MasonUninstallAll", + "MasonLog", + "MasonUpdate", + }, + opts = {}, + build = ":MasonUpdate", + keys = { + { "vm", ":Mason", desc = "Mason" }, + }, + }, -- personal dict improvements for git sync { "micarmst/vim-spellsync", event = "VeryLazy" }, { diff --git a/nvim/.config/nvim/lua/plugins/completion.lua b/nvim/.config/nvim/lua/plugins/completion.lua index ef0d3a1..7b39561 100644 --- a/nvim/.config/nvim/lua/plugins/completion.lua +++ b/nvim/.config/nvim/lua/plugins/completion.lua @@ -1,7 +1,6 @@ return { -- full documentation here: https://cmp.saghen.dev/ "saghen/blink.cmp", - version = "0.11.x", dependencies = { "saghen/blink.compat", "rafamadriz/friendly-snippets", diff --git a/nvim/.config/nvim/lua/plugins/data_analysis.lua b/nvim/.config/nvim/lua/plugins/data_analysis.lua index 95180e3..b4d7fc8 100644 --- a/nvim/.config/nvim/lua/plugins/data_analysis.lua +++ b/nvim/.config/nvim/lua/plugins/data_analysis.lua @@ -58,13 +58,7 @@ return { "3rd/image.nvim", version = false, dependencies = { - { - "vhyrro/luarocks.nvim", - priority = 1001, -- this plugin needs to run before anything else - opts = { - rocks = { "magick" }, - }, - }, + { "leafo/magick" }, -- luarock, ensure global luarock51 dependency { "nvim-treesitter/nvim-treesitter", optional = true }, }, opts = { diff --git a/nvim/.config/nvim/lua/plugins/formatting.lua b/nvim/.config/nvim/lua/plugins/formatting.lua index c382f80..e91cfcd 100644 --- a/nvim/.config/nvim/lua/plugins/formatting.lua +++ b/nvim/.config/nvim/lua/plugins/formatting.lua @@ -1,36 +1,20 @@ -local formatters = { - angular = { "prettier" }, - astro = { "prettier" }, - bash = { "shfmt" }, - bib = { "bibtex-tidy" }, - css = { "prettier", "rustywind" }, - go = { "gofumpt" }, - graphql = { "prettier" }, - html = { "prettier", "rustywind" }, - javascript = { "prettier" }, - javascriptreact = { "prettier" }, - json = { "jq" }, - liquid = { "prettier" }, - lua = { "stylua" }, - markdown = { "prettier", "injected" }, - nim = { "nimpretty" }, - python = { "ruff_format", "ruff_organize_imports" }, - quarto = { "prettier", "injected" }, - sh = { "shfmt" }, - sql = { "sleek" }, - svelte = { "prettier" }, - typescript = { "prettier" }, - typescriptreact = { "prettier" }, - vue = { "prettier", "rustywind" }, - yaml = { "prettier" }, - zsh = { "shfmt" }, -} +local formatters = {} +for _, lang in pairs(Languages) do + if not lang.format then + goto continue + end + for ft, val in pairs(lang.format) do + formatters[ft] = val + end + ::continue:: +end return { -- formatting setup { "zapling/mason-conform.nvim", dependencies = { + { "williamboman/mason.nvim" }, { "stevearc/conform.nvim", config = function() diff --git a/nvim/.config/nvim/lua/plugins/linting.lua b/nvim/.config/nvim/lua/plugins/linting.lua index d522558..6a14c4c 100644 --- a/nvim/.config/nvim/lua/plugins/linting.lua +++ b/nvim/.config/nvim/lua/plugins/linting.lua @@ -1,23 +1,20 @@ -local linters = { - astro = { "eslint_d" }, - bash = { "shellcheck" }, - javascript = { "eslint_d" }, - javascriptreact = { "eslint_d" }, - go = { "revive" }, - markdown = { "markdownlint" }, - quarto = { "markdownlint" }, - sh = { "shellcheck" }, - svelte = { "eslint_d" }, - text = {}, - typescript = { "eslint_d" }, - typescriptreact = { "eslint_d" }, -} +local linters = {} +for _, lang in pairs(Languages) do + if not lang.lint then + goto continue + end + for ft, val in pairs(lang.lint) do + linters[ft] = val + end + ::continue:: +end return { -- linting setup { "rshkarin/mason-nvim-lint", dependencies = { + { "williamboman/mason.nvim" }, { "mfussenegger/nvim-lint", config = function() diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index b34336f..28ac9a4 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -1,48 +1,13 @@ -local servers = { - ansiblels = {}, - arduino_language_server = {}, - astro = {}, - bashls = {}, - beancount = {}, - clangd = {}, - cssls = {}, - docker_compose_language_service = {}, - dockerls = {}, - emmet_ls = {}, - eslint = {}, - gopls = {}, - julials = {}, - jsonls = {}, - ltex = { autostart = false }, - lua_ls = { - settings = { - Lua = { - diagnostics = { globals = { "vim" } }, - -- enable when working on neovim stuff. Takes *long* to load - -- workspace = { library = vim.api.nvim_get_runtime_file("", true) }, - telemetry = { enable = false }, - hint = { - enable = true, - setType = true, - }, - }, - }, - }, - marksman = {}, - nim_langserver = {}, - basedpyright = {}, - ruff = {}, - serve_d = {}, - taplo = {}, - texlab = {}, - tinymist = { - settings = { - formatterMode = "typstyle", - }, - }, - ts_ls = {}, - yamlls = {}, -} +local servers = {} +for _, lang in pairs(Languages) do + if not lang.lsp then + goto continue + end + for name, conf in pairs(lang.lsp) do + servers[name] = conf + end + ::continue:: +end local lsp = { { -- pretty lsp 'peek' menus @@ -56,22 +21,7 @@ local lsp = { { "williamboman/mason-lspconfig.nvim", opts = { automatic_installation = true }, - dependencies = { - "williamboman/mason.nvim", - cmd = { - "Mason", - "MasonInstall", - "MasonUninstall", - "MasonUninstallAll", - "MasonLog", - "MasonUpdate", - }, - opts = {}, - build = ":MasonUpdate", - keys = { - { "vm", ":Mason", desc = "Mason" }, - }, - }, + dependencies = { "williamboman/mason.nvim" }, cmd = { "LspInstall", "LspUninstall" }, }, { "saghen/blink.cmp", optional = true }, diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index 04a0844..7d502ec 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -168,7 +168,7 @@ local prose_plugs = { -- bring zettelkasten commands { "zk-org/zk-nvim", - opts = function() + config = function() if require("core.util").is_available("which-key") then require("which-key").add({ { "n", group = "notes" }, @@ -214,7 +214,7 @@ local prose_plugs = { lsp = { auto_attach = { enabled = true, - filteypes = { "markdown", "quarto" }, + filteypes = { "markdown", "quarto", "djot" }, }, }, }) diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 8ed1ff5..7b274a0 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -5,7 +5,9 @@ return { -- show current cursor context at top of buffer -- improves commenting plugin above by using ts dependencies = { - { "romgrk/nvim-treesitter-context", config = true }, + { "nvim-treesitter/nvim-treesitter-textobjects" }, + -- nice context on top of buffer + { "nvim-treesitter/nvim-treesitter-context", opts = { max_lines = 3 } }, "JoosepAlviste/nvim-ts-context-commentstring", "RRethy/nvim-treesitter-textsubjects", "windwp/nvim-ts-autotag", @@ -17,11 +19,26 @@ return { require("rainbow-delimiters.setup").setup({}) end, }, + { "nushell/tree-sitter-nu", version = false }, }, + version = false, -- TODO: Can be set to versioned if new version after 2024-12-12 is released config = function() + local enabled_parsers = {} + for _, lang in pairs(Languages) do + if not lang.ts then + goto continue + end + for _, name in pairs(lang.ts) do + table.insert(enabled_parsers,name) + end + ::continue:: + end + ---@diagnostic disable-next-line: missing-fields (seems an issue in the diagnostic) require("nvim-treesitter.configs").setup({ -- one of "all", "maintained" (parsers with maintainers), or a list of languages - ensure_installed = "all", + ensure_installed = enabled_parsers, + ignore_install = {}, + sync_install = false, auto_install = true, highlight = { enable = true, @@ -38,8 +55,36 @@ return { end, additional_vim_regex_highlighting = false, }, - incremental_selection = { enable = true }, - textobjects = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + textobjects = { + select = { + enable = true, + -- TODO: CHECK IF ANY CONFLICTING WITH MINI AI!! + -- supported in other languages as well + keymaps = { + ["aF"] = { query = "@function.outer", desc = "function outer" }, + ["iF"] = { query = "@function.inner", desc = "function inner" }, + ["aL"] = { query = "@loop.outer", desc = "loop outer" }, + ["iL"] = { query = "@loop.inner", desc = "loop inner" }, + ["aC"] = { query = "@conditional.outer", desc = "conditional inner" }, + ["iC"] = { query = "@conditional.inner", desc = "conditional inner" }, + ["aS"] = { query = "@statement.outer", desc = "statement outer" }, + ["iS"] = { query = "@statement.inner", desc = "statement inner" }, + + -- Nushell only + ["aP"] = { query = "@pipeline.outer", desc = "pipeline outer" }, + ["iP"] = { query = "@pipeline.inner", desc = "pipeline inner" }, + }, + }, + }, indent = { enable = true }, autotag = { enable = true }, @@ -65,19 +110,6 @@ return { nu = "# %s", }, }) - - -- treesitter parser for nushell. To fully get e.g. syntax highlight - -- working you need a highlight file too. For now I installed manually, see: - -- https://github.com/nushell/tree-sitter-nu/blob/main/installation/neovim.md - local parser_config = require("nvim-treesitter.parsers").get_parser_configs() - parser_config.nu = { - install_info = { - url = "https://github.com/nushell/tree-sitter-nu", - files = { "src/parser.c" }, - branch = "main", - }, - filetype = "nu", - } end, event = { "VeryLazy" }, cmd = { diff --git a/office/.local/share/task/hooks/on-exit.git-backup b/office/.local/share/task/hooks/on-exit.git-backup index eb4d96b..e80cbe2 100755 --- a/office/.local/share/task/hooks/on-exit.git-backup +++ b/office/.local/share/task/hooks/on-exit.git-backup @@ -7,7 +7,7 @@ # The minimum amount of time required between 2 commits in seconds. # So only if the last commit is at least x seconds old will a new one # be created. Set to 0 to sync each taskwarrior change. -MINIMUM_WAIT_TIME=600 +MINIMUM_WAIT_TIME=60 # Do not display status information. QUIET=true @@ -16,8 +16,13 @@ QUIET=true # task directory clean. REMOVE_JSON=false +# Sort with `jq` commandline program if it is found. +# Also drops extra values 'urgency' and 'id' which are not +# necessary for backups and automatically calculated by tw. +STABLE_JSON=true + if [ "${DISABLE_HOOKS}" = "true" ] || ! command -v git >/dev/null 2>&1; then - exit 0; + exit 0 fi if [ "$1" != "api:2" ]; then @@ -25,7 +30,6 @@ if [ "$1" != "api:2" ]; then exit 1 fi - data_dir="$(echo "$5" | cut -f2 -d:)" command_run="$(echo "$3" | cut -f2 -d:)" @@ -37,7 +41,7 @@ if [ "$command_run" = "synchronize" ]; then git -C "$data_dir" push >/dev/null 2>&1 push_ret="$?" if [ "$pull_ret" -eq 0 ] && [ "$push_ret" -eq 0 ]; then - [ $QUIET = "true" ] || echo "Git upstream synchronized." + [ $QUIET = "true" ] || echo "Git upstream synchronized." fi fi @@ -50,7 +54,12 @@ if [ "$(date "+%s")" -lt $((last_commit + MINIMUM_WAIT_TIME)) ]; then fi # echo "EXPORTING TASKS" -DISABLE_HOOKS=true env task export > "$data_dir/tasks.json" +if [ "$STABLE_JSON" = true ] && command -v jq >/dev/null 2>&1; then + DISABLE_HOOKS=true env task export | jq -S 'map(del(.id, .urgency)) | sort_by(.entry, .modified) | reverse' >"$data_dir/tasks.json" +else + DISABLE_HOOKS=true env task export >"$data_dir/tasks.json" +fi + # after any command, if there's changes add and commit if ! git -C "$data_dir" diff --exit-code >/dev/null 2>&1; then # echo "found changes" @@ -62,4 +71,7 @@ if ! git -C "$data_dir" diff --exit-code >/dev/null 2>&1; then git -C "$data_dir" commit "$data_dir/tasks.json" -m "$header" -m "$msg" --no-gpg-sign >/dev/null 2>&1 [ $QUIET = "true" ] || echo "Backup up to git." fi -[ "$REMOVE_JSON" = true ] && rm "$data_dir/tasks.json" >/dev/null 2>&1 + +if [ "$REMOVE_JSON" = true ] && [ -f "$data_dir/tasks.json" ]; then + rm "$data_dir/tasks.json" >/dev/null 2>&1 +fi diff --git a/terminal/.config/atuin/config.toml b/terminal/.config/atuin/config.toml new file mode 100644 index 0000000..9ac07ab --- /dev/null +++ b/terminal/.config/atuin/config.toml @@ -0,0 +1,75 @@ +## which search mode to use +## possible values: prefix, fulltext, fuzzy, skim +# search_mode = "fuzzy" + +## which filter mode to use +## possible values: global, host, session, directory +# filter_mode = "global" + +# Enable 'workspace' filtering if we are in a git dir +workspaces = true + +# don't always update timestamps etc +prefers_reduced_motion = true + +# don't waste a line +show_tabs = false + +# enter vi normal/insert mode automatically +keymap_mode = "auto" + +## which filter mode to use when atuin is invoked from a shell up-key binding +## the accepted values are identical to those of "filter_mode" +## leave unspecified to use same mode set in "filter_mode" +filter_mode_shell_up_key_binding = "session" + +## which search mode to use when atuin is invoked from a shell up-key binding +## the accepted values are identical to those of "search_mode" +## leave unspecified to use same mode set in "search_mode" +# search_mode_shell_up_key_binding = "fuzzy" + +## which style to use +## possible values: auto, full, compact +style = "compact" + +## prevent commands matching any of these regexes from being written to history. +## Note that these regular expressions are unanchored, i.e. if they don't start +## with ^ or end with $, they'll match anywhere in the command. +## For details on the supported regular expression syntax, see +## https://docs.rs/regex/latest/regex/#syntax +history_filter = [ + "^pass" + # "^secret-cmd", + # "^innocuous-cmd .*--secret=.+" +] + +## prevent commands run with cwd matching any of these regexes from being written +## to history. Note that these regular expressions are unanchored, i.e. if they don't +## start with ^ or end with $, they'll match anywhere in CWD. +## For details on the supported regular expression syntax, see +## https://docs.rs/regex/latest/regex/#syntax +# cwd_filter = [ +# "^/very/secret/area" +# ] + +## Configure whether or not to show the help row, which includes the current Atuin +## version (and whether an update is available), a keymap hint, and the total +## amount of commands in your history. +# show_help = true + +enter_accept = true + +#[stats] +# Set commands where we should consider the subcommand for statistics. Eg, kubectl get vs just kubectl +#common_subcommands = [ +# "cargo", +# "go", +# "git", +# "npm", +# "yarn", +# "pnpm", +# "kubectl", +#] +# +# Set commands that should be totally stripped and ignored from stats +#common_prefix = ["sudo"] diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index 4ea3a50..72e382c 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -1,769 +1,69 @@ -# Nushell Config File +# config.nu # -# version = "0.87.1" +# Installed by: +# version = "0.102.0" +# +# This file is used to override default Nushell settings, define +# (or import) custom commands, or run any other startup tasks. +# See https://www.nushell.sh/book/configuration.html +# +# This file is loaded after env.nu and before login.nu +# +$env.config.show_banner = true # TODO: FOR TESTING PURPOSES -# For more information on defining custom themes, see -# https://www.nushell.sh/book/coloring_and_theming.html -# And here is the theme collection -# https://github.com/nushell/nu_scripts/tree/main/themes -let dark_theme = { - # color for nushell primitives - separator: white - leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off - header: green_bold - empty: blue - # Closures can be used to choose colors for specific values. - # The value (in this case, a bool) is piped into the closure. - # eg) {|| if $in { 'light_cyan' } else { 'light_gray' } } - bool: light_cyan - int: white - filesize: cyan - duration: white - date: purple - range: white - float: white - string: white - nothing: white - binary: white - cell-path: white - row_index: green_bold - record: white - list: white - block: white - hints: dark_gray - search_result: {bg: red fg: white} - shape_and: purple_bold - shape_binary: purple_bold - shape_block: blue_bold - shape_bool: light_cyan - shape_closure: green_bold - shape_custom: green - shape_datetime: cyan_bold - shape_directory: cyan - shape_external: cyan - shape_externalarg: green_bold - shape_filepath: cyan - shape_flag: blue_bold - shape_float: purple_bold - # shapes are used to change the cli syntax highlighting - shape_garbage: { fg: white bg: red attr: b} - shape_globpattern: cyan_bold - shape_int: purple_bold - shape_internalcall: cyan_bold - shape_keyword: cyan_bold - shape_list: cyan_bold - shape_literal: blue - shape_match_pattern: green - shape_matching_brackets: { attr: u } - shape_nothing: light_cyan - shape_operator: yellow - shape_or: purple_bold - shape_pipe: purple_bold - shape_range: yellow_bold - shape_record: cyan_bold - shape_redirection: purple_bold - shape_signature: green_bold - shape_string: green - shape_string_interpolation: cyan_bold - shape_table: blue_bold - shape_variable: purple - shape_vardecl: purple -} +$env.config.edit_mode = "vi" +$env.config.buffer_editor = "nvim" -let light_theme = { - # color for nushell primitives - separator: dark_gray - leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off - header: green_bold - empty: blue - # Closures can be used to choose colors for specific values. - # The value (in this case, a bool) is piped into the closure. - # eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } } - bool: dark_cyan - int: dark_gray - filesize: cyan_bold - duration: dark_gray - date: purple - range: dark_gray - float: dark_gray - string: dark_gray - nothing: dark_gray - binary: dark_gray - cell-path: dark_gray - row_index: green_bold - record: dark_gray - list: dark_gray - block: dark_gray - hints: dark_gray - search_result: {fg: white bg: red} - shape_and: purple_bold - shape_binary: purple_bold - shape_block: blue_bold - shape_bool: light_cyan - shape_closure: green_bold - shape_custom: green - shape_datetime: cyan_bold - shape_directory: cyan - shape_external: cyan - shape_externalarg: green_bold - shape_filepath: cyan - shape_flag: blue_bold - shape_float: purple_bold - # shapes are used to change the cli syntax highlighting - shape_garbage: { fg: white bg: red attr: b} - shape_globpattern: cyan_bold - shape_int: purple_bold - shape_internalcall: cyan_bold - shape_keyword: cyan_bold - shape_list: cyan_bold - shape_literal: blue - shape_match_pattern: green - shape_matching_brackets: { attr: u } - shape_nothing: light_cyan - shape_operator: yellow - shape_or: purple_bold - shape_pipe: purple_bold - shape_range: yellow_bold - shape_record: cyan_bold - shape_redirection: purple_bold - shape_signature: green_bold - shape_string: green - shape_string_interpolation: cyan_bold - shape_table: blue_bold - shape_variable: purple - shape_vardecl: purple -} - -# External completer example -# let carapace_completer = {|spans| -# carapace $spans.0 nushell $spans | from json -# } - -# The default config record. This is where much of your global configuration is setup. -$env.config = { - show_banner: false # true or false to enable or disable the welcome banner at startup - - ls: { - use_ls_colors: true # use the LS_COLORS environment variable to colorize output - clickable_links: true # enable or disable clickable links. Your terminal has to support links. - } - - rm: { - always_trash: false # always act as if -t was given. Can be overridden with -p - } - - table: { - mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other - index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column - show_empty: true # show 'empty list' and 'empty record' placeholders for command output - padding: { left: 1, right: 1 } # a left right padding of each column in a table - trim: { - methodology: wrapping # wrapping or truncating - wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology - truncating_suffix: "..." # A suffix used by the 'truncating' methodology - } - header_on_separator: false # show header text on separator/border line - # abbreviated_row_count: 10 # limit data rows from top and bottom after reaching a set point - } - - error_style: "fancy" # "fancy" or "plain" for screen reader-friendly error messages - - # datetime_format determines what a datetime rendered in the shell would look like. - # Behavior without this configuration point will be to "humanize" the datetime display, - # showing something like "a day ago." - datetime_format: { - # normal: '%a, %d %b %Y %H:%M:%S %z' # shows up in displays of variables or other datetime's outside of tables - # table: '%m/%d/%y %I:%M:%S%p' # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format - } - - explore: { - status_bar_background: {fg: "#1D1F21", bg: "#C4C9C6"}, - command_bar_text: {fg: "#C4C9C6"}, - highlight: {fg: "black", bg: "yellow"}, - status: { - error: {fg: "white", bg: "red"}, - warn: {} - info: {} - }, - table: { - split_line: {fg: "#404040"}, - selected_cell: {bg: light_blue}, - selected_row: {}, - selected_column: {}, - }, - } - - history: { - max_size: 100_000 # Session has to be reloaded for this to take effect - sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file - file_format: "plaintext" # "sqlite" or "plaintext" - isolation: false # only available with sqlite file_format. true enables history isolation, false disables it. true will allow the history to be isolated to the current session using up/down arrows. false will allow the history to be shared across all sessions. - } - - completions: { - case_sensitive: false # set to true to enable case-sensitive completions - quick: true # set this to false to prevent auto-selecting completions when only one remains - partial: true # set this to false to prevent partial filling of the prompt - algorithm: "fuzzy" # prefix or fuzzy - external: { - enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow - max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options - completer: null # check 'carapace_completer' above as an example - } - } - - filesize: { - metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard) - format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto - } - - cursor_shape: { - emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (line is the default) - vi_insert: line # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (block is the default) - vi_normal: block # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (underscore is the default) - } - - color_config: $dark_theme # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record - use_grid_icons: true - footer_mode: "25" # always, never, number_of_rows, auto - float_precision: 2 # the precision for displaying floats in tables - buffer_editor: "" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL - use_ansi_coloring: true - bracketed_paste: true # enable bracketed paste, currently useless on windows - edit_mode: vi # emacs, vi - shell_integration: true # enables terminal shell integration. Off by default, as some terminals have issues with this. - render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. - use_kitty_protocol: false # enables keyboard enhancement protocol implemented by kitty console, only if your terminal support this - - hooks: { - pre_prompt: [{ null }] # run before the prompt is shown - pre_execution: [{ null }] # run before the repl input is run - env_change: { - PWD: [{|before, after| null }] # run if the PWD environment is different since the last repl input - } - display_output: "if (term size).columns >= 100 { table -e } else { table }" # run to display the output of a pipeline - command_not_found: { null } # return an error message when a command is not found - } - - menus: [ - # Configuration for default nushell menus - # Note the lack of source parameter - { - name: completion_menu - only_buffer_difference: false - marker: "| " - type: { - layout: columnar - columns: 4 - col_width: 20 # Optional value. If missing all the screen width is used to calculate column width - col_padding: 2 - } - style: { - text: green - selected_text: green_reverse - description_text: yellow - } - } - { - name: history_menu - only_buffer_difference: true - marker: "? " - type: { - layout: list - page_size: 10 - } - style: { - text: green - selected_text: green_reverse - description_text: yellow - } - } - { - name: help_menu - only_buffer_difference: true - marker: "? " - type: { - layout: description - columns: 4 - col_width: 20 # Optional value. If missing all the screen width is used to calculate column width - col_padding: 2 - selection_rows: 4 - description_rows: 10 - } - style: { - text: green - selected_text: green_reverse - description_text: yellow - } - } - ] - - keybindings: [ - { - name: completion_menu - modifier: none - keycode: tab - mode: [emacs vi_normal vi_insert] - event: { - until: [ - { send: menu name: completion_menu } - { send: menunext } - { edit: complete } - ] - } - } - { - name: history_menu - modifier: control - keycode: char_r - mode: [emacs, vi_insert, vi_normal] - event: { send: menu name: history_menu } - } - { - name: help_menu - modifier: none - keycode: f1 - mode: [emacs, vi_insert, vi_normal] - event: { send: menu name: help_menu } - } - { - name: completion_previous_menu - modifier: shift - keycode: backtab - mode: [emacs, vi_normal, vi_insert] - event: { send: menuprevious } - } - { - name: next_page_menu - modifier: control - keycode: char_x - mode: emacs - event: { send: menupagenext } - } - { - name: undo_or_previous_page_menu - modifier: control - keycode: char_z - mode: emacs - event: { - until: [ - { send: menupageprevious } - { edit: undo } - ] - } - } - { - name: escape - modifier: none - keycode: escape - mode: [emacs, vi_normal, vi_insert] - event: { send: esc } # NOTE: does not appear to work - } - { - name: cancel_command - modifier: control - keycode: char_c - mode: [emacs, vi_normal, vi_insert] - event: { send: ctrlc } - } - { - name: quit_shell - modifier: control - keycode: char_d - mode: [emacs, vi_normal, vi_insert] - event: { send: ctrld } - } - { - name: clear_screen - modifier: control - keycode: char_l - mode: [emacs, vi_normal, vi_insert] - event: { send: clearscreen } - } - { - name: search_history - modifier: control - keycode: char_q - mode: [emacs, vi_normal, vi_insert] - event: { send: searchhistory } - } - { - name: open_command_editor - modifier: control - keycode: char_o - mode: [emacs, vi_normal, vi_insert] - event: { send: openeditor } - } - { - name: move_up - modifier: none - keycode: up - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: menuup} - {send: up} - ] - } - } - { - name: move_down - modifier: none - keycode: down - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: menudown} - {send: down} - ] - } - } - { - name: move_left - modifier: none - keycode: left - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: menuleft} - {send: left} - ] - } - } - { - name: move_right_or_take_history_hint - modifier: none - keycode: right - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: historyhintcomplete} - {send: menuright} - {send: right} - ] - } - } - { - name: move_one_word_left - modifier: control - keycode: left - mode: [emacs, vi_normal, vi_insert] - event: {edit: movewordleft} - } - { - name: move_one_word_right_or_take_history_hint - modifier: control - keycode: right - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: historyhintwordcomplete} - {edit: movewordright} - ] - } - } - { - name: move_to_line_start - modifier: none - keycode: home - mode: [emacs, vi_normal, vi_insert] - event: {edit: movetolinestart} - } - { - name: move_to_line_start - modifier: control - keycode: char_a - mode: [emacs, vi_normal, vi_insert] - event: {edit: movetolinestart} - } - { - name: move_to_line_end_or_take_history_hint - modifier: none - keycode: end - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: historyhintcomplete} - {edit: movetolineend} - ] - } - } - { - name: move_to_line_end_or_take_history_hint - modifier: control - keycode: char_e - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: historyhintcomplete} - {edit: movetolineend} - ] - } - } - { - name: move_to_line_start - modifier: control - keycode: home - mode: [emacs, vi_normal, vi_insert] - event: {edit: movetolinestart} - } - { - name: move_to_line_end - modifier: control - keycode: end - mode: [emacs, vi_normal, vi_insert] - event: {edit: movetolineend} - } - { - name: move_up - modifier: control - keycode: char_p - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: menuup} - {send: up} - ] - } - } - { - name: move_down - modifier: control - keycode: char_t - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - {send: menudown} - {send: down} - ] - } - } - { - name: delete_one_character_backward - modifier: none - keycode: backspace - mode: [emacs, vi_insert] - event: {edit: backspace} - } - { - name: delete_one_word_backward - modifier: control - keycode: backspace - mode: [emacs, vi_insert] - event: {edit: backspaceword} - } - { - name: delete_one_character_forward - modifier: none - keycode: delete - mode: [emacs, vi_insert] - event: {edit: delete} - } - { - name: delete_one_character_forward - modifier: control - keycode: delete - mode: [emacs, vi_insert] - event: {edit: delete} - } - { - name: delete_one_character_forward - modifier: control - keycode: char_h - mode: [emacs, vi_insert] - event: {edit: backspace} - } - { - name: delete_one_word_backward - modifier: control - keycode: char_w - mode: [emacs, vi_insert] - event: {edit: backspaceword} - } - { - name: move_left - modifier: none - keycode: backspace - mode: vi_normal - event: {edit: moveleft} - } - { - name: newline_or_run_command - modifier: none - keycode: enter - mode: emacs - event: {send: enter} - } - { - name: move_left - modifier: control - keycode: char_b - mode: emacs - event: { - until: [ - {send: menuleft} - {send: left} - ] - } - } - { - name: move_right_or_take_history_hint - modifier: control - keycode: char_f - mode: emacs - event: { - until: [ - {send: historyhintcomplete} - {send: menuright} - {send: right} - ] - } - } - { - name: redo_change - modifier: control - keycode: char_g - mode: emacs - event: {edit: redo} - } - { - name: undo_change - modifier: control - keycode: char_z - mode: emacs - event: {edit: undo} - } - { - name: paste_before - modifier: control - keycode: char_y - mode: emacs - event: {edit: pastecutbufferbefore} - } - { - name: cut_word_left - modifier: control - keycode: char_w - mode: emacs - event: {edit: cutwordleft} - } - { - name: cut_line_to_end - modifier: control - keycode: char_k - mode: emacs - event: {edit: cuttoend} - } - { - name: cut_line_from_start - modifier: control - keycode: char_u - mode: emacs - event: {edit: cutfromstart} - } - { - name: swap_graphemes - modifier: control - keycode: char_t - mode: emacs - event: {edit: swapgraphemes} - } - { - name: move_one_word_left - modifier: alt - keycode: left - mode: emacs - event: {edit: movewordleft} - } - { - name: move_one_word_right_or_take_history_hint - modifier: alt - keycode: right - mode: emacs - event: { - until: [ - {send: historyhintwordcomplete} - {edit: movewordright} - ] - } - } - { - name: move_one_word_left - modifier: alt - keycode: char_b - mode: emacs - event: {edit: movewordleft} - } - { - name: move_one_word_right_or_take_history_hint - modifier: alt - keycode: char_f - mode: emacs - event: { - until: [ - {send: historyhintwordcomplete} - {edit: movewordright} - ] - } - } - { - name: delete_one_word_forward - modifier: alt - keycode: delete - mode: emacs - event: {edit: deleteword} - } - { - name: delete_one_word_backward - modifier: alt - keycode: backspace - mode: emacs - event: {edit: backspaceword} - } - { - name: delete_one_word_backward - modifier: alt - keycode: char_m - mode: emacs - event: {edit: backspaceword} - } - { - name: cut_word_to_right - modifier: alt - keycode: char_d - mode: emacs - event: {edit: cutwordright} - } - { - name: upper_case_word - modifier: alt - keycode: char_u - mode: emacs - event: {edit: uppercaseword} - } - { - name: lower_case_word - modifier: alt - keycode: char_l - mode: emacs - event: {edit: lowercaseword} - } - { - name: capitalize_char - modifier: alt - keycode: char_c - mode: emacs - event: {edit: capitalizechar} - } - ] -} - -# The prompt indicators are environmental variables that represent -# the state of the prompt -$env.PROMPT_INDICATOR = ": " -$env.PROMPT_INDICATOR_VI_INSERT = "⟩ " -$env.PROMPT_INDICATOR_VI_NORMAL = "⟨ " +$env.PROMPT_INDICATOR = "" $env.PROMPT_MULTILINE_INDICATOR = "::: " -use ~/.cache/starship/init.nu -source ~/.local/share/atuin/init.nu +# FIXME: Disabled for now to use starship prompts instead +# but still very buggy. See: +# https://github.com/starship/starship/issues/5423 and +# https://github.com/nushell/nushell/issues/14650 +# $env.PROMPT_INDICATOR_VI_INSERT = ": " +# $env.PROMPT_INDICATOR_VI_NORMAL = "〉" +$env.PROMPT_INDICATOR_VI_INSERT = "" +$env.PROMPT_INDICATOR_VI_NORMAL = "" +# Temporary workaround +$env.config.cursor_shape.vi_insert = "line" +$env.config.cursor_shape.vi_normal = "block" +# TODO: Currently recommended starship install. Change when it changes. +mkdir ($nu.data-dir | path join "vendor/autoload") +starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu") +# load atuin history +atuin init nu | save -f ($nu.data-dir | path join "vendor/autoload/atuin.nu") +# load zoxide bookmarks +zoxide init nushell | save -f ($nu.data-dir | path join "vendor/autoload/zoxide.nu") + +# keybinds +$env.config.keybindings = [ + { modifier: control keycode: char_o mode: [emacs, vi_normal, vi_insert] event: null }, + { + name: clear_screen + modifier: control + keycode: char_t + mode: ["emacs", "vi_normal", "vi_insert"] + event: { + send: ClearScreen + } + } + { + name: open_editor + modifier: control + keycode: char_e + mode: ["emacs", "vi_normal", "vi_insert"] + event: { + send: OpenEditor + } + } +] + +alias l = ls +alias cl = clear + +alias md = mkdir +def --env mcd [path: one_of(string glob)] { + mkdir $path + cd $path +} diff --git a/terminal/.config/nushell/env.nu b/terminal/.config/nushell/env.nu index 1907ea0..aa8e2a6 100644 --- a/terminal/.config/nushell/env.nu +++ b/terminal/.config/nushell/env.nu @@ -1,103 +1,18 @@ -# Nushell Environment Config File +# env.nu # -# version = "0.87.1" - -# def create_left_prompt [] { -# let home = $nu.home-path +# Installed by: +# version = "0.102.0" # -# # Perform tilde substitution on dir -# # To determine if the prefix of the path matches the home dir, we split the current path into -# # segments, and compare those with the segments of the home dir. In cases where the current dir -# # is a parent of the home dir (e.g. `/home`, homedir is `/home/user`), this comparison will -# # also evaluate to true. Inside the condition, we attempt to str replace `$home` with `~`. -# # Inside the condition, either: -# # 1. The home prefix will be replaced -# # 2. The current dir is a parent of the home dir, so it will be uneffected by the str replace -# let dir = ( -# if ($env.PWD | path split | zip ($home | path split) | all { $in.0 == $in.1 }) { -# ($env.PWD | str replace $home "~") -# } else { -# $env.PWD -# } -# ) +# Previously, environment variables were typically configured in `env.nu`. +# In general, most configuration can and should be performed in `config.nu` +# or one of the autoload directories. # -# let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) -# let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) -# let path_segment = $"($path_color)($dir)" +# This file is generated for backwards compatibility for now. +# It is loaded before config.nu and login.nu # -# $path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)" -# } +# See https://www.nushell.sh/book/configuration.html # -# def create_right_prompt [] { -# # create a right prompt in magenta with green separators and am/pm underlined -# let time_segment = ([ -# (ansi reset) -# (ansi magenta) -# (date now | format date '%x %X %p') # try to respect user's locale -# ] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" | -# str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}") +# Also see `help config env` for more options. # -# let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([ -# (ansi rb) -# ($env.LAST_EXIT_CODE) -# ] | str join) -# } else { "" } -# -# ([$last_exit_code, (char space), $time_segment] | str join) -# } -# -# # Use nushell functions to define your right and left prompt -# $env.PROMPT_COMMAND = {|| create_left_prompt } -# # FIXME: This default is not implemented in rust code as of 2023-09-08. -# $env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } - -# The prompt indicators are environmental variables that represent -# the state of the prompt -$env.PROMPT_INDICATOR = {|| "> " } -$env.PROMPT_INDICATOR_VI_INSERT = {|| ": " } -$env.PROMPT_INDICATOR_VI_NORMAL = {|| "> " } -$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " } - -# If you want previously entered commands to have a different prompt from the usual one, -# you can uncomment one or more of the following lines. -# This can be useful if you have a 2-line prompt and it's taking up a lot of space -# because every command entered takes up 2 lines instead of 1. You can then uncomment -# the line below so that previously entered commands show with a single `🚀`. -# $env.TRANSIENT_PROMPT_COMMAND = {|| "🚀 " } -# $env.TRANSIENT_PROMPT_INDICATOR = {|| "" } -# $env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = {|| "" } -# $env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = {|| "" } -# $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = {|| "" } -# $env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| "" } - -# Specifies how environment variables are: -# - converted from a string to a value on Nushell startup (from_string) -# - converted from a value back to a string when running external commands (to_string) -# Note: The conversions happen *after* config.nu is loaded -$env.ENV_CONVERSIONS = { - "PATH": { - from_string: { |s| $s | split row (char esep) | path expand --no-symlink } - to_string: { |v| $v | path expand --no-symlink | str join (char esep) } - } - "Path": { - from_string: { |s| $s | split row (char esep) | path expand --no-symlink } - to_string: { |v| $v | path expand --no-symlink | str join (char esep) } - } -} - -# Directories to search for scripts when calling source or use -$env.NU_LIB_DIRS = [ - # FIXME: This default is not implemented in rust code as of 2023-09-06. - ($nu.default-config-dir | path join 'scripts') # add /scripts -] - -# Directories to search for plugin binaries when calling register -$env.NU_PLUGIN_DIRS = [ - # FIXME: This default is not implemented in rust code as of 2023-09-06. - ($nu.default-config-dir | path join 'plugins') # add /plugins -] - -# To add entries to PATH (on Windows you might use Path), you can use the following pattern: -# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') -mkdir ~/.cache/starship -starship init nu | save -f ~/.cache/starship/init.nu +# You can remove these comments if you want or leave +# them for future reference. diff --git a/terminal/.config/starship.toml b/terminal/.config/starship.toml index a7b888f..625330c 100644 --- a/terminal/.config/starship.toml +++ b/terminal/.config/starship.toml @@ -1,3 +1,6 @@ +# Get editor completions based on the config schema +"$schema" = 'https://starship.rs/config-schema.json' + format = """ $sudo\ $username\ diff --git a/terminal/.config/zsh/.zshrc b/terminal/.config/zsh/.zshrc index e2b9c87..9e06438 100644 --- a/terminal/.config/zsh/.zshrc +++ b/terminal/.config/zsh/.zshrc @@ -25,7 +25,6 @@ if command -v zr >/dev/null 2>&1; then molovo/tipz \ ael-code/zsh-colored-man-pages \ MichaelAquilina/zsh-auto-notify \ - junegunn/fzf.git/shell/key-bindings.zsh \ Aloxaf/fzf-tab \ zdharma-continuum/fast-syntax-highlighting \ zsh-users/zsh-autosuggestions \ @@ -35,7 +34,6 @@ if command -v zr >/dev/null 2>&1; then else # or manually [ -e /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh ] && source /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh [ -e /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh ] && source /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh - [ -e /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh ## find the correct installed tab-completion version PLUG_FOLDER="/usr/share/zsh/plugins" [ -e $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh ] && source $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh @@ -223,6 +221,9 @@ bindkey '^N' history-beginning-search-forward # search history backwards bindkey '^o' history-incremental-search-backward +bindkey -M vicmd '^o' history-incremental-search-backward +bindkey '^r' atuin-search-viins +bindkey -M vicmd '^r' atuin-search-vicmd # cycle through history results bindkey -M isearch '^P' history-incremental-search-backward bindkey -M isearch '^N' history-incremental-search-forward diff --git a/terminal/.local/share/atuin/init.nu b/terminal/.local/share/atuin/init.nu deleted file mode 100644 index 93ebb7f..0000000 --- a/terminal/.local/share/atuin/init.nu +++ /dev/null @@ -1,81 +0,0 @@ -# Source this in your ~/.config/nushell/config.nu -$env.ATUIN_SESSION = (atuin uuid) - -# Magic token to make sure we don't record commands run by keybindings -let ATUIN_KEYBINDING_TOKEN = $"# (random uuid)" - -let _atuin_pre_execution = {|| - let cmd = (commandline) - if ($cmd | is-empty) { - return - } - if not ($cmd | str starts-with $ATUIN_KEYBINDING_TOKEN) { - $env.ATUIN_HISTORY_ID = (atuin history start -- $cmd) - } -} - -let _atuin_pre_prompt = {|| - let last_exit = $env.LAST_EXIT_CODE - if 'ATUIN_HISTORY_ID' not-in $env { - return - } - with-env { ATUIN_LOG: error } { - do { atuin history end $'--exit=($last_exit)' -- $env.ATUIN_HISTORY_ID | null } | null - - } - hide-env ATUIN_HISTORY_ID -} - -def _atuin_search_cmd [...flags: string] { - [ - $ATUIN_KEYBINDING_TOKEN, - ([ - `commandline (ATUIN_LOG=error run-external --redirect-stderr atuin search`, - ($flags | append [--interactive, --] | each {|e| $'"($e)"'}), - `(commandline) | complete | $in.stderr | str substring ..-1)`, - ] | flatten | str join ' '), - ] | str join "\n" -} - -$env.config = ($env | default {} config).config -$env.config = ($env.config | default {} hooks) -$env.config = ( - $env.config | upsert hooks ( - $env.config.hooks - | upsert pre_execution ( - $env.config.hooks | get -i pre_execution | default [] | append $_atuin_pre_execution) - | upsert pre_prompt ( - $env.config.hooks | get -i pre_prompt | default [] | append $_atuin_pre_prompt) - ) -) - -$env.config = ($env.config | default [] keybindings) - -$env.config = ( - $env.config | upsert keybindings ( - $env.config.keybindings - | append { - name: atuin - modifier: control - keycode: char_r - mode: [emacs, vi_normal, vi_insert] - event: { send: executehostcommand cmd: (_atuin_search_cmd) } - } - ) -) - -# The up arrow keybinding has surprising behavior in Nu, and is disabled by default. -# See https://github.com/atuinsh/atuin/issues/1025 for details -# $env.config = ( -# $env.config | upsert keybindings ( -# $env.config.keybindings -# | append { -# name: atuin -# modifier: none -# keycode: up -# mode: [emacs, vi_normal, vi_insert] -# event: { send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') } -# } -# ) -# ) - diff --git a/vcs/jj/config/sh/alias.d/jj.sh b/vcs/jj/config/sh/alias.d/jj.sh index 6626c98..60f8025 100644 --- a/vcs/jj/config/sh/alias.d/jj.sh +++ b/vcs/jj/config/sh/alias.d/jj.sh @@ -60,10 +60,10 @@ jlf() { jj log -r "description(substring-i:\"$*\")" } jlof() { - jj log --summary -r "description($*)" + jj log --summary -r "description(substring-i:\"$*\")" } jloof() { - jj log --patch -r "description($*)" + jj log --patch -r "description(substring-i:\"$*\")" } # show branches (i.e. head commits) w a couple previous commits diff --git a/writing/zk/config/sh/alias.d/zk.sh b/writing/zk/config/sh/alias.d/zk.sh index debc673..2a632ad 100644 --- a/writing/zk/config/sh/alias.d/zk.sh +++ b/writing/zk/config/sh/alias.d/zk.sh @@ -26,7 +26,7 @@ if [ -n "${WIKIROOT}" ]; then nn() { # 'new note' _zk_wiki new "$@" } - nni() { # 'new note inbox' + nnn() { # 'new quicknote' _zk_wiki new -t "${*}" inbox } nnl() { # 'new note log' @@ -35,4 +35,7 @@ if [ -n "${WIKIROOT}" ]; then nnd() { # 'new note draft' _zk_wiki draft "$@" } + nni() { # 'new note idea' + _zk_wiki edit -n 1 -m idea dump + } fi