From f5a7c0cc5751653621280026628f0ea86998c7f8 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Wed, 16 Jul 2025 20:57:52 +1200 Subject: [PATCH 01/29] feat --- nvim/lua/plugins/lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 2288360..54f8d27 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -82,7 +82,7 @@ return { -- bashls = {}, -- dockerls = {}, -- emmet_language_server = {}, - -- gopls = {}, + gopls = {}, html = {}, -- jsonls = {}, ltex = { From 00279a5158bfd5bab902cf559991f29f202d77bb Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sat, 19 Jul 2025 02:19:33 +1200 Subject: [PATCH 02/29] feat --- dotfiles/.envrc | 2 +- nvim/lua/plugins/linting.lua | 8 +------- scripts/funcs.sh | 3 ++- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/dotfiles/.envrc b/dotfiles/.envrc index 97aa155..9c142f9 100644 --- a/dotfiles/.envrc +++ b/dotfiles/.envrc @@ -1,4 +1,4 @@ -source_env_if_exists ~/.envrc.secret +source_env_if_exists ~/.env.secret export TRACE=0 export VIRTUAL_ENV="~/.venv/bin/activate" source ~/.venv/bin/activate diff --git a/nvim/lua/plugins/linting.lua b/nvim/lua/plugins/linting.lua index 78dcdcf..a3b8b87 100644 --- a/nvim/lua/plugins/linting.lua +++ b/nvim/lua/plugins/linting.lua @@ -39,13 +39,7 @@ return { jinja2 = { "markdownlint", "codespell" }, json = { "jsonlint" }, markdown = { "markdownlint", "codespell" }, - python = { - "ruff", - -- "mypy", - -- "flake8", - "pydocstyle", - -- "pylint", - }, + python = { "ruff", "pydocstyle" }, sql = { "sqlfluff" }, yaml = { "actionlint", "yamllint" }, } diff --git a/scripts/funcs.sh b/scripts/funcs.sh index f79e919..ed7ebd7 100644 --- a/scripts/funcs.sh +++ b/scripts/funcs.sh @@ -68,8 +68,9 @@ v() { which python } alias vinit=v +alias vact=v vneu() { - uv venv --python 3.11.10 + uv venv --python 3.11.10 && source .venv/bin/activate && which python } vdel() { rm .venv From 7e37c4f2c94bd738a28f5ce830b63a7b459984e4 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sat, 19 Jul 2025 02:33:15 +1200 Subject: [PATCH 03/29] feat --- Makefile | 26 +++++++++------------- README.md | 16 ++++++++----- scripts/setup-lsps.sh | 1 - scripts/bootstrap-stow.sh => stow/setup.sh | 0 scripts/setup-zpretzo.sh => zsh/setup.sh | 0 5 files changed, 22 insertions(+), 21 deletions(-) rename scripts/bootstrap-stow.sh => stow/setup.sh (100%) rename scripts/setup-zpretzo.sh => zsh/setup.sh (100%) diff --git a/Makefile b/Makefile index 99cdbde..b0ae1f2 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,31 @@ -# can be either macos or ubuntu -OS = macos - -.PHONY: default bootstrap-stow dotfiles test setup-macos setup-ubuntu +.PHONY: default setup-stow dotfiles test setup-macos setup-ubuntu default: echo "hello ^^" -.PHONY: setup-macos setup-ubuntu boostrap-stow +.PHONY: setup-macos setup-ubuntu setup-stow +setup-macos: export OS=macos setup-macos: brew-pkgs nix-pkgs dotfiles bash ./tmux/setup.sh - bash ./scripts/setup-zpretzo.sh + bash ./zsh/setup.sh bash ./fzf/setup.sh bash ./macos/setup.sh +setup-ubuntu: export OS=ubuntu setup-ubuntu: dotfiles nix-pkgs dotfiles bash ./tmux/setup.sh - bash ./scripts/setup-zpretzo.sh + bash ./zsh/setup.sh bash ./fzf/setup.sh bash ./ubuntu/setup.sh -bootstrap-stow: - bash ./scripts/bootstrap-stow.sh +setup-stow: + bash ./stow/setup.sh .PHONY: dotfiles test STOW_ARGS=-vv -dotfiles: bootstrap-stow +dotfiles: setup-stow stow $(STOW_ARGS) -d dotfiles -t $(HOME) $(OS) stow $(STOW_ARGS) dotfiles stow $(STOW_ARGS) yabai @@ -34,7 +33,7 @@ dotfiles: bootstrap-stow test: setup-nix bash ./nix/load-$(OS).sh && bash ./tests/*.sh -.PHONY: setup-pyenv python js +.PHONY: setup-uv python js setup-uv: bash ./python/setup-uv.sh @@ -44,10 +43,7 @@ python: setup-uv ~/.local/bin/uv pip install -r ./python/pyproject.toml js: - npm install -g @tailwindcss/language-server markserv - npm install -g remark-cli remark-lint remark-preset-lint-consistent remark-preset-lint-markdown-style-guide remark-preset-lint-recommended remark-stringify - npm install -g jsonlint jshint - npm install -g sql-language-server + npm install -g remark-cli remark-lint remark-preset-lint-consistent remark-preset-lint-markdown-style-guide remark-preset-lint-recommended remark-stringify jsonlint jshint sql-language-server @tailwindcss/language-server markserv .PHONY: clean-nvim setup-vim diff --git a/README.md b/README.md index feeed86..f99d0ae 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This repo should be cloned into `$HOME` and set as `$XDG_CONFIG_HOME`. Setup an Ubuntu machine: ```shell-session -$ make setup-ubuntu OS=ubuntu +$ make setup-ubuntu ``` This will also setup dependencies with Nix. @@ -26,7 +26,7 @@ This will also setup dependencies with Nix. Setup an macOS machine: ```shell-session -$ make setup-macos OS=macos +$ make setup-macos ``` This will also setup dependencies with Nix. @@ -44,17 +44,23 @@ $ make python Use GNU Stow to symlink dotfiles for Bash, Zsh, Tmux and Git: ```shell-session -$ make dotfiles OS=macos +$ make dotfiles +``` + +Note: The `OS` variable is automatically set by the `setup-macos` and `setup-ubuntu` targets. For manual dotfiles setup, you can export the OS variable first: + +```shell-session +$ export OS=macos && make dotfiles ``` Valid values for `OS` are `macos`, `wsl` or `windows`. -A script `./scripts/bootstrap-stow.sh` will attempt to bootstrap Stow if it's not already available. Stow bootstrapping is not setup for Windows because Windows is awful. +A script `./stow/setup.sh` will attempt to bootstrap Stow if it's not already available. Stow bootstrapping is not setup for Windows because Windows is awful. You can run the setup without bootstrapping Stow with: ```shell-session -$ make dotfiles OS=macos -o bootstrap-stow +$ make dotfiles OS=macos -o setup-stow ``` ### Nix diff --git a/scripts/setup-lsps.sh b/scripts/setup-lsps.sh index 21b9aa8..0d71909 100644 --- a/scripts/setup-lsps.sh +++ b/scripts/setup-lsps.sh @@ -2,5 +2,4 @@ brew install lua-language-server marksman ltex-ls yamllint uv tool install pyright uv tool install ruff uv tool install basedpyright -npm i -g vscode-langservers-extracted prosemd-lsp ltex cargo install prosemd-lsp diff --git a/scripts/bootstrap-stow.sh b/stow/setup.sh similarity index 100% rename from scripts/bootstrap-stow.sh rename to stow/setup.sh diff --git a/scripts/setup-zpretzo.sh b/zsh/setup.sh similarity index 100% rename from scripts/setup-zpretzo.sh rename to zsh/setup.sh From 7eadee65c8d8aa6477f6b7c955b00d8e29e248d2 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sat, 19 Jul 2025 02:36:17 +1200 Subject: [PATCH 04/29] feat --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b0ae1f2..98b52f7 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,7 @@ -.PHONY: default setup-stow dotfiles test setup-macos setup-ubuntu - default: - echo "hello ^^" + @echo "hello ^^" -.PHONY: setup-macos setup-ubuntu setup-stow +.PHONY: setup-macos setup-ubuntu setup-wsl setup-stow setup-macos: export OS=macos setup-macos: brew-pkgs nix-pkgs dotfiles @@ -19,6 +17,12 @@ setup-ubuntu: dotfiles nix-pkgs dotfiles bash ./fzf/setup.sh bash ./ubuntu/setup.sh +setup-wsl: export OS=wsl +setup-wsl: dotfiles nix-pkgs dotfiles + bash ./tmux/setup.sh + bash ./zsh/setup.sh + bash ./fzf/setup.sh + setup-stow: bash ./stow/setup.sh From 19f765e8d26906b35981913d7fdea219d5953408 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sat, 26 Jul 2025 21:54:38 +1200 Subject: [PATCH 05/29] feat --- dotfiles/.envrc | 3 -- nvim/lazy-lock.json | 65 +++++++++++++++++----------------- nvim/lua/config/option.lua | 1 + nvim/lua/plugins/autopairs.lua | 7 +--- nvim/lua/plugins/cmp.lua | 64 ++++++++++++++++----------------- nvim/lua/plugins/lsp.lua | 2 +- nvim/lua/plugins/noice.lua | 5 +-- nvim/lua/plugins/snippets.lua | 1 - 8 files changed, 68 insertions(+), 80 deletions(-) diff --git a/dotfiles/.envrc b/dotfiles/.envrc index 9c142f9..74c0550 100644 --- a/dotfiles/.envrc +++ b/dotfiles/.envrc @@ -1,5 +1,2 @@ source_env_if_exists ~/.env.secret export TRACE=0 -export VIRTUAL_ENV="~/.venv/bin/activate" -source ~/.venv/bin/activate -layout python diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index da29cf9..23fca9f 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,58 +1,57 @@ { - "CopilotChat.nvim": { "branch": "main", "commit": "a89f5f1162b04a0962e5f4c3cdf248a81e7e53cb" }, - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "CopilotChat.nvim": { "branch": "main", "commit": "f7eb423baccbb27f5b5608fb91acee2d6bc769c7" }, + "LuaSnip": { "branch": "master", "commit": "831a130291eb6dae0dabd2748d0a99401a2eebc4" }, "Vim-Jinja2-Syntax": { "branch": "master", "commit": "2c17843b074b06a835f88587e1023ceff7e2c7d1" }, - "barbar.nvim": { "branch": "master", "commit": "807bede7ef1d8e2ac5f108e9ac8123b1e2d321e3" }, + "barbar.nvim": { "branch": "master", "commit": "3a74402bdf04745a762de83d5c5e88e3e9b0e2e0" }, "blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" }, - "blink-cmp-dictionary": { "branch": "master", "commit": "5f1a703416e5090b9633c43873dba8ba03b0fb23" }, - "blink-emoji.nvim": { "branch": "master", "commit": "a77aebc092ebece1eed108f301452ae774d6b67a" }, - "blink-ripgrep.nvim": { "branch": "main", "commit": "56084d1f45c8621d23d4bac724c2dc50b1eb75db" }, - "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, + "blink-cmp-dictionary": { "branch": "master", "commit": "43b701fe9728a704bc63e4667c5d8b398bf129b2" }, + "blink-emoji.nvim": { "branch": "master", "commit": "f22ce8cac02a6ece05368220f1e38bd34fe376f9" }, + "blink-ripgrep.nvim": { "branch": "main", "commit": "95ef910133d115dae4aafb7b0c30713cf3deb43a" }, + "blink.cmp": { "branch": "main", "commit": "586ee87534f5bf65f1c8dea2d1da2a57e8cddd36" }, "blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" }, - "bullets.vim": { "branch": "master", "commit": "8f3259e807c40b91d247f612823295ab99777a65" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "eebc724d12c5579d733d1f801386e0ceb909d001" }, + "bullets.vim": { "branch": "master", "commit": "1c13e510e11d08b0259e8e627f128359c5521962" }, + "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, - "copilot.lua": { "branch": "master", "commit": "0a7502946845fb14b860a6384c709a791bbab96a" }, - "dbtpal": { "branch": "main", "commit": "706134b879eb2f48b2abf56f29e95a30a52cf398" }, + "copilot.lua": { "branch": "master", "commit": "14bf786180b2ca4578915c56989b6d676dddc6f3" }, + "dbtpal": { "branch": "main", "commit": "981eab51609362712c64e3cf3fb773fe11f859b9" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "emmet-vim": { "branch": "master", "commit": "6c511a8d7d2863066f32e25543e2bb99d505172c" }, - "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "17ab794b6fce6fce768430ebc925347e349e1d60" }, + "emmet-vim": { "branch": "master", "commit": "e98397144982d1e75b20d94d55a82de3ec8f648d" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "0cb5a7753d3c4b8e9cfdc9d88d9110cb8d4b1544" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "0ea56f91b7f51a37b749c050a5e5dfdd56b302b3" }, - "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, - "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, + "mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" }, + "mini.indentscope": { "branch": "main", "commit": "5fdc3edf7bb1b6365980c2c47dac2f19ec93c97b" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, - "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, - "nvim-autopairs": { "branch": "master", "commit": "2a406cdd8c373ae7fe378a9e062a5424472bd8d8" }, - "nvim-bqf": { "branch": "main", "commit": "e20417d5e589e03eaaaadc4687904528500608be" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, + "nvim-bqf": { "branch": "main", "commit": "dd17c73912487dccb372deff85d4262d2b89bc2b" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-lint": { "branch": "master", "commit": "5b1bdf306bd3e565908145279e8bbfc594dac3b3" }, - "nvim-lspconfig": { "branch": "master", "commit": "4ea9083b6d3dff4ddc6da17c51334c3255b7eba5" }, - "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, - "nvim-treesitter": { "branch": "master", "commit": "0e21ee8df6235511c02bab4a5b391d18e165a58d" }, - "nvim-treesitter-context": { "branch": "master", "commit": "439789a9a8df9639ecd749bb3286b77117024a6f" }, + "nvim-lint": { "branch": "master", "commit": "9c6207559297b24f0b7c32829f8e45f7d65b991f" }, + "nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" }, + "nvim-notify": { "branch": "master", "commit": "397c7c1184745fca649e5104de659e6392ef5a4d" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "59f318a65d42a5c4037796886a8874fd57f774fc" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "c90dee4e930ab9f49fa6d77f289bff335b49e972" }, - "obsidian.nvim": { "branch": "main", "commit": "e0eb92c5afcacf5bf11e4735079a538fd1486ea9" }, - "oil.nvim": { "branch": "master", "commit": "302bbaceeafc690e6419e0c8296e804d60cb9446" }, + "nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" }, + "obsidian.nvim": { "branch": "main", "commit": "2f0222b3eb20382cadf3e1d91f368318b768771c" }, + "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, - "telescope-git-file-history.nvim": { "branch": "master", "commit": "c27d99ba88ec5f0b6d2b9f9bc67dd3d14c610b25" }, + "telescope-git-file-history.nvim": { "branch": "master", "commit": "e7d495319f2a04df96402057a6992ea970f8914d" }, "telescope-makefile": { "branch": "master", "commit": "6e5b5767751dbf73ad4f126840dcf1abfc38e891" }, - "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, - "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, + "undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" }, "vim": { "branch": "master", "commit": "d4b0823100c702af127cba8dd5595a8f599041ec" }, "vim-argwrap": { "branch": "master", "commit": "f3e26a5ad249d09467804b92e760d08b1cc457a1" }, "vim-bufkill": { "branch": "master", "commit": "3113181d0c1bfb8719f3ddcd2e2f35a8d763d1e5" }, "vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" }, "vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" }, - "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-grepper": { "branch": "master", "commit": "acaaf32edaa11d82fb972d2af36b949ec3042928" }, "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" }, "vim-markdown-toc": { "branch": "master", "commit": "aa9cc3b07791db5cbe5f29d661763bc0eb4fb7c1" }, diff --git a/nvim/lua/config/option.lua b/nvim/lua/config/option.lua index 0ce4ebe..ec011f4 100644 --- a/nvim/lua/config/option.lua +++ b/nvim/lua/config/option.lua @@ -59,6 +59,7 @@ vim.opt.listchars = "tab:>-" -- Enable spell checking and set language vim.opt.spell = true vim.opt.spelllang = "en_nz" +vim.opt.spellsuggest = { "best", 9 } -- Automatically open quickfix list after running :make vim.cmd("autocmd QuickFixCmdPost [^l]* copen") diff --git a/nvim/lua/plugins/autopairs.lua b/nvim/lua/plugins/autopairs.lua index 8663fc3..fba60b3 100644 --- a/nvim/lua/plugins/autopairs.lua +++ b/nvim/lua/plugins/autopairs.lua @@ -37,12 +37,7 @@ return { Rule("/*", "*/", "sql"), }) - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - local cmp_status_ok, cmp = pcall(require, "cmp") - if not cmp_status_ok then - return - end - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) + -- Integration with blink.cmp is handled automatically end, }, } diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 6d62aae..e23dd2e 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -22,7 +22,7 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { - snippets = { preset = "luasnip" }, + -- snippets = { preset = "luasnip" }, keymap = { preset = "enter", @@ -85,37 +85,37 @@ return { selection = { auto_insert = true, preselect = false }, }, menu = { - cmdline_position = function() - local Api = require("noice.api") - local pos = Api.get_cmdline_position() - return { pos.screenpos.row, pos.screenpos.col } - end, - border = "single", - auto_show = function() - return vim.bo.buftype ~= "prompt" - and vim.b.completion ~= false - and vim.bo.filetype ~= "TelescopePrompt" - end, - draw = { - columns = { - { "label", "label_description", gap = 3 }, - { "kind_icon", gap = 1, "source_name", gap = 1, "kind" }, - }, - components = { - kind_icon = { - ellipsis = false, - text = function(ctx) - local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) - return kind_icon - end, - -- Optionally, you may also use the highlights from mini.icons - highlight = function(ctx) - local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) - return hl - end, - }, - }, - }, + -- cmdline_position = function() + -- local Api = require("noice.api") + -- local pos = Api.get_cmdline_position() + -- return { pos.screenpos.row, pos.screenpos.col } + -- end, + -- border = "single", + -- auto_show = function() + -- return vim.bo.buftype ~= "prompt" + -- and vim.b.completion ~= false + -- and vim.bo.filetype ~= "TelescopePrompt" + -- end, + -- draw = { + -- columns = { + -- { "label", "label_description", gap = 3 }, + -- { "kind_icon", gap = 1, "source_name", gap = 1, "kind" }, + -- }, + -- components = { + -- kind_icon = { + -- ellipsis = false, + -- text = function(ctx) + -- local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) + -- return kind_icon + -- end, + -- -- Optionally, you may also use the highlights from mini.icons + -- highlight = function(ctx) + -- local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) + -- return hl + -- end, + -- }, + -- }, + -- }, }, }, diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 54f8d27..015ef58 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -107,7 +107,7 @@ return { basedpyright = {}, -- pyright = { cmd = { "pyright-langserver", "--stdio" } }, ruff = { - cmd = { "/Users/adamgreen/.venv/bin/ruff", "server" }, + cmd = { "ruff", "server" }, filetypes = { "python" }, -- root_dir = require("lspconfig").util.root_pattern( -- ".git", diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua index 4d75151..7bf4403 100644 --- a/nvim/lua/plugins/noice.lua +++ b/nvim/lua/plugins/noice.lua @@ -10,9 +10,6 @@ return { cmdline = { enabled = true, }, - messages = { - enabled = false, - }, popup = { enabled = false, }, @@ -37,7 +34,7 @@ return { presets = { bottom_search = false, command_palette = false, - long_message_to_split = true, + -- long_message_to_split = true, inc_rename = false, lsp_doc_border = false, }, diff --git a/nvim/lua/plugins/snippets.lua b/nvim/lua/plugins/snippets.lua index da33475..3e45e91 100644 --- a/nvim/lua/plugins/snippets.lua +++ b/nvim/lua/plugins/snippets.lua @@ -2,7 +2,6 @@ return { { "L3MON4D3/LuaSnip", dependencies = { - "saadparwaiz1/cmp_luasnip", "rafamadriz/friendly-snippets", }, config = function() From 3984a76a763f91221048290d715a1d6284b0a589 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Tue, 29 Jul 2025 01:07:30 +1200 Subject: [PATCH 06/29] feat --- Makefile | 1 + dotfiles/common/.zshenv | 5 --- dotfiles/common/env.sh | 4 +-- kitty/kitty.conf | 2 ++ nix/flake.lock | 6 ++-- nix/flake.nix | 4 +-- nvim/lua/plugins/cmp.lua | 62 +++++++++++++++++++------------------- nvim/lua/plugins/noice.lua | 5 ++- starship/starship.toml | 10 ++++-- 9 files changed, 53 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 98b52f7..4ba842d 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ dotfiles: setup-stow stow $(STOW_ARGS) -d dotfiles -t $(HOME) $(OS) stow $(STOW_ARGS) dotfiles stow $(STOW_ARGS) yabai + ln -sf ~/dotfiles/fish ~/.config/fish\ test: setup-nix bash ./nix/load-$(OS).sh && bash ./tests/*.sh diff --git a/dotfiles/common/.zshenv b/dotfiles/common/.zshenv index 68cead0..e08433a 100644 --- a/dotfiles/common/.zshenv +++ b/dotfiles/common/.zshenv @@ -1,15 +1,10 @@ bash $HOME/dotfiles/scripts/trace.sh "$0" - -export XDG_CONFIG_HOME=~/dotfiles - if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi export EDITOR=$(which nvim) - if command -v launchctl >/dev/null 2>&1; then launchctl setenv XDG_CONFIG_HOME $XDG_CONFIG_HOME fi - source $HOME/dotfiles/scripts/funcs.sh source $HOME/dotfiles/scripts/aliases.sh diff --git a/dotfiles/common/env.sh b/dotfiles/common/env.sh index ca90e77..575a0bb 100644 --- a/dotfiles/common/env.sh +++ b/dotfiles/common/env.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash - +export XDG_CONFIG_HOME=~/dotfiles export PERSONAL_PATH="$HOME/personal" -export TODO="$PERSONAL_PATH/todo.md" +# export TODO="$PERSONAL_PATH/todo.md" diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 3ba882b..82f4168 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -19,3 +19,5 @@ confirm_os_window_close 0 include ~/dotfiles/kitty/current-theme.conf macos_titlebar_color #282A36 + +# shell fish diff --git a/nix/flake.lock b/nix/flake.lock index 90c9144..0de4ed5 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "lastModified": 1753429684, + "narHash": "sha256-9h7+4/53cSfQ/uA3pSvCaBepmZaz/dLlLVJnbQ+SJjk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "rev": "7fd36ee82c0275fb545775cc5e4d30542899511d", "type": "github" }, "original": { diff --git a/nix/flake.nix b/nix/flake.nix index 1716f0a..f0fe5bd 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -27,11 +27,11 @@ cmakeMinimal codespell direnv - dpkg + # dpkg efm-langserver entr findutils - fish + # fish flyctl gh git diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index e23dd2e..2cf3a3f 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -85,37 +85,37 @@ return { selection = { auto_insert = true, preselect = false }, }, menu = { - -- cmdline_position = function() - -- local Api = require("noice.api") - -- local pos = Api.get_cmdline_position() - -- return { pos.screenpos.row, pos.screenpos.col } - -- end, - -- border = "single", - -- auto_show = function() - -- return vim.bo.buftype ~= "prompt" - -- and vim.b.completion ~= false - -- and vim.bo.filetype ~= "TelescopePrompt" - -- end, - -- draw = { - -- columns = { - -- { "label", "label_description", gap = 3 }, - -- { "kind_icon", gap = 1, "source_name", gap = 1, "kind" }, - -- }, - -- components = { - -- kind_icon = { - -- ellipsis = false, - -- text = function(ctx) - -- local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) - -- return kind_icon - -- end, - -- -- Optionally, you may also use the highlights from mini.icons - -- highlight = function(ctx) - -- local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) - -- return hl - -- end, - -- }, - -- }, - -- }, + cmdline_position = function() + local Api = require("noice.api") + local pos = Api.get_cmdline_position() + return { pos.screenpos.row, pos.screenpos.col } + end, + border = "single", + auto_show = function() + return vim.bo.buftype ~= "prompt" + and vim.b.completion ~= false + and vim.bo.filetype ~= "TelescopePrompt" + end, + draw = { + columns = { + { "label", "label_description", gap = 3 }, + { "kind_icon", gap = 1, "source_name", gap = 1, "kind" }, + }, + components = { + kind_icon = { + ellipsis = false, + text = function(ctx) + local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) + return kind_icon + end, + -- Optionally, you may also use the highlights from mini.icons + highlight = function(ctx) + local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) + return hl + end, + }, + }, + }, }, }, diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua index 7bf4403..faa3e9d 100644 --- a/nvim/lua/plugins/noice.lua +++ b/nvim/lua/plugins/noice.lua @@ -17,7 +17,10 @@ return { enabled = true, }, -- this is the messages that appear in top right - notify = { + -- notify = { + -- enabled = false, + -- }, + messages = { enabled = false, }, lsp = { diff --git a/starship/starship.toml b/starship/starship.toml index e5d9d46..9aa4d83 100644 --- a/starship/starship.toml +++ b/starship/starship.toml @@ -1,9 +1,15 @@ add_newline = true command_timeout = 2000 -format = """$hostname$directory$line_break$character""" +format = """$shell$hostname$directory$line_break$character""" right_format = """$cmd_duration$git_branch$python$nix_shell""" +[shell] + fish_indicator = "  " + zsh_indicator = " 󰬇" + bash_indicator = " $" + disabled = false + [character] # success_symbol = "[ \\$](green)" success_symbol = "[ >∶](green)" @@ -21,7 +27,7 @@ format = " [on]() [$symbol $branch(:$remote_branch)](bold green)" [hostname] ssh_only = false -format = " on [$hostname](fg:green) " +format = "on [$hostname](fg:green) " [python] format=' [with]() [${symbol} ${version}](bold blue)' From 305a313b169d5d919003c1400195618cf3525341 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Wed, 30 Jul 2025 00:37:20 +1200 Subject: [PATCH 07/29] feat --- fish/completions/fisher.fish | 7 + fish/completions/fzf_configure_bindings.fish | 8 + fish/conf.d/fzf.fish | 28 ++ fish/config.fish | 40 +++ fish/fish_plugins | 3 + fish/fish_variables | 38 +++ fish/functions/__bass.py | 140 ++++++++++ .../_fzf_configure_bindings_help.fish | 43 ++++ fish/functions/_fzf_extract_var_info.fish | 15 ++ fish/functions/_fzf_preview_changed_file.fish | 49 ++++ fish/functions/_fzf_preview_file.fish | 43 ++++ fish/functions/_fzf_report_diff_type.fish | 18 ++ fish/functions/_fzf_report_file_type.fish | 6 + fish/functions/_fzf_search_directory.fish | 33 +++ fish/functions/_fzf_search_git_log.fish | 36 +++ fish/functions/_fzf_search_git_status.fish | 41 +++ fish/functions/_fzf_search_history.fish | 39 +++ fish/functions/_fzf_search_processes.fish | 32 +++ fish/functions/_fzf_search_variables.fish | 47 ++++ fish/functions/_fzf_wrapper.fish | 21 ++ fish/functions/bass.fish | 29 +++ fish/functions/fisher.fish | 240 ++++++++++++++++++ fish/functions/fzf_configure_bindings.fish | 46 ++++ fish/functions/search.fish | 14 + fish/setup.sh | 8 + 25 files changed, 1024 insertions(+) create mode 100644 fish/completions/fisher.fish create mode 100644 fish/completions/fzf_configure_bindings.fish create mode 100644 fish/conf.d/fzf.fish create mode 100644 fish/config.fish create mode 100644 fish/fish_plugins create mode 100644 fish/fish_variables create mode 100644 fish/functions/__bass.py create mode 100644 fish/functions/_fzf_configure_bindings_help.fish create mode 100644 fish/functions/_fzf_extract_var_info.fish create mode 100644 fish/functions/_fzf_preview_changed_file.fish create mode 100644 fish/functions/_fzf_preview_file.fish create mode 100644 fish/functions/_fzf_report_diff_type.fish create mode 100644 fish/functions/_fzf_report_file_type.fish create mode 100644 fish/functions/_fzf_search_directory.fish create mode 100644 fish/functions/_fzf_search_git_log.fish create mode 100644 fish/functions/_fzf_search_git_status.fish create mode 100644 fish/functions/_fzf_search_history.fish create mode 100644 fish/functions/_fzf_search_processes.fish create mode 100644 fish/functions/_fzf_search_variables.fish create mode 100644 fish/functions/_fzf_wrapper.fish create mode 100644 fish/functions/bass.fish create mode 100644 fish/functions/fisher.fish create mode 100644 fish/functions/fzf_configure_bindings.fish create mode 100644 fish/functions/search.fish create mode 100644 fish/setup.sh diff --git a/fish/completions/fisher.fish b/fish/completions/fisher.fish new file mode 100644 index 0000000..6d23ce4 --- /dev/null +++ b/fish/completions/fisher.fish @@ -0,0 +1,7 @@ +complete --command fisher --exclusive --long help --description "Print help" +complete --command fisher --exclusive --long version --description "Print version" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex" +complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)" diff --git a/fish/completions/fzf_configure_bindings.fish b/fish/completions/fzf_configure_bindings.fish new file mode 100644 index 0000000..b38ef92 --- /dev/null +++ b/fish/completions/fzf_configure_bindings.fish @@ -0,0 +1,8 @@ +complete fzf_configure_bindings --no-files +complete fzf_configure_bindings --long help --short h --description "Print help" --condition "not __fish_seen_argument --help -h" +complete fzf_configure_bindings --long directory --description "Change the key binding for Search Directory" --condition "not __fish_seen_argument --directory" +complete fzf_configure_bindings --long git_log --description "Change the key binding for Search Git Log" --condition "not __fish_seen_argument --git_log" +complete fzf_configure_bindings --long git_status --description "Change the key binding for Search Git Status" --condition "not __fish_seen_argument --git_status" +complete fzf_configure_bindings --long history --description "Change the key binding for Search History" --condition "not __fish_seen_argument --history" +complete fzf_configure_bindings --long processes --description "Change the key binding for Search Processes" --condition "not __fish_seen_argument --processes" +complete fzf_configure_bindings --long variables --description "Change the key binding for Search Variables" --condition "not __fish_seen_argument --variables" diff --git a/fish/conf.d/fzf.fish b/fish/conf.d/fzf.fish new file mode 100644 index 0000000..8156c11 --- /dev/null +++ b/fish/conf.d/fzf.fish @@ -0,0 +1,28 @@ +# fzf.fish is only meant to be used in interactive mode. If not in interactive mode and not in CI, skip the config to speed up shell startup +if not status is-interactive && test "$CI" != true + exit +end + +# Because of scoping rules, to capture the shell variables exactly as they are, we must read +# them before even executing _fzf_search_variables. We use psub to store the +# variables' info in temporary files and pass in the filenames as arguments. +# This variable is global so that it can be referenced by fzf_configure_bindings and in tests +set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)' + + +# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings +fzf_configure_bindings + +# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased +function _fzf_uninstall --on-event fzf_uninstall + _fzf_uninstall_bindings + + set --erase _fzf_search_vars_command + functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings + complete --erase fzf_configure_bindings + + set_color cyan + echo "fzf.fish uninstalled." + echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings." + set_color normal +end diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..f6ac507 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,40 @@ +# Enable Nix daemon +if test -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish' + source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish' +end + +# Source common environment variables +set -gx XDG_CONFIG_HOME ~/dotfiles +set -gx PERSONAL_PATH "$HOME/personal" +set -gx TODO "$PERSONAL_PATH/todo.md" +set -gx EDITOR nvim + +alias 'claude'='npx claude' + +# Add homebrew to PATH +set -gx PATH /opt/homebrew/bin $PATH + +# Disable fish greeting message +set -g fish_greeting + +if status is-interactive + bass source ~/dotfiles/scripts/aliases.sh + + # Initialize keychain for SSH agent management + if command -q keychain + eval (keychain --eval --quiet --agents ssh ~/.ssh/github-air ~/.ssh/macbook-pro) + end + + # Initialize Starship prompt + if command -q starship + set -gx STARSHIP_CONFIG ~/dotfiles/starship/starship.toml + starship init fish | source + end + + # Aliases + alias s='search' + + # Setup fzf + set -gx PATH ~/.fzf/bin $PATH + +end diff --git a/fish/fish_plugins b/fish/fish_plugins new file mode 100644 index 0000000..b9d49f3 --- /dev/null +++ b/fish/fish_plugins @@ -0,0 +1,3 @@ +jorgebucaran/fisher +edc/bass +patrickf1/fzf.fish diff --git a/fish/fish_variables b/fish/fish_variables new file mode 100644 index 0000000..358a699 --- /dev/null +++ b/fish/fish_variables @@ -0,0 +1,38 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR --export SSH_AGENT_PID:1692 +SETUVAR --export SSH_AUTH_SOCK:/var/folders/jw/lwkqkhhd0h75z8pbdfb1m4w40000gn/T//ssh\x2dMSmKgj2yyfo8/agent\x2e1691 +SETUVAR __fish_initialized:3800 +SETUVAR _fisher_edc_2F_bass_files:\x7e/dotfiles/fish/functions/__bass\x2epy\x1e\x7e/dotfiles/fish/functions/bass\x2efish +SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/dotfiles/fish/functions/fisher\x2efish\x1e\x7e/dotfiles/fish/completions/fisher\x2efish +SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/dotfiles/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_history\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/dotfiles/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/dotfiles/fish/conf\x2ed/fzf\x2efish\x1e\x7e/dotfiles/fish/completions/fzf_configure_bindings\x2efish +SETUVAR _fisher_plugins:jorgebucaran/fisher\x1eedc/bass\x1epatrickf1/fzf\x2efish +SETUVAR _fisher_upgraded_to_4_4:\x1d +SETUVAR fish_color_autosuggestion:brblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:normal +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:yellow\x1e\x2di +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_pager_color_selected_background:\x2dr diff --git a/fish/functions/__bass.py b/fish/functions/__bass.py new file mode 100644 index 0000000..3f02bd4 --- /dev/null +++ b/fish/functions/__bass.py @@ -0,0 +1,140 @@ +""" +To be used with a companion fish function like this: + + function refish + set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x + end + +""" + +from __future__ import print_function + +import json +import os +import signal +import subprocess +import sys +import traceback + + +BASH = 'bash' + +FISH_READONLY = [ + 'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version', + 'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode' +] + +IGNORED = [ + 'PS1', 'XPC_SERVICE_NAME' +] + +def ignored(name): + if name == 'PWD': # this is read only, but has special handling + return False + # ignore other read only variables + if name in FISH_READONLY: + return True + if name in IGNORED or name.startswith("BASH_FUNC"): + return True + if name.startswith('%'): + return True + return False + +def escape(string): + # use json.dumps to reliably escape quotes and backslashes + return json.dumps(string).replace(r'$', r'\$') + +def escape_identifier(word): + return escape(word.replace('?', '\\?')) + +def comment(string): + return '\n'.join(['# ' + line for line in string.split('\n')]) + +def gen_script(): + # Use the following instead of /usr/bin/env to read environment so we can + # deal with multi-line environment variables (and other odd cases). + env_reader = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable) + args = [BASH, '-c', env_reader] + output = subprocess.check_output(args, universal_newlines=True) + old_env = output.strip() + + pipe_r, pipe_w = os.pipe() + if sys.version_info >= (3, 4): + os.set_inheritable(pipe_w, True) + command = 'eval $1 && ({}; alias) >&{}'.format( + env_reader, + pipe_w + ) + args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])] + p = subprocess.Popen(args, universal_newlines=True, close_fds=False) + os.close(pipe_w) + with os.fdopen(pipe_r) as f: + new_env = f.readline() + alias_str = f.read() + if p.wait() != 0: + raise subprocess.CalledProcessError( + returncode=p.returncode, + cmd=' '.join(sys.argv[1:]), + output=new_env + alias_str + ) + new_env = new_env.strip() + + old_env = json.loads(old_env) + new_env = json.loads(new_env) + + script_lines = [] + + for k, v in new_env.items(): + if ignored(k): + continue + v1 = old_env.get(k) + if not v1: + script_lines.append(comment('adding %s=%s' % (k, v))) + elif v1 != v: + script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v))) + # process special variables + if k == 'PWD': + script_lines.append('cd %s' % escape(v)) + continue + else: + continue + if k == 'PATH': + value = ' '.join([escape(directory) + for directory in v.split(':')]) + else: + value = escape(v) + script_lines.append('set -g -x %s %s' % (k, value)) + + for var in set(old_env.keys()) - set(new_env.keys()): + script_lines.append(comment('removing %s' % var)) + script_lines.append('set -e %s' % var) + + script = '\n'.join(script_lines) + + alias_lines = [] + for line in alias_str.splitlines(): + _, rest = line.split(None, 1) + k, v = rest.split("=", 1) + alias_lines.append("alias " + escape_identifier(k) + "=" + v) + alias = '\n'.join(alias_lines) + + return script + '\n' + alias + +script_file = os.fdopen(3, 'w') + +if not sys.argv[1:]: + print('__bass_usage', file=script_file, end='') + sys.exit(0) + +try: + script = gen_script() +except subprocess.CalledProcessError as e: + sys.exit(e.returncode) +except Exception: + print('Bass internal error!', file=sys.stderr) + raise # traceback will output to stderr +except KeyboardInterrupt: + signal.signal(signal.SIGINT, signal.SIG_DFL) + os.kill(os.getpid(), signal.SIGINT) +else: + script_file.write(script) diff --git a/fish/functions/_fzf_configure_bindings_help.fish b/fish/functions/_fzf_configure_bindings_help.fish new file mode 100644 index 0000000..ecfe68e --- /dev/null +++ b/fish/functions/_fzf_configure_bindings_help.fish @@ -0,0 +1,43 @@ +function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings." + echo "\ +USAGE: + fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...] + +DESCRIPTION + fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it + previously installed. It installs bindings for both default and insert modes. fzf.fish executes + it without options on fish startup to install the out-of-the-box key bindings. + + By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding + can be configured using a namesake corresponding option: + COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION + Search Directory | Ctrl+Alt+F (F for file) | --directory + Search Git Log | Ctrl+Alt+L (L for log) | --git_log + Search Git Status | Ctrl+Alt+S (S for status) | --git_status + Search History | Ctrl+R (R for reverse) | --history + Search Processes | Ctrl+Alt+P (P for process) | --processes + Search Variables | Ctrl+V (V for variable) | --variables + Override a command's binding by specifying its corresponding option with the desired key + sequence. Disable a command's binding by specifying its corresponding option with no value. + + Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly + executed multiple times. Once the desired fzf_configure_bindings command has been found, add it + to your config.fish in order to persist the customized bindings. + + In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an + equals sign between an option's name and value. However, it does not validate key sequences. + + Pass -h or --help to print this help message and exit. + +EXAMPLES + Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V + \$ fzf_configure_bindings --directory=\cf --variables=\e\cv + Default bindings but disable Search History + \$ fzf_configure_bindings --history= + An agglomeration of different options + \$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes= + +SEE Also + To learn more about fish key bindings, see bind(1) and fish_key_reader(1). +" +end diff --git a/fish/functions/_fzf_extract_var_info.fish b/fish/functions/_fzf_extract_var_info.fish new file mode 100644 index 0000000..dd4e952 --- /dev/null +++ b/fish/functions/_fzf_extract_var_info.fish @@ -0,0 +1,15 @@ +# helper function for _fzf_search_variables +function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output." + # Extract only the lines about the variable, all of which begin with either + # $variable_name: ...or... $variable_name[ + string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output | + + # Strip the variable name prefix, including ": " for scope info lines + string replace --regex "^\\\$$variable_name(?:: )?" '' | + + # Distill the lines of values, replacing... + # [1]: |value| + # ...with... + # [1] value + string replace --regex ": \|(.*)\|" ' $1' +end diff --git a/fish/functions/_fzf_preview_changed_file.fish b/fish/functions/_fzf_preview_changed_file.fish new file mode 100644 index 0000000..78dd561 --- /dev/null +++ b/fish/functions/_fzf_preview_changed_file.fish @@ -0,0 +1,49 @@ +# helper for _fzf_search_git_status +# arg should be a line from git status --short, e.g. +# MM functions/_fzf_preview_changed_file.fish +# D README.md +# R LICENSE -> "New License" +function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file." + # remove quotes because they'll be interpreted literally by git diff + # no need to requote when referencing $path because fish does not perform word splitting + # https://fishshell.com/docs/current/fish_for_bash_users.html + set -f path (string unescape (string sub --start 4 $path_status)) + # first letter of short format shows index, second letter shows working tree + # https://git-scm.com/docs/git-status/2.35.0#_short_format + set -f index_status (string sub --length 1 $path_status) + set -f working_tree_status (string sub --start 2 --length 1 $path_status) + + set -f diff_opts --color=always + + if test $index_status = '?' + _fzf_report_diff_type Untracked + _fzf_preview_file $path + else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU + # Unmerged statuses taken directly from git status help's short format table + # Unmerged statuses are mutually exclusive with other statuses, so if we see + # these, then safe to assume the path is unmerged + _fzf_report_diff_type Unmerged + git diff $diff_opts -- $path + else + if test $index_status != ' ' + _fzf_report_diff_type Staged + + # renames are only detected in the index, never working tree, so only need to test for it here + # https://stackoverflow.com/questions/73954214 + if test $index_status = R + # diff the post-rename path with the original path, otherwise the diff will show the entire file as being added + set -f orig_and_new_path (string split --max 1 -- ' -> ' $path) + git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2] + # path currently has the form of "original -> current", so we need to correct it before it's used below + set path $orig_and_new_path[2] + else + git diff --staged $diff_opts -- $path + end + end + + if test $working_tree_status != ' ' + _fzf_report_diff_type Unstaged + git diff $diff_opts -- $path + end + end +end diff --git a/fish/functions/_fzf_preview_file.fish b/fish/functions/_fzf_preview_file.fish new file mode 100644 index 0000000..c926475 --- /dev/null +++ b/fish/functions/_fzf_preview_file.fish @@ -0,0 +1,43 @@ +# helper function for _fzf_search_directory and _fzf_search_git_status +function _fzf_preview_file --description "Print a preview for the given file based on its file type." + # because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file + # as one argument, we collect all the arguments into one single variable and treat that as the path + set -f file_path $argv + + if test -L "$file_path" # symlink + # notify user and recurse on the target of the symlink, which can be any of these file types + set -l target_path (realpath "$file_path") + + set_color yellow + echo "'$file_path' is a symlink to '$target_path'." + set_color normal + + _fzf_preview_file "$target_path" + else if test -f "$file_path" # regular file + if set --query fzf_preview_file_cmd + # need to escape quotes to make sure eval receives file_path as a single arg + eval "$fzf_preview_file_cmd '$file_path'" + else + bat --style=numbers --color=always "$file_path" + end + else if test -d "$file_path" # directory + if set --query fzf_preview_dir_cmd + # see above + eval "$fzf_preview_dir_cmd '$file_path'" + else + # -A list hidden files as well, except for . and .. + # -F helps classify files by appending symbols after the file name + command ls -A -F "$file_path" + end + else if test -c "$file_path" + _fzf_report_file_type "$file_path" "character device file" + else if test -b "$file_path" + _fzf_report_file_type "$file_path" "block device file" + else if test -S "$file_path" + _fzf_report_file_type "$file_path" socket + else if test -p "$file_path" + _fzf_report_file_type "$file_path" "named pipe" + else + echo "$file_path doesn't exist." >&2 + end +end diff --git a/fish/functions/_fzf_report_diff_type.fish b/fish/functions/_fzf_report_diff_type.fish new file mode 100644 index 0000000..cc26fb3 --- /dev/null +++ b/fish/functions/_fzf_report_diff_type.fish @@ -0,0 +1,18 @@ +# helper for _fzf_preview_changed_file +# prints out something like +# ╭────────╮ +# │ Staged │ +# ╰────────╯ +function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch." + # number of "-" to draw is the length of the string to box + 2 for padding + set -f repeat_count (math 2 + (string length $diff_type)) + set -f line (string repeat --count $repeat_count ─) + set -f top_border ╭$line╮ + set -f btm_border ╰$line╯ + + set_color yellow + echo $top_border + echo "│ $diff_type │" + echo $btm_border + set_color normal +end diff --git a/fish/functions/_fzf_report_file_type.fish b/fish/functions/_fzf_report_file_type.fish new file mode 100644 index 0000000..49e02e1 --- /dev/null +++ b/fish/functions/_fzf_report_file_type.fish @@ -0,0 +1,6 @@ +# helper function for _fzf_preview_file +function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file." + set_color red + echo "Cannot preview '$file_path': it is a $file_type." + set_color normal +end diff --git a/fish/functions/_fzf_search_directory.fish b/fish/functions/_fzf_search_directory.fish new file mode 100644 index 0000000..4541eec --- /dev/null +++ b/fish/functions/_fzf_search_directory.fish @@ -0,0 +1,33 @@ +function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths." + # Directly use fd binary to avoid output buffering delay caused by a fd alias, if any. + # Debian-based distros install fd as fdfind and the fd package is something else, so + # check for fdfind first. Fall back to "fd" for a clear error message. + set -f fd_cmd (command -v fdfind || command -v fd || echo "fd") + set -f --append fd_cmd --color=always $fzf_fd_opts + + set -f fzf_arguments --multi --ansi $fzf_directory_opts + set -f token (commandline --current-token) + # expand any variables or leading tilde (~) in the token + set -f expanded_token (eval echo -- $token) + # unescape token because it's already quoted so backslashes will mess up the path + set -f unescaped_exp_token (string unescape -- $expanded_token) + + # If the current token is a directory and has a trailing slash, + # then use it as fd's base directory. + if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token" + set --append fd_cmd --base-directory=$unescaped_exp_token + # use the directory name as fzf's prompt to indicate the search is limited to that directory + set --prepend fzf_arguments --prompt="Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}" + set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) + else + set --prepend fzf_arguments --prompt="Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}' + set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) + end + + + if test $status -eq 0 + commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ') + end + + commandline --function repaint +end diff --git a/fish/functions/_fzf_search_git_log.fish b/fish/functions/_fzf_search_git_log.fish new file mode 100644 index 0000000..aa54724 --- /dev/null +++ b/fish/functions/_fzf_search_git_log.fish @@ -0,0 +1,36 @@ +function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash." + if not git rev-parse --git-dir >/dev/null 2>&1 + echo '_fzf_search_git_log: Not in a git repository.' >&2 + else + if not set --query fzf_git_log_format + # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below + set -f fzf_git_log_format '%C(bold blue)%h%C(reset) - %C(cyan)%ad%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)' + end + + set -f preview_cmd 'git show --color=always --stat --patch {1}' + if set --query fzf_diff_highlighter + set preview_cmd "$preview_cmd | $fzf_diff_highlighter" + end + + set -f selected_log_lines ( + git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \ + _fzf_wrapper --ansi \ + --multi \ + --scheme=history \ + --prompt="Git Log> " \ + --preview=$preview_cmd \ + --query=(commandline --current-token) \ + $fzf_git_log_opts + ) + if test $status -eq 0 + for line in $selected_log_lines + set -f abbreviated_commit_hash (string split --field 1 " " $line) + set -f full_commit_hash (git rev-parse $abbreviated_commit_hash) + set -f --append commit_hashes $full_commit_hash + end + commandline --current-token --replace (string join ' ' $commit_hashes) + end + end + + commandline --function repaint +end diff --git a/fish/functions/_fzf_search_git_status.fish b/fish/functions/_fzf_search_git_status.fish new file mode 100644 index 0000000..358f88c --- /dev/null +++ b/fish/functions/_fzf_search_git_status.fish @@ -0,0 +1,41 @@ +function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths." + if not git rev-parse --git-dir >/dev/null 2>&1 + echo '_fzf_search_git_status: Not in a git repository.' >&2 + else + set -f preview_cmd '_fzf_preview_changed_file {}' + if set --query fzf_diff_highlighter + set preview_cmd "$preview_cmd | $fzf_diff_highlighter" + end + + set -f selected_paths ( + # Pass configuration color.status=always to force status to use colors even though output is sent to a pipe + git -c color.status=always status --short | + _fzf_wrapper --ansi \ + --multi \ + --prompt="Git Status> " \ + --query=(commandline --current-token) \ + --preview=$preview_cmd \ + --nth="2.." \ + $fzf_git_status_opts + ) + if test $status -eq 0 + # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle + # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping") + set -f cleaned_paths + + for path in $selected_paths + if test (string sub --length 1 $path) = R + # path has been renamed and looks like "R LICENSE -> LICENSE.md" + # extract the path to use from after the arrow + set --append cleaned_paths (string split -- "-> " $path)[-1] + else + set --append cleaned_paths (string sub --start=4 $path) + end + end + + commandline --current-token --replace -- (string join ' ' $cleaned_paths) + end + end + + commandline --function repaint +end diff --git a/fish/functions/_fzf_search_history.fish b/fish/functions/_fzf_search_history.fish new file mode 100644 index 0000000..cafbce9 --- /dev/null +++ b/fish/functions/_fzf_search_history.fish @@ -0,0 +1,39 @@ +function _fzf_search_history --description "Search command history. Replace the command line with the selected command." + # history merge incorporates history changes from other fish sessions + # it errors out if called in private mode + if test -z "$fish_private_mode" + builtin history merge + end + + if not set --query fzf_history_time_format + # Reference https://devhints.io/strftime to understand strftime format symbols + set -f fzf_history_time_format "%m-%d %H:%M:%S" + end + + # Delinate time from command in history entries using the vertical box drawing char (U+2502). + # Then, to get raw command from history entries, delete everything up to it. The ? on regex is + # necessary to make regex non-greedy so it won't match into commands containing the char. + set -f time_prefix_regex '^.*? │ ' + # Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line + set -f commands_selected ( + builtin history --null --show-time="$fzf_history_time_format │ " | + _fzf_wrapper --read0 \ + --print0 \ + --multi \ + --scheme=history \ + --prompt="History> " \ + --query=(commandline) \ + --preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \ + --preview-window="bottom:3:wrap" \ + $fzf_history_opts | + string split0 | + # remove timestamps from commands selected + string replace --regex $time_prefix_regex '' + ) + + if test $status -eq 0 + commandline --replace -- $commands_selected + end + + commandline --function repaint +end diff --git a/fish/functions/_fzf_search_processes.fish b/fish/functions/_fzf_search_processes.fish new file mode 100644 index 0000000..133a880 --- /dev/null +++ b/fish/functions/_fzf_search_processes.fish @@ -0,0 +1,32 @@ +function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process." + # Directly use ps command because it is often aliased to a different command entirely + # or with options that dirty the search results and preview output + set -f ps_cmd (command -v ps || echo "ps") + # use all caps to be consistent with ps default format + # snake_case because ps doesn't seem to allow spaces in the field names + set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command') + set -f processes_selected ( + $ps_cmd -A -opid,command | \ + _fzf_wrapper --multi \ + --prompt="Processes> " \ + --query (commandline --current-token) \ + --ansi \ + # first line outputted by ps is a header, so we need to mark it as so + --header-lines=1 \ + # ps uses exit code 1 if the process was not found, in which case show an message explaining so + --preview="$ps_cmd -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \ + --preview-window="bottom:4:wrap" \ + $fzf_processes_opts + ) + + if test $status -eq 0 + for process in $processes_selected + set -f --append pids_selected (string split --no-empty --field=1 -- " " $process) + end + + # string join to replace the newlines outputted by string split with spaces + commandline --current-token --replace -- (string join ' ' $pids_selected) + end + + commandline --function repaint +end diff --git a/fish/functions/_fzf_search_variables.fish b/fish/functions/_fzf_search_variables.fish new file mode 100644 index 0000000..52a7c70 --- /dev/null +++ b/fish/functions/_fzf_search_variables.fish @@ -0,0 +1,47 @@ +# This function expects the following two arguments: +# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables +# argument 2 = output of (set --names | psub), i.e. a file with all variable names +function _fzf_search_variables --argument-names set_show_output set_names_output --description "Search and preview shell variables. Replace the current token with the selected variable." + if test -z "$set_names_output" + printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2 + + commandline --function repaint + return 22 # 22 means invalid argument in POSIX + end + + # Exclude the history variable from being piped into fzf because + # 1. it's not included in $set_names_output + # 2. it tends to be a very large value => increases computation time + # 3._fzf_search_history is a much better way to examine history anyway + set -f all_variable_names (string match --invert history <$set_names_output) + + set -f current_token (commandline --current-token) + # Use the current token to pre-populate fzf's query. If the current token begins + # with a $, remove it from the query so that it will better match the variable names + set -f cleaned_curr_token (string replace -- '$' '' $current_token) + + set -f variable_names_selected ( + printf '%s\n' $all_variable_names | + _fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \ + --prompt="Variables> " \ + --preview-window="wrap" \ + --multi \ + --query=$cleaned_curr_token \ + $fzf_variables_opts + ) + + if test $status -eq 0 + # If the current token begins with a $, do not overwrite the $ when + # replacing the current token with the selected variable. + # Uses brace expansion to prepend $ to each variable name. + commandline --current-token --replace ( + if string match --quiet -- '$*' $current_token + string join " " \${$variable_names_selected} + else + string join " " $variable_names_selected + end + ) + end + + commandline --function repaint +end diff --git a/fish/functions/_fzf_wrapper.fish b/fish/functions/_fzf_wrapper.fish new file mode 100644 index 0000000..486e36c --- /dev/null +++ b/fish/functions/_fzf_wrapper.fish @@ -0,0 +1,21 @@ +function _fzf_wrapper --description "Prepares some environment variables before executing fzf." + # Make sure fzf uses fish to execute preview commands, some of which + # are autoloaded fish functions so don't exist in other shells. + # Use --function so that it doesn't clobber SHELL outside this function. + set -f --export SHELL (command --search fish) + + # If neither FZF_DEFAULT_OPTS nor FZF_DEFAULT_OPTS_FILE are set, then set some sane defaults. + # See https://github.com/junegunn/fzf#environment-variables + set --query FZF_DEFAULT_OPTS FZF_DEFAULT_OPTS_FILE + if test $status -eq 2 + # cycle allows jumping between the first and last results, making scrolling faster + # layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env + # border shows where the fzf window begins and ends + # height=90% leaves space to see the current command and some scrollback, maintaining context of work + # preview-window=wrap wraps long lines in the preview window, making reading easier + # marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >) + set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"' + end + + fzf $argv +end diff --git a/fish/functions/bass.fish b/fish/functions/bass.fish new file mode 100644 index 0000000..2b3af16 --- /dev/null +++ b/fish/functions/bass.fish @@ -0,0 +1,29 @@ +function bass + set -l bash_args $argv + set -l bass_debug + if test "$bash_args[1]_" = '-d_' + set bass_debug true + set -e bash_args[1] + end + + set -l script_file (mktemp) + if command -v python3 >/dev/null 2>&1 + command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file + else + command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file + end + set -l bass_status $status + if test $bass_status -ne 0 + return $bass_status + end + + if test -n "$bass_debug" + cat $script_file + end + source $script_file + command rm $script_file +end + +function __bass_usage + echo "Usage: bass [-d] " +end diff --git a/fish/functions/fisher.fish b/fish/functions/fisher.fish new file mode 100644 index 0000000..e915cb8 --- /dev/null +++ b/fish/functions/fisher.fish @@ -0,0 +1,240 @@ +function fisher --argument-names cmd --description "A plugin manager for Fish" + set --query fisher_path || set --local fisher_path $__fish_config_dir + set --local fisher_version 4.4.5 + set --local fish_plugins $__fish_config_dir/fish_plugins + + switch "$cmd" + case -v --version + echo "fisher, version $fisher_version" + case "" -h --help + echo "Usage: fisher install Install plugins" + echo " fisher remove Remove installed plugins" + echo " fisher update Update installed plugins" + echo " fisher update Update all installed plugins" + echo " fisher list [] List installed plugins matching regex" + echo "Options:" + echo " -v, --version Print version" + echo " -h, --help Print this help message" + echo "Variables:" + echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~ + case ls list + string match --entire --regex -- "$argv[2]" $_fisher_plugins + case install update remove + isatty || read --local --null --array stdin && set --append argv $stdin + + set --local install_plugins + set --local update_plugins + set --local remove_plugins + set --local arg_plugins $argv[2..-1] + set --local old_plugins $_fisher_plugins + set --local new_plugins + + test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins | string replace -- \~ ~) + + if ! set --query argv[2] + if test "$cmd" != update + echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1 + else if ! set --query file_plugins + echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1 + end + set arg_plugins $file_plugins + end + + for plugin in $arg_plugins + set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin) + contains -- "$plugin" $new_plugins || set --append new_plugins $plugin + end + + if set --query argv[2] + for plugin in $new_plugins + if contains -- "$plugin" $old_plugins + test "$cmd" = remove && + set --append remove_plugins $plugin || + set --append update_plugins $plugin + else if test "$cmd" = install + set --append install_plugins $plugin + else + echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1 + end + end + else + for plugin in $new_plugins + contains -- "$plugin" $old_plugins && + set --append update_plugins $plugin || + set --append install_plugins $plugin + end + + for plugin in $old_plugins + contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin + end + end + + set --local pid_list + set --local source_plugins + set --local fetch_plugins $update_plugins $install_plugins + set --local fish_path (status fish-path) + + echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal) + + for plugin in $fetch_plugins + set --local source (command mktemp -d) + set --append source_plugins $source + + command mkdir -p $source/{completions,conf.d,themes,functions} + + $fish_path --command " + if test -e $plugin + command cp -Rf $plugin/* $source + else + set temp (command mktemp -d) + set repo (string split -- \@ $plugin) || set repo[2] HEAD + + if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1]) + set name (string split -- / \$path)[-1] + set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz + else + set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2] + end + + echo Fetching (set_color --underline)\$url(set_color normal) + + if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null + command cp -Rf \$temp/*/* $source + else + echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2 + command rm -rf $source + end + + command rm -rf \$temp + end + + set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files + " & + + set --append pid_list (jobs --last --pid) + end + + wait $pid_list 2>/dev/null + + for plugin in $fetch_plugins + if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source + if set --local index (contains --index -- "$plugin" $install_plugins) + set --erase install_plugins[$index] + else + set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)] + end + end + end + + for plugin in $update_plugins $remove_plugins + if set --local index (contains --index -- "$plugin" $_fisher_plugins) + set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files + + if contains -- "$plugin" $remove_plugins + for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var) + emit {$name}_uninstall + end + printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ + set --erase _fisher_plugins[$index] + end + + command rm -rf (string replace -- \~ ~ $$plugin_files_var) + + functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var) + + for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var) + complete --erase --command $name + end + + set --erase $plugin_files_var + end + end + + if set --query update_plugins[1] || set --query install_plugins[1] + command mkdir -p $fisher_path/{functions,themes,conf.d,completions} + end + + for plugin in $update_plugins $install_plugins + set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] + set --local files $source/{functions,themes,conf.d,completions}/* + + if set --local index (contains --index -- $plugin $install_plugins) + set --local user_files $fisher_path/{functions,themes,conf.d,completions}/* + set --local conflict_files + + for file in (string replace -- $source/ $fisher_path/ $files) + contains -- $file $user_files && set --append conflict_files $file + end + + if set --query conflict_files[1] && set --erase install_plugins[$index] + echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2 + continue + end + end + + for file in (string replace -- $source/ "" $files) + command cp -RLf $source/$file $fisher_path/$file + end + + set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files + + set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~) + + contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin + contains -- $plugin $install_plugins && set --local event install || set --local event update + + printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ + + for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~) + source $file + if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file) + emit {$name}_$event + end + end + end + + command rm -rf $source_plugins + + if set --query _fisher_plugins[1] + set --local commit_plugins + + for plugin in $file_plugins + contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin + end + + for plugin in $_fisher_plugins + contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin + end + + string replace --regex -- $HOME \~ $commit_plugins >$fish_plugins + else + set --erase _fisher_plugins + command rm -f $fish_plugins + end + + set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins) + + test "$total" != "0 0 0" && echo (string join ", " ( + test $total[1] = 0 || echo "Installed $total[1]") ( + test $total[2] = 0 || echo "Updated $total[2]") ( + test $total[3] = 0 || echo "Removed $total[3]") + ) plugin/s + case \* + echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1 + end +end + +if ! set --query _fisher_upgraded_to_4_4 + set --universal _fisher_upgraded_to_4_4 + if functions --query _fisher_list + set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share + command rm -rf $XDG_DATA_HOME/fisher + functions --erase _fisher_{list,plugin_parse} + fisher update >/dev/null 2>/dev/null + else + for var in (set --names | string match --entire --regex '^_fisher_.+_files$') + set $var (string replace -- ~ \~ $$var) + end + functions --erase _fisher_fish_postexec + end +end diff --git a/fish/functions/fzf_configure_bindings.fish b/fish/functions/fzf_configure_bindings.fish new file mode 100644 index 0000000..4b4e7a2 --- /dev/null +++ b/fish/functions/fzf_configure_bindings.fish @@ -0,0 +1,46 @@ +# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect +# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1 +function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options." + # no need to install bindings if not in interactive mode or running tests + status is-interactive || test "$CI" = true; or return + + set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?' + argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null + if test $status -ne 0 + echo "Invalid option or a positional argument was provided." >&2 + _fzf_configure_bindings_help + return 22 + else if set --query _flag_help + _fzf_configure_bindings_help + return + else + # Initialize with default key sequences and then override or disable them based on flags + # index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables + set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape + set --query _flag_directory && set key_sequences[1] "$_flag_directory" + set --query _flag_git_log && set key_sequences[2] "$_flag_git_log" + set --query _flag_git_status && set key_sequences[3] "$_flag_git_status" + set --query _flag_history && set key_sequences[4] "$_flag_history" + set --query _flag_processes && set key_sequences[5] "$_flag_processes" + set --query _flag_variables && set key_sequences[6] "$_flag_variables" + + # If fzf bindings already exists, uninstall it first for a clean slate + if functions --query _fzf_uninstall_bindings + _fzf_uninstall_bindings + end + + for mode in default insert + test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory + test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log + test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status + test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history + test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes + test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command" + end + + function _fzf_uninstall_bindings --inherit-variable key_sequences + bind --erase -- $key_sequences + bind --erase --mode insert -- $key_sequences + end + end +end diff --git a/fish/functions/search.fish b/fish/functions/search.fish new file mode 100644 index 0000000..6fdf8a9 --- /dev/null +++ b/fish/functions/search.fish @@ -0,0 +1,14 @@ +function search -d "Search files with fzf and open in editor" + set term_height (tput lines) + set min_height 20 + + if test "$term_height" -ge "$min_height" + set files (fzf --preview 'bat --style=numbers --color=always {}' --height 60% -m) + else + set files (fzf --no-preview --height 40% -m) + end + + if test $status -eq 0; and test -n "$files" + eval "$EDITOR" $files + end +end \ No newline at end of file diff --git a/fish/setup.sh b/fish/setup.sh new file mode 100644 index 0000000..78dada2 --- /dev/null +++ b/fish/setup.sh @@ -0,0 +1,8 @@ + +# need to symlink as per Makefile +# +# # fisher +# +curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher + +fisher install edc/bass From 6bfe4900dd98bb95ff02aa64d06bf826c1c3b2bf Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 8 Aug 2025 18:38:31 +1200 Subject: [PATCH 08/29] feat --- dotfiles/.gitconfig | 1 + dotfiles/.tmux.conf | 1 + dotfiles/common/.zshenv | 1 + fish/config.fish | 19 +--------- fish/fish_plugins | 1 + fish/fish_variables | 8 +++- fish/setup.sh | 7 +--- kitty/kitty.conf | 2 - nvim/lazy-lock.json | 1 + nvim/lua/config/augroup.lua | 35 ++++++++++-------- nvim/lua/plugins/noice.lua | 61 +++++++++++++++---------------- nvim/lua/plugins/text-editing.lua | 14 ------- scripts/aliases.sh | 2 + starship/starship.toml | 42 ++++++++++----------- yabai/.yabairc | 2 +- 15 files changed, 87 insertions(+), 110 deletions(-) diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig index 5a42591..0d66549 100644 --- a/dotfiles/.gitconfig +++ b/dotfiles/.gitconfig @@ -3,6 +3,7 @@ diffs = diff --staged logg = log --pretty=fuller --abbrev-commit --stat -n 5 loggg = log --pretty=fuller --abbrev-commit --stat --patch -n 5 + logggg = log --oneline --decorate rmf = rm -f [column] diff --git a/dotfiles/.tmux.conf b/dotfiles/.tmux.conf index 5a85c2d..5cc09a4 100644 --- a/dotfiles/.tmux.conf +++ b/dotfiles/.tmux.conf @@ -17,6 +17,7 @@ set -g base-index 1 set -g default-shell $SHELL set -g default-terminal screen-256color set -g status-keys vi +set -g mode-keys vi set -g history-limit 100000 # KEYS diff --git a/dotfiles/common/.zshenv b/dotfiles/common/.zshenv index e08433a..449d153 100644 --- a/dotfiles/common/.zshenv +++ b/dotfiles/common/.zshenv @@ -3,6 +3,7 @@ if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi export EDITOR=$(which nvim) +export XDG_CONFIG_HOME=$HOME/dotfiles if command -v launchctl >/dev/null 2>&1; then launchctl setenv XDG_CONFIG_HOME $XDG_CONFIG_HOME fi diff --git a/fish/config.fish b/fish/config.fish index f6ac507..0e325eb 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -10,6 +10,7 @@ set -gx TODO "$PERSONAL_PATH/todo.md" set -gx EDITOR nvim alias 'claude'='npx claude' +alias 't'='tmux new' # Add homebrew to PATH set -gx PATH /opt/homebrew/bin $PATH @@ -19,22 +20,6 @@ set -g fish_greeting if status is-interactive bass source ~/dotfiles/scripts/aliases.sh - - # Initialize keychain for SSH agent management - if command -q keychain - eval (keychain --eval --quiet --agents ssh ~/.ssh/github-air ~/.ssh/macbook-pro) - end - - # Initialize Starship prompt - if command -q starship - set -gx STARSHIP_CONFIG ~/dotfiles/starship/starship.toml - starship init fish | source - end - - # Aliases - alias s='search' - - # Setup fzf + starship init fish | source set -gx PATH ~/.fzf/bin $PATH - end diff --git a/fish/fish_plugins b/fish/fish_plugins index b9d49f3..21d890d 100644 --- a/fish/fish_plugins +++ b/fish/fish_plugins @@ -1,3 +1,4 @@ jorgebucaran/fisher edc/bass patrickf1/fzf.fish +jethrokuan/z diff --git a/fish/fish_variables b/fish/fish_variables index 358a699..dda8531 100644 --- a/fish/fish_variables +++ b/fish/fish_variables @@ -2,11 +2,17 @@ # VERSION: 3.0 SETUVAR --export SSH_AGENT_PID:1692 SETUVAR --export SSH_AUTH_SOCK:/var/folders/jw/lwkqkhhd0h75z8pbdfb1m4w40000gn/T//ssh\x2dMSmKgj2yyfo8/agent\x2e1691 +SETUVAR ZO_CMD:zo +SETUVAR Z_CMD:z +SETUVAR Z_DATA:/Users/adamgreen/\x2elocal/share/z/data +SETUVAR Z_DATA_DIR:/Users/adamgreen/\x2elocal/share/z +SETUVAR Z_EXCLUDE:\x5e/Users/adamgreen\x24 SETUVAR __fish_initialized:3800 SETUVAR _fisher_edc_2F_bass_files:\x7e/dotfiles/fish/functions/__bass\x2epy\x1e\x7e/dotfiles/fish/functions/bass\x2efish +SETUVAR _fisher_jethrokuan_2F_z_files:\x7e/dotfiles/fish/functions/__z\x2efish\x1e\x7e/dotfiles/fish/functions/__z_add\x2efish\x1e\x7e/dotfiles/fish/functions/__z_clean\x2efish\x1e\x7e/dotfiles/fish/functions/__z_complete\x2efish\x1e\x7e/dotfiles/fish/conf\x2ed/z\x2efish SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/dotfiles/fish/functions/fisher\x2efish\x1e\x7e/dotfiles/fish/completions/fisher\x2efish SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/dotfiles/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_history\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/dotfiles/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/dotfiles/fish/conf\x2ed/fzf\x2efish\x1e\x7e/dotfiles/fish/completions/fzf_configure_bindings\x2efish -SETUVAR _fisher_plugins:jorgebucaran/fisher\x1eedc/bass\x1epatrickf1/fzf\x2efish +SETUVAR _fisher_plugins:jorgebucaran/fisher\x1eedc/bass\x1epatrickf1/fzf\x2efish\x1ejethrokuan/z SETUVAR _fisher_upgraded_to_4_4:\x1d SETUVAR fish_color_autosuggestion:brblack SETUVAR fish_color_cancel:\x2dr diff --git a/fish/setup.sh b/fish/setup.sh index 78dada2..9fc9266 100644 --- a/fish/setup.sh +++ b/fish/setup.sh @@ -1,8 +1,3 @@ - -# need to symlink as per Makefile -# -# # fisher -# curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher - fisher install edc/bass +fisher install jethrokuan/z diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 82f4168..3ba882b 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -19,5 +19,3 @@ confirm_os_window_close 0 include ~/dotfiles/kitty/current-theme.conf macos_titlebar_color #282A36 - -# shell fish diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 23fca9f..b42e49e 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -64,6 +64,7 @@ "vim-textobj-markdown": { "branch": "master", "commit": "9cba182b2c30afc982ace0deb1200cc394799799" }, "vim-textobj-python": { "branch": "master", "commit": "06de233e805b6bcfd0fde7591c64cf927637feb7" }, "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, + "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" }, "winresizer": { "branch": "master", "commit": "9bd559a03ccec98a458e60c705547119eb5350f3" }, "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } } diff --git a/nvim/lua/config/augroup.lua b/nvim/lua/config/augroup.lua index e50bd7d..84245de 100644 --- a/nvim/lua/config/augroup.lua +++ b/nvim/lua/config/augroup.lua @@ -29,22 +29,25 @@ augroup END ]]) -- .md -vim.api.nvim_exec( - [[ - augroup markdown - autocmd FileType markdown setlocal syntax=markdown - autocmd FileType markdown setlocal spell spelllang=en_nz spellfile=~/dotfiles/nvim/spell/en.utf-8.add - autocmd FileType markdown setlocal noautoindent - autocmd FileType markdown setlocal nosmartindent - autocmd FileType markdown setlocal expandtab - autocmd FileType markdown let g:indentLine_enabled=0 - autocmd FileType markdown syntax keyword Todo TODO DONE - set complete+=k - autocmd FileType markdown setlocal conceallevel=0 - augroup end - ]], - false -) +vim.opt.spell = false +local markdown_group = vim.api.nvim_create_augroup("markdown", { clear = true }) +vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + group = markdown_group, + callback = function() + vim.opt_local.syntax = "markdown" + vim.opt_local.spell = true + vim.opt_local.spelllang = { "en_nz" } + vim.opt_local.spellfile = vim.fn.expand("~/dotfiles/nvim/spell/en.utf-8.add") + vim.opt_local.autoindent = false + vim.opt_local.smartindent = false + vim.opt_local.expandtab = true + vim.g.indentLine_enabled = 0 + vim.cmd([[syntax keyword Todo TODO DONE]]) + vim.opt.complete:append("k") + vim.opt_local.conceallevel = 0 + end, +}) -- .py vim.api.nvim_create_autocmd("FileType", { diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua index faa3e9d..afbac88 100644 --- a/nvim/lua/plugins/noice.lua +++ b/nvim/lua/plugins/noice.lua @@ -7,40 +7,37 @@ return { }, config = function() require("noice").setup({ - cmdline = { - enabled = true, - }, - popup = { - enabled = false, - }, - popupmenu = { - enabled = true, - }, - -- this is the messages that appear in top right - -- notify = { + -- cmdline = { + -- enabled = true, + -- }, + -- popupmenu = { + -- enabled = false, + -- }, + -- -- this is the messages that appear in top right + -- -- notify = { + -- -- enabled = false, + -- -- }, + -- messages = { -- enabled = false, -- }, - messages = { - enabled = false, - }, - lsp = { - signature = { - enabled = false, - }, - progress = { - enabled = false, - }, - message = { - enabled = false, - }, - }, - presets = { - bottom_search = false, - command_palette = false, - -- long_message_to_split = true, - inc_rename = false, - lsp_doc_border = false, - }, + -- lsp = { + -- signature = { + -- enabled = false, + -- }, + -- progress = { + -- enabled = false, + -- }, + -- message = { + -- enabled = false, + -- }, + -- }, + -- presets = { + -- bottom_search = false, + -- command_palette = false, + -- -- long_message_to_split = true, + -- inc_rename = false, + -- lsp_doc_border = false, + -- }, }) end, } diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua index 0af71eb..1585f36 100644 --- a/nvim/lua/plugins/text-editing.lua +++ b/nvim/lua/plugins/text-editing.lua @@ -38,11 +38,6 @@ return { }, }, }, - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = {}, - }, { "mbbill/undotree", config = function() @@ -127,15 +122,6 @@ return { "folke/todo-comments.nvim", cmd = { "TodoTrouble", "TodoTelescope" }, config = true, - -- stylua: ignore - keys = { - { "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" }, - { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" }, - { "xt", "TodoTrouble", desc = "Todo (Trouble)" }, - { "xT", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme (Trouble)" }, - { "st", "TodoTelescope", desc = "Todo" }, - { "sT", "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, - }, }, { "PedramNavid/dbtpal", diff --git a/scripts/aliases.sh b/scripts/aliases.sh index edaa308..e40f0ad 100755 --- a/scripts/aliases.sh +++ b/scripts/aliases.sh @@ -153,3 +153,5 @@ alias lg='lazygit' alias air='ssh adamgreen@air.local' alias macbook='ssh adam@macbook.local' + +alias f='fish' diff --git a/starship/starship.toml b/starship/starship.toml index 9aa4d83..66e77dc 100644 --- a/starship/starship.toml +++ b/starship/starship.toml @@ -5,10 +5,15 @@ format = """$shell$hostname$directory$line_break$character""" right_format = """$cmd_duration$git_branch$python$nix_shell""" [shell] - fish_indicator = "  " - zsh_indicator = " 󰬇" - bash_indicator = " $" - disabled = false +fish_indicator = "[  ](bold purple)" +zsh_indicator = " 󰬇" +bash_indicator = " $" +disabled = false + +[localip] +ssh_only = false +format = " [$localipv4](blue) " +disabled = false [character] # success_symbol = "[ \\$](green)" @@ -16,34 +21,29 @@ success_symbol = "[ >∶](green)" error_symbol = "[ 󰙦 ](red)" vimcmd_symbol = "[  ](green)" +[hostname] +ssh_only = false +format = "on [$hostname](fg:green) " + [directory] truncate_to_repo = false format = "in [$path]($style)[$read_only]($read_only_style) " style='bold purple' +[cmd_duration] +min_time = 0 +format = "[took]() [$duration](bold purple) " +show_milliseconds = true +disabled = false + [git_branch] symbol = "" -format = " [on]() [$symbol $branch(:$remote_branch)](bold green)" - -[hostname] -ssh_only = false -format = "on [$hostname](fg:green) " +format = "[on]() [$symbol $branch(:$remote_branch)](bold green) " [python] -format=' [with]() [${symbol} ${version}](bold blue)' +format='[with]() [${symbol} ${version}](bold blue) ' symbol="" -[localip] -ssh_only = false -format = " [$localipv4](blue) " -disabled = false - -[cmd_duration] -min_time = 0 -format = "[took]() [$duration](bold purple)" -show_milliseconds = true -disabled = false - [nix_shell] disabled = false impure_msg = '' diff --git a/yabai/.yabairc b/yabai/.yabairc index 4beec7d..5de178a 100755 --- a/yabai/.yabairc +++ b/yabai/.yabairc @@ -12,7 +12,7 @@ for space in 2 3 4; do echo "Configuring space $space" yabai -m config --space "$space" \ layout bsp \ - auto_balance off \ + auto_balance on \ split_ratio 0.5 \ split_type vertical \ mouse_follows_focus off \ From 5a75a04ec53b547acb80f1d29001268933a5497a Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 8 Aug 2025 20:43:00 +1200 Subject: [PATCH 09/29] feat --- nvim/lua/plugins/cmp.lua | 18 +++++------------- nvim/lua/plugins/noice.lua | 14 +++++++------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 2cf3a3f..66b07b1 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -22,10 +22,13 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { - -- snippets = { preset = "luasnip" }, + snippets = { preset = "luasnip" }, keymap = { - preset = "enter", + preset = "default", + [""] = { "select_next", "fallback" }, + [""] = { "select_prev", "fallback" }, + [""] = { "accept", "fallback" }, }, cmdline = { @@ -34,17 +37,6 @@ return { menu = { auto_show = true }, ghost_text = { enabled = true }, }, - keymap = { - preset = "none", - [""] = { "select_and_accept" }, - [""] = { "select_next" }, - [""] = { "select_prev" }, - [""] = { - "fallback", - "select_accept_and_enter", - "accept_and_enter", - }, - }, }, completion = { diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua index afbac88..a44dc18 100644 --- a/nvim/lua/plugins/noice.lua +++ b/nvim/lua/plugins/noice.lua @@ -13,13 +13,13 @@ return { -- popupmenu = { -- enabled = false, -- }, - -- -- this is the messages that appear in top right - -- -- notify = { - -- -- enabled = false, - -- -- }, - -- messages = { - -- enabled = false, - -- }, + -- this is the messages that appear in top right + notify = { + enabled = false, + }, + messages = { + enabled = false, + }, -- lsp = { -- signature = { -- enabled = false, From f25aa1bc88fc21cc38d7681285239f6ae7e1e4b0 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sun, 10 Aug 2025 23:50:20 +1200 Subject: [PATCH 10/29] feat --- README.md | 2 +- fish/config.fish | 1 + nvim/lua/plugins/cmp.lua | 2 +- nvim/lua/plugins/noice.lua | 31 ++++++++++++++++--------------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f99d0ae..f5f076a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ This will also setup dependencies with Nix. ### Python -Ian stall `uv` and setup a global Python installation in a virtual environment: +Install `uv` and setup a global Python installation in a virtual environment: ```bash $ make python diff --git a/fish/config.fish b/fish/config.fish index 0e325eb..6944dbd 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -11,6 +11,7 @@ set -gx EDITOR nvim alias 'claude'='npx claude' alias 't'='tmux new' +alias 's'='search' # Add homebrew to PATH set -gx PATH /opt/homebrew/bin $PATH diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 66b07b1..333924f 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -22,7 +22,7 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { - snippets = { preset = "luasnip" }, + -- snippets = { preset = "luasnip" }, keymap = { preset = "default", diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua index a44dc18..900be3c 100644 --- a/nvim/lua/plugins/noice.lua +++ b/nvim/lua/plugins/noice.lua @@ -18,23 +18,24 @@ return { enabled = false, }, messages = { - enabled = false, + enabled = true, + view = "mini", + }, + lsp = { + signature = { + enabled = false, + }, + progress = { + enabled = false, + }, + message = { + enabled = false, + }, }, - -- lsp = { - -- signature = { - -- enabled = false, - -- }, - -- progress = { - -- enabled = false, - -- }, - -- message = { - -- enabled = false, - -- }, - -- }, -- presets = { - -- bottom_search = false, - -- command_palette = false, - -- -- long_message_to_split = true, + -- bottom_search = false, + -- command_palette = false, + -- long_message_to_split = true, -- inc_rename = false, -- lsp_doc_border = false, -- }, From c7c85664eb08d366113f5befcde4548bda0c2453 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Mon, 18 Aug 2025 04:13:25 +1200 Subject: [PATCH 11/29] feat --- fish/config.fish | 1 + scripts/aliases.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fish/config.fish b/fish/config.fish index 6944dbd..9c2a829 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -9,6 +9,7 @@ set -gx PERSONAL_PATH "$HOME/personal" set -gx TODO "$PERSONAL_PATH/todo.md" set -gx EDITOR nvim +bass source ~/dotfiles/scripts/aliases.sh alias 'claude'='npx claude' alias 't'='tmux new' alias 's'='search' diff --git a/scripts/aliases.sh b/scripts/aliases.sh index e40f0ad..6e8ffb3 100755 --- a/scripts/aliases.sh +++ b/scripts/aliases.sh @@ -51,7 +51,7 @@ alias pipr='pip install -r requirements.txt' alias cheat='$EDITOR $PERSONAL_PATH/resource/cheat_sheet.md' alias ideas='$EDITOR $HOME/dss/notes/content/ideas/README.md' alias inb='inbox' -alias inbox='$EDITOR $PERSONAL_PATH/area/inbox.md' +alias inbox='$EDITOR $PERSONAL_PATH/inbox/inbox.md' alias quotes='$EDITOR $PERSONAL_PATH/lists/quotes.md' alias someday='$EDITOR $PERSONAL_PATH/someday.md' From c53174250706e6cf859cafa497ca41bde95c0bf9 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 4 Sep 2025 04:04:24 +1200 Subject: [PATCH 12/29] feat --- README.md | 9 ++++--- dotfiles/.gitconfig | 2 +- dotfiles/common/env.sh | 1 + nvim/lua/config/option.lua | 1 + nvim/lua/plugins/cmp.lua | 22 +++++++++------ nvim/lua/plugins/linting.lua | 28 ++++++++++++++----- nvim/lua/plugins/lsp.lua | 4 ++- nvim/lua/plugins/noice.lua | 45 +------------------------------ nvim/lua/plugins/text-editing.lua | 1 - scripts/aliases.sh | 2 +- 10 files changed, 48 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index f5f076a..f194c2b 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,11 @@ Setup and configuration for my terminal based developer workflow: -- Zsh for a shell, -- Nix for package management of shell programs, -- uv for Python, -- Neovim for text editing. +- Zsh for a shell +- Nix for package management of shell programs +- uv for Python +- Neovim for text editing +- Stow for dotfiles management This repo should be cloned into `$HOME` and set as `$XDG_CONFIG_HOME`. diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig index 0d66549..67be266 100644 --- a/dotfiles/.gitconfig +++ b/dotfiles/.gitconfig @@ -40,7 +40,7 @@ tool = nvimdiff [mergetool "nvimdiff"] - cmd = nvim -d $LOCAL $REMOTE + cmd = nvim -d $LOCAL $REMOTE $MERGED [pull] rebase = false diff --git a/dotfiles/common/env.sh b/dotfiles/common/env.sh index 575a0bb..d7b84e4 100644 --- a/dotfiles/common/env.sh +++ b/dotfiles/common/env.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash export XDG_CONFIG_HOME=~/dotfiles export PERSONAL_PATH="$HOME/personal" +export DIRENV_LOG_FORMAT="" # export TODO="$PERSONAL_PATH/todo.md" diff --git a/nvim/lua/config/option.lua b/nvim/lua/config/option.lua index ec011f4..31b01dd 100644 --- a/nvim/lua/config/option.lua +++ b/nvim/lua/config/option.lua @@ -154,3 +154,4 @@ vim.opt.wildignore = "+=*.egg-info/**" -- Enable wildmenu for command-line completion vim.opt.wildmenu = true +vim.opt.wildmode = "longest:full,full" diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 333924f..9119a2a 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -25,10 +25,12 @@ return { -- snippets = { preset = "luasnip" }, keymap = { - preset = "default", [""] = { "select_next", "fallback" }, [""] = { "select_prev", "fallback" }, - [""] = { "accept", "fallback" }, + [""] = { + -- "accept", + "fallback", + }, }, cmdline = { @@ -37,6 +39,7 @@ return { menu = { auto_show = true }, ghost_text = { enabled = true }, }, + keymap = { preset = "inherit" }, }, completion = { @@ -74,14 +77,17 @@ return { }, list = { - selection = { auto_insert = true, preselect = false }, + selection = { + auto_insert = true, + preselect = false, + }, }, menu = { - cmdline_position = function() - local Api = require("noice.api") - local pos = Api.get_cmdline_position() - return { pos.screenpos.row, pos.screenpos.col } - end, + -- cmdline_position = function() + -- local Api = require("noice.api") + -- local pos = Api.get_cmdline_position() + -- return { pos.screenpos.row, pos.screenpos.col } + -- end, border = "single", auto_show = function() return vim.bo.buftype ~= "prompt" diff --git a/nvim/lua/plugins/linting.lua b/nvim/lua/plugins/linting.lua index a3b8b87..e40d793 100644 --- a/nvim/lua/plugins/linting.lua +++ b/nvim/lua/plugins/linting.lua @@ -1,17 +1,29 @@ return { { - "mfussenegger/nvim-lint", event = "BufEnter", config = function() + -- override diagnostic signs using the new API + vim.diagnostic.config({ + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "", + [vim.diagnostic.severity.WARN] = "", + [vim.diagnostic.severity.HINT] = "", + [vim.diagnostic.severity.INFO] = "", + }, + }, + }) + + -- custom linter definition for staticcheck require("lint").linters.staticcheck = { - cmd = "staticcheck", -- Command to run staticcheck - stdin = false, -- staticcheck does not support stdin; it requires a file path - append_fname = true, -- Append the filename to the args + cmd = "staticcheck", + stdin = false, + append_fname = true, args = { "--checks", "all" }, - stream = "stdout", -- staticcheck writes its output to stdout - ignore_exitcode = true, -- staticcheck may exit with non-zero on lint warnings/errors - parser = function(output, bufnr) -- Define a parser function for the linter output + stream = "stdout", + ignore_exitcode = true, + parser = function(output, bufnr) local diagnostics = {} local s_pattern = "^(.+):(%d+):(%d+):%s+(.*)$" for _, line in ipairs(vim.split(output, "\n")) do @@ -30,6 +42,7 @@ return { end, } + -- filetype to linter mapping require("lint").linters_by_ft = { dockerfile = { "hadolint" }, go = { "golangcilint" }, @@ -44,6 +57,7 @@ return { yaml = { "actionlint", "yamllint" }, } + -- auto-run linting on buffer events vim.api.nvim_create_autocmd({ "BufWritePost", "BufReadPost", diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 015ef58..531e350 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -71,6 +71,9 @@ return { -- Capabilities local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) capabilities.textDocument.completion.completionItem.snippetSupport = true + capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { "documentation", "detail", "additionalTextEdits" }, + } -- Flags local lsp_flags = { @@ -105,7 +108,6 @@ return { cmd = { os.getenv("HOME") .. "/.cargo/bin/prosemd-lsp", "--stdio" }, }, basedpyright = {}, - -- pyright = { cmd = { "pyright-langserver", "--stdio" } }, ruff = { cmd = { "ruff", "server" }, filetypes = { "python" }, diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua index 900be3c..a564707 100644 --- a/nvim/lua/plugins/noice.lua +++ b/nvim/lua/plugins/noice.lua @@ -1,44 +1 @@ -return { - "folke/noice.nvim", - event = "VeryLazy", - dependencies = { - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", - }, - config = function() - require("noice").setup({ - -- cmdline = { - -- enabled = true, - -- }, - -- popupmenu = { - -- enabled = false, - -- }, - -- this is the messages that appear in top right - notify = { - enabled = false, - }, - messages = { - enabled = true, - view = "mini", - }, - lsp = { - signature = { - enabled = false, - }, - progress = { - enabled = false, - }, - message = { - enabled = false, - }, - }, - -- presets = { - -- bottom_search = false, - -- command_palette = false, - -- long_message_to_split = true, - -- inc_rename = false, - -- lsp_doc_border = false, - -- }, - }) - end, -} +return {} diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua index 1585f36..7936d9f 100644 --- a/nvim/lua/plugins/text-editing.lua +++ b/nvim/lua/plugins/text-editing.lua @@ -12,7 +12,6 @@ return { vim.api.nvim_create_user_command("PeekClose", require("peek").close, {}) end, }, - { "sindrets/diffview.nvim" }, { "mhinz/vim-grepper" }, { "FooSoft/vim-argwrap" }, diff --git a/scripts/aliases.sh b/scripts/aliases.sh index 6e8ffb3..b442a8c 100755 --- a/scripts/aliases.sh +++ b/scripts/aliases.sh @@ -111,7 +111,7 @@ alias gmv='git mv ' alias gcb='git checkout ' alias gnb='git checkout -b' alias gp='git push origin ' -alias gs='git status --short --branch --show-stash --verbose -uno' +alias gs='git status --short --branch --show-stash --verbose' alias nbg='git checkout -b' alias gss='git stash' alias gst='git stash' From 648aa93f02e3f8e77ac68ab8dc57e37e28ea5b7a Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 4 Sep 2025 04:24:41 +1200 Subject: [PATCH 13/29] feat --- nvim/lazy-lock.json | 5 +-- nvim/lua/plugins/cmp.lua | 67 ++++++++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 20 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index b42e49e..75afb0d 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -23,14 +23,12 @@ "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, "mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" }, "mini.indentscope": { "branch": "main", "commit": "5fdc3edf7bb1b6365980c2c47dac2f19ec93c97b" }, - "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, - "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "mini.nvim": { "branch": "main", "commit": "e7538b549361c9ac8416a07b0223ce03c508bfe7" }, "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, "nvim-bqf": { "branch": "main", "commit": "dd17c73912487dccb372deff85d4262d2b89bc2b" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-lint": { "branch": "master", "commit": "9c6207559297b24f0b7c32829f8e45f7d65b991f" }, "nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" }, - "nvim-notify": { "branch": "master", "commit": "397c7c1184745fca649e5104de659e6392ef5a4d" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-treesitter-context": { "branch": "master", "commit": "59f318a65d42a5c4037796886a8874fd57f774fc" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, @@ -64,7 +62,6 @@ "vim-textobj-markdown": { "branch": "master", "commit": "9cba182b2c30afc982ace0deb1200cc394799799" }, "vim-textobj-python": { "branch": "master", "commit": "06de233e805b6bcfd0fde7591c64cf927637feb7" }, "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, - "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" }, "winresizer": { "branch": "master", "commit": "9bd559a03ccec98a458e60c705547119eb5350f3" }, "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } } diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 9119a2a..43e3cf8 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -83,12 +83,7 @@ return { }, }, menu = { - -- cmdline_position = function() - -- local Api = require("noice.api") - -- local pos = Api.get_cmdline_position() - -- return { pos.screenpos.row, pos.screenpos.col } - -- end, - border = "single", + border = nil, auto_show = function() return vim.bo.buftype ~= "prompt" and vim.b.completion ~= false @@ -96,20 +91,60 @@ return { end, draw = { columns = { - { "label", "label_description", gap = 3 }, - { "kind_icon", gap = 1, "source_name", gap = 1, "kind" }, + { + "label", + -- "label_description", + -- gap = 3 + }, + { + "kind_icon", + gap = 1, + "source_name", + }, }, components = { kind_icon = { ellipsis = false, text = function(ctx) - local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) - return kind_icon - end, - -- Optionally, you may also use the highlights from mini.icons - highlight = function(ctx) - local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) - return hl + local icons = { + Array = "󰅪", + Boolean = "⊨", + Class = "󰠱", + Color = "󰏘", + Constant = "󰏿", + Constructor = "", + Copilot = "󱚣", + Enum = "", + EnumMember = "", + Event = "", + Field = "󰜢", + File = "󰈙", + Folder = "󰉋", + Function = "󰊕", + Interface = "", + Key = "󰌋", + Keyword = "󰌋", + Method = "󰆧", + Module = "", + Namespace = "󰌗", + Null = "󰟢", + Number = "󰎠", + Object = "󰅩", + Operator = "󰆕", + Package = "", + Property = "󰜢", + Reference = "󰈇", + Ripgrep = "", + Snippet = "", + String = "󰉿", + Struct = "󰙅", + Text = "󰉿", + TypeParameter = "", + Unit = "󰑭", + Value = "󰎠", + Variable = "󰀫", + } + return icons[ctx.kind] or "●" end, }, }, @@ -129,7 +164,7 @@ return { min_width = 1, max_width = 400, max_height = 10, - border = nil, -- Defaults to `vim.o.winborder` on nvim 0.11+ or 'padded' when not defined/<=0.10 + -- border = nil, -- Defaults to `vim.o.winborder` on nvim 0.11+ or 'padded' when not defined/<=0.10 winblend = 0, winhighlight = "Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder", scrollbar = false, -- Note that the gutter will be disabled when border ~= 'none' From 1c3f0f8e4b722b761b2f7e7f71779e27b5e0b81c Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 4 Sep 2025 04:41:28 +1200 Subject: [PATCH 14/29] feat --- README.md | 2 ++ nvim/lazy-lock.json | 46 ++++++++++++++----------------- nvim/lua/config/augroup.lua | 1 - nvim/lua/plugins/text-editing.lua | 10 ------- 4 files changed, 23 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index f194c2b..35b245f 100644 --- a/README.md +++ b/README.md @@ -112,3 +112,5 @@ Had weird issue with the first execution of Kitty not loading the `kitty.conf` c $ launchctl load ~/Library/LaunchAgents/setenv.XDG_CONFIG_HOME.plist ``` + + diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 75afb0d..4f4c8b0 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,54 +1,52 @@ { - "CopilotChat.nvim": { "branch": "main", "commit": "f7eb423baccbb27f5b5608fb91acee2d6bc769c7" }, - "LuaSnip": { "branch": "master", "commit": "831a130291eb6dae0dabd2748d0a99401a2eebc4" }, + "CopilotChat.nvim": { "branch": "main", "commit": "1d8aa27e2317950b0b7ddc023487c6f2b7b074ca" }, + "LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" }, "Vim-Jinja2-Syntax": { "branch": "master", "commit": "2c17843b074b06a835f88587e1023ceff7e2c7d1" }, - "barbar.nvim": { "branch": "master", "commit": "3a74402bdf04745a762de83d5c5e88e3e9b0e2e0" }, + "barbar.nvim": { "branch": "master", "commit": "549ee11d97057eae207bafa2c23c315942cca097" }, "blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" }, "blink-cmp-dictionary": { "branch": "master", "commit": "43b701fe9728a704bc63e4667c5d8b398bf129b2" }, "blink-emoji.nvim": { "branch": "master", "commit": "f22ce8cac02a6ece05368220f1e38bd34fe376f9" }, - "blink-ripgrep.nvim": { "branch": "main", "commit": "95ef910133d115dae4aafb7b0c30713cf3deb43a" }, - "blink.cmp": { "branch": "main", "commit": "586ee87534f5bf65f1c8dea2d1da2a57e8cddd36" }, + "blink-ripgrep.nvim": { "branch": "main", "commit": "b71592e916d748492c54b8bc9bc17dc2a0dcdfb5" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, "blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" }, "bullets.vim": { "branch": "master", "commit": "1c13e510e11d08b0259e8e627f128359c5521962" }, - "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, + "conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" }, "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, - "copilot.lua": { "branch": "master", "commit": "14bf786180b2ca4578915c56989b6d676dddc6f3" }, + "copilot.lua": { "branch": "master", "commit": "407fbd5cd3397e1e46b7dedbd928eefcaf621e76" }, "dbtpal": { "branch": "main", "commit": "981eab51609362712c64e3cf3fb773fe11f859b9" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "emmet-vim": { "branch": "master", "commit": "e98397144982d1e75b20d94d55a82de3ec8f648d" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "0cb5a7753d3c4b8e9cfdc9d88d9110cb8d4b1544" }, + "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, - "mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" }, - "mini.indentscope": { "branch": "main", "commit": "5fdc3edf7bb1b6365980c2c47dac2f19ec93c97b" }, + "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" }, + "mini.indentscope": { "branch": "main", "commit": "9d9490c172a4718d7d1f20eaae668a28f160c2d7" }, "mini.nvim": { "branch": "main", "commit": "e7538b549361c9ac8416a07b0223ce03c508bfe7" }, "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, - "nvim-bqf": { "branch": "main", "commit": "dd17c73912487dccb372deff85d4262d2b89bc2b" }, + "nvim-bqf": { "branch": "main", "commit": "17680cda3538913e88dd4c6456c837db9ace40ae" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-lint": { "branch": "master", "commit": "9c6207559297b24f0b7c32829f8e45f7d65b991f" }, - "nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" }, + "nvim-lint": { "branch": "master", "commit": "f126af5345c7472e9a0cdbe1d1a29209be72c4c4" }, + "nvim-lspconfig": { "branch": "master", "commit": "8b597f8fd1cf33e925f783a812ddcb81c5611a34" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-treesitter-context": { "branch": "master", "commit": "59f318a65d42a5c4037796886a8874fd57f774fc" }, + "nvim-treesitter-context": { "branch": "master", "commit": "dca8726fea2c14e1ce6adbaa76a04816fbfaff61" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" }, - "obsidian.nvim": { "branch": "main", "commit": "2f0222b3eb20382cadf3e1d91f368318b768771c" }, - "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, + "nvim-web-devicons": { "branch": "master", "commit": "f66cdfef5e84112045b9ebc3119fee9bddb3c687" }, + "obsidian.nvim": { "branch": "main", "commit": "705cc9b4f66eca1e54040ac819102e80a32896d3" }, + "oil.nvim": { "branch": "master", "commit": "07f80ad645895af849a597d1cac897059d89b686" }, "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-git-file-history.nvim": { "branch": "master", "commit": "e7d495319f2a04df96402057a6992ea970f8914d" }, "telescope-makefile": { "branch": "master", "commit": "6e5b5767751dbf73ad4f126840dcf1abfc38e891" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, - "undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" }, + "undotree": { "branch": "master", "commit": "fe9a9d0645f0f5532360b5e5f5c550d7bb4f1869" }, "vim": { "branch": "master", "commit": "d4b0823100c702af127cba8dd5595a8f599041ec" }, "vim-argwrap": { "branch": "master", "commit": "f3e26a5ad249d09467804b92e760d08b1cc457a1" }, "vim-bufkill": { "branch": "master", "commit": "3113181d0c1bfb8719f3ddcd2e2f35a8d763d1e5" }, "vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" }, - "vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" }, "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-grepper": { "branch": "master", "commit": "acaaf32edaa11d82fb972d2af36b949ec3042928" }, "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" }, @@ -56,9 +54,7 @@ "vim-one": { "branch": "master", "commit": "187f5c85b682c1933f8780d4d419c55d26a82e24" }, "vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" }, "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, - "vim-strip-trailing-whitespace": { "branch": "master", "commit": "59385775cbe416b2797ec5e2c7eb445a3398dd46" }, - "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, - "vim-table-mode": { "branch": "master", "commit": "e4365bde024f73e205eefa2fb78e3029ddb92ea9" }, + "vim-table-mode": { "branch": "master", "commit": "e156dbbedce0bbf61c0919db7678fa246fabd616" }, "vim-textobj-markdown": { "branch": "master", "commit": "9cba182b2c30afc982ace0deb1200cc394799799" }, "vim-textobj-python": { "branch": "master", "commit": "06de233e805b6bcfd0fde7591c64cf927637feb7" }, "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, diff --git a/nvim/lua/config/augroup.lua b/nvim/lua/config/augroup.lua index 84245de..e7647f2 100644 --- a/nvim/lua/config/augroup.lua +++ b/nvim/lua/config/augroup.lua @@ -43,7 +43,6 @@ vim.api.nvim_create_autocmd("FileType", { vim.opt_local.smartindent = false vim.opt_local.expandtab = true vim.g.indentLine_enabled = 0 - vim.cmd([[syntax keyword Todo TODO DONE]]) vim.opt.complete:append("k") vim.opt_local.conceallevel = 0 end, diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua index 7936d9f..91e44ce 100644 --- a/nvim/lua/plugins/text-editing.lua +++ b/nvim/lua/plugins/text-editing.lua @@ -15,13 +15,9 @@ return { { "sindrets/diffview.nvim" }, { "mhinz/vim-grepper" }, { "FooSoft/vim-argwrap" }, - { "nvim-tree/nvim-web-devicons" }, - { "tpope/vim-commentary" }, { "mattn/emmet-vim" }, - { "tpope/vim-surround" }, { "tpope/vim-repeat" }, { "farmergreg/vim-lastplace" }, - { "axelf4/vim-strip-trailing-whitespace" }, { "folke/zen-mode.nvim", opts = { @@ -49,7 +45,6 @@ return { end, }, { "norcalli/nvim-colorizer.lua" }, - { "windwp/nvim-ts-autotag" }, { "kana/vim-textobj-user" }, { "lukas-reineke/indent-blankline.nvim", @@ -117,11 +112,6 @@ return { --- Text editing - HTML { "alvan/vim-closetag" }, { "Glench/Vim-Jinja2-Syntax" }, - { - "folke/todo-comments.nvim", - cmd = { "TodoTrouble", "TodoTelescope" }, - config = true, - }, { "PedramNavid/dbtpal", dependencies = { From 84ee7f44ce6e53a7f3d6bf9f586ba8945dcbbe3a Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 4 Sep 2025 04:44:31 +1200 Subject: [PATCH 15/29] feat --- nvim/lua/plugins/noice.lua | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nvim/lua/plugins/noice.lua diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua deleted file mode 100644 index a564707..0000000 --- a/nvim/lua/plugins/noice.lua +++ /dev/null @@ -1 +0,0 @@ -return {} From 8fa758737b5b170dab94107a79b08c32b196d41a Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 5 Sep 2025 02:01:31 +1200 Subject: [PATCH 16/29] feat --- nvim/lua/plugins/mini.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 nvim/lua/plugins/mini.lua diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..e42120d --- /dev/null +++ b/nvim/lua/plugins/mini.lua @@ -0,0 +1,27 @@ +return { + { + "echasnovski/mini.nvim", + version = false, + config = function() + -- text editing + require("mini.comment").setup() + require("mini.surround").setup() + require("mini.pairs").setup() + require("mini.trailspace").setup() + + -- visual + require("mini.hipatterns").setup({ + highlighters = { + todo = { pattern = "TODO", group = "DiagnosticInfo" }, + hack = { pattern = "HACK", group = "DiagnosticInfo" }, + warn = { pattern = "WARN", group = "DiagnosticInfo" }, + perf = { pattern = "PERF", group = "DiagnosticInfo" }, + note = { pattern = "NOTE", group = "DiagnosticInfo" }, + test = { pattern = "TEST", group = "DiagnosticInfo" }, + fix = { pattern = "FIX", group = "DiagnosticInfo" }, + fixme = { pattern = "FIXME", group = "DiagnosticInfo" }, + }, + }) + end, + }, +} From d568f93ca3d7f99a529382bb0b838904cb5c4333 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 5 Sep 2025 02:07:11 +1200 Subject: [PATCH 17/29] feat --- nvim/lua/plugins/obsidian.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nvim/lua/plugins/obsidian.lua b/nvim/lua/plugins/obsidian.lua index 960d361..f3f1eab 100644 --- a/nvim/lua/plugins/obsidian.lua +++ b/nvim/lua/plugins/obsidian.lua @@ -27,6 +27,12 @@ return { nvim_cmp = false, blink = true, min_chars = 2, + create_new = false, + }, + legacy_commands = false, + hl_groups = { + -- The options are passed directly to `vim.api.nvim_set_hl()`. See `:help nvim_set_hl`. + ObsidianTodo = { fg = "NONE", bg = "NONE" }, }, }, } From 9ea576434c45075ef5ca69b81028133effa513b4 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 5 Sep 2025 18:57:49 +1200 Subject: [PATCH 18/29] feat --- nvim/lazy-lock.json | 3 --- nvim/lua/plugins/cmp.lua | 1 + nvim/lua/plugins/mini.lua | 18 ++++++++++++++++++ nvim/lua/plugins/text-editing.lua | 3 --- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 4f4c8b0..a0eb62e 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -55,9 +55,6 @@ "vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" }, "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, "vim-table-mode": { "branch": "master", "commit": "e156dbbedce0bbf61c0919db7678fa246fabd616" }, - "vim-textobj-markdown": { "branch": "master", "commit": "9cba182b2c30afc982ace0deb1200cc394799799" }, - "vim-textobj-python": { "branch": "master", "commit": "06de233e805b6bcfd0fde7591c64cf927637feb7" }, - "vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" }, "winresizer": { "branch": "master", "commit": "9bd559a03ccec98a458e60c705547119eb5350f3" }, "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } } diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 43e3cf8..c2c9424 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -187,6 +187,7 @@ return { -- Default list of enabled providers defined so that you can extend it -- elsewhere in your config, without redefining it, due to `opts_extend` sources = { + min_keyword_length = 10, default = { "snippets", "copilot", diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua index e42120d..dad7066 100644 --- a/nvim/lua/plugins/mini.lua +++ b/nvim/lua/plugins/mini.lua @@ -8,6 +8,24 @@ return { require("mini.surround").setup() require("mini.pairs").setup() require("mini.trailspace").setup() + + -- enhanced text objects + require("mini.ai").setup({ + custom_textobjects = { + -- Python text objects + f = require('mini.ai').gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }), + c = require('mini.ai').gen_spec.treesitter({ a = '@class.outer', i = '@class.inner' }), + -- Markdown text objects + h = require('mini.ai').gen_spec.treesitter({ a = '@markup.heading', i = '@markup.heading' }), + -- Code blocks in markdown + C = function(ai_type) + local pattern = '```.-```' + return require('mini.ai').gen_spec.pair(pattern, pattern, { + type = 'non-balanced' + })(ai_type) + end, + }, + }) -- visual require("mini.hipatterns").setup({ diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua index 91e44ce..29ae23c 100644 --- a/nvim/lua/plugins/text-editing.lua +++ b/nvim/lua/plugins/text-editing.lua @@ -45,7 +45,6 @@ return { end, }, { "norcalli/nvim-colorizer.lua" }, - { "kana/vim-textobj-user" }, { "lukas-reineke/indent-blankline.nvim", opts = { @@ -103,9 +102,7 @@ return { -- Text editing - Python { "Vimjas/vim-python-pep8-indent" }, - { "bps/vim-textobj-python" }, --- Text editing - Markdown - { "coachshea/vim-textobj-markdown" }, { "dhruvasagar/vim-table-mode" }, { "dkarter/bullets.vim" }, { "mzlogin/vim-markdown-toc" }, From 7319539893213a9f34edddee1e8c37b07757542c Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 5 Sep 2025 19:09:06 +1200 Subject: [PATCH 19/29] feat --- nvim/lazy-lock.json | 2 -- nvim/lua/plugins/cmp.lua | 8 ++------ nvim/lua/plugins/mini.lua | 8 ++++++++ nvim/lua/plugins/text-editing.lua | 2 -- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index a0eb62e..83b0711 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -49,11 +49,9 @@ "vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" }, "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-grepper": { "branch": "master", "commit": "acaaf32edaa11d82fb972d2af36b949ec3042928" }, - "vim-lastplace": { "branch": "master", "commit": "e58cb0df716d3c88605ae49db5c4741db8b48aa9" }, "vim-markdown-toc": { "branch": "master", "commit": "aa9cc3b07791db5cbe5f29d661763bc0eb4fb7c1" }, "vim-one": { "branch": "master", "commit": "187f5c85b682c1933f8780d4d419c55d26a82e24" }, "vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" }, - "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, "vim-table-mode": { "branch": "master", "commit": "e156dbbedce0bbf61c0919db7678fa246fabd616" }, "winresizer": { "branch": "master", "commit": "9bd559a03ccec98a458e60c705547119eb5350f3" }, "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index c2c9424..0f804ee 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -14,7 +14,6 @@ return { "mikavilpas/blink-ripgrep.nvim", "moyiz/blink-emoji.nvim", "nvim-lua/plenary.nvim", - "rafamadriz/friendly-snippets", "L3MON4D3/LuaSnip", }, version = "*", @@ -36,6 +35,7 @@ return { cmdline = { enabled = true, completion = { + keyword = { range = "full" }, menu = { auto_show = true }, ghost_text = { enabled = true }, }, @@ -187,9 +187,8 @@ return { -- Default list of enabled providers defined so that you can extend it -- elsewhere in your config, without redefining it, due to `opts_extend` sources = { - min_keyword_length = 10, + min_keyword_length = 2, default = { - "snippets", "copilot", "path", "lsp", @@ -200,7 +199,6 @@ return { }, per_filetype = { markdown = { - "snippets", "copilot", "path", "lsp", @@ -212,7 +210,6 @@ return { go = { "path", "lsp", - "snippets", "buffer", "ripgrep", }, @@ -220,7 +217,6 @@ return { "copilot", "path", "lsp", - "snippets", "buffer", "ripgrep", }, diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua index dad7066..1bcc796 100644 --- a/nvim/lua/plugins/mini.lua +++ b/nvim/lua/plugins/mini.lua @@ -9,6 +9,14 @@ return { require("mini.pairs").setup() require("mini.trailspace").setup() + -- utilities + require("mini.misc").setup() + require("mini.misc").setup_restore_cursor() + require("mini.operators").setup() + + -- keymap for zoom + vim.keymap.set('n', 'z', require('mini.misc').zoom, { desc = 'Zoom current buffer' }) + -- enhanced text objects require("mini.ai").setup({ custom_textobjects = { diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua index 29ae23c..f9e5814 100644 --- a/nvim/lua/plugins/text-editing.lua +++ b/nvim/lua/plugins/text-editing.lua @@ -16,8 +16,6 @@ return { { "mhinz/vim-grepper" }, { "FooSoft/vim-argwrap" }, { "mattn/emmet-vim" }, - { "tpope/vim-repeat" }, - { "farmergreg/vim-lastplace" }, { "folke/zen-mode.nvim", opts = { From b4732a0b417031390586fe132b5cb0307697cc89 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 5 Sep 2025 19:16:06 +1200 Subject: [PATCH 20/29] feat --- nvim/lua/plugins/cmp.lua | 7 ++++++- nvim/snippets/html.snippets | 8 ++++---- nvim/snippets/markdown.snippets | 2 +- nvim/snippets/python.snippets | 6 +++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 0f804ee..df9b68b 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -21,13 +21,14 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { - -- snippets = { preset = "luasnip" }, + snippets = { preset = "luasnip" }, keymap = { [""] = { "select_next", "fallback" }, [""] = { "select_prev", "fallback" }, [""] = { -- "accept", + "accept", "fallback", }, }, @@ -190,6 +191,7 @@ return { min_keyword_length = 2, default = { "copilot", + "snippets", "path", "lsp", "buffer", @@ -200,6 +202,7 @@ return { per_filetype = { markdown = { "copilot", + "snippets", "path", "lsp", "buffer", @@ -208,6 +211,7 @@ return { "dictionary", }, go = { + "snippets", "path", "lsp", "buffer", @@ -215,6 +219,7 @@ return { }, python = { "copilot", + "snippets", "path", "lsp", "buffer", diff --git a/nvim/snippets/html.snippets b/nvim/snippets/html.snippets index 0ec6cd8..b43f96e 100644 --- a/nvim/snippets/html.snippets +++ b/nvim/snippets/html.snippets @@ -421,7 +421,7 @@ snippet hgroup ${0} snippet hgroup. -
${0}
snippet hr @@ -579,7 +579,7 @@ snippet map. ${0} snippet map# - ${0} snippet map+ @@ -739,7 +739,7 @@ snippet select ${0} snippet select. - snippet select+ @@ -829,7 +829,7 @@ snippet tr+ td+${0} snippet track - ${5} snippet ul
    ${0} diff --git a/nvim/snippets/markdown.snippets b/nvim/snippets/markdown.snippets index 1dd40f7..e41c6bb 100644 --- a/nvim/snippets/markdown.snippets +++ b/nvim/snippets/markdown.snippets @@ -25,4 +25,4 @@ snippet shell-session snippet ` \`\`\`$1 - \`\` + \`\`\` diff --git a/nvim/snippets/python.snippets b/nvim/snippets/python.snippets index 6be2e49..a40482f 100644 --- a/nvim/snippets/python.snippets +++ b/nvim/snippets/python.snippets @@ -1,4 +1,4 @@ -snippet " +snippet docstring """ $0 """ @@ -56,8 +56,8 @@ snippet @pytest-param snippet with-pytest-raises with pytest.raises(Exception) as err: -snippet: dataclasses +snippet dataclasses import dataclasses @dataclasses.dataclass - class $0 + class $0: From b0ed5b4c19c49199521a569630e850146f171ecc Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sat, 6 Sep 2025 02:18:31 +1200 Subject: [PATCH 21/29] feat --- Makefile | 18 +++++++----------- nvim/lua/plugins/cmp.lua | 1 - nvim/lua/plugins/text-editing.lua | 29 ----------------------------- 3 files changed, 7 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index 4ba842d..f9341c5 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,23 @@ default: @echo "hello ^^" -.PHONY: setup-macos setup-ubuntu setup-wsl setup-stow +.PHONY: setup-macos setup-ubuntu setup-wsl setup-common setup-stow -setup-macos: export OS=macos -setup-macos: brew-pkgs nix-pkgs dotfiles +setup-common: bash ./tmux/setup.sh bash ./zsh/setup.sh bash ./fzf/setup.sh + +setup-macos: export OS=macos +setup-macos: brew-pkgs nix-pkgs dotfiles setup-common bash ./macos/setup.sh setup-ubuntu: export OS=ubuntu -setup-ubuntu: dotfiles nix-pkgs dotfiles - bash ./tmux/setup.sh - bash ./zsh/setup.sh - bash ./fzf/setup.sh +setup-ubuntu: dotfiles nix-pkgs dotfiles setup-common bash ./ubuntu/setup.sh setup-wsl: export OS=wsl -setup-wsl: dotfiles nix-pkgs dotfiles - bash ./tmux/setup.sh - bash ./zsh/setup.sh - bash ./fzf/setup.sh +setup-wsl: dotfiles nix-pkgs dotfiles setup-common setup-stow: bash ./stow/setup.sh diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index df9b68b..43a9c6d 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -28,7 +28,6 @@ return { [""] = { "select_prev", "fallback" }, [""] = { -- "accept", - "accept", "fallback", }, }, diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua index f9e5814..9816a21 100644 --- a/nvim/lua/plugins/text-editing.lua +++ b/nvim/lua/plugins/text-editing.lua @@ -69,35 +69,6 @@ return { }, main = "ibl", }, - { - "echasnovski/mini.indentscope", - opts = { - -- symbol = "▏", - symbol = "│", - options = { try_as_border = true }, - }, - init = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - callback = function() - vim.b.miniindentscope_disable = true - end, - }) - end, - }, - -- Text editing - Python { "Vimjas/vim-python-pep8-indent" }, --- Text editing - Markdown From 57f839f717710b033d24f9e50dc6559d3d67f051 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sun, 7 Sep 2025 07:12:06 +1200 Subject: [PATCH 22/29] feat --- nvim/lua/plugins/cmp.lua | 25 ++++++++++++++++++++++--- nvim/lua/plugins/obsidian.lua | 34 +++++++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 43a9c6d..9e20f20 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -24,8 +24,14 @@ return { snippets = { preset = "luasnip" }, keymap = { - [""] = { "select_next", "fallback" }, - [""] = { "select_prev", "fallback" }, + [""] = { + "select_next", + -- "fallback" + }, + [""] = { + "select_prev", + -- "fallback" + }, [""] = { -- "accept", "fallback", @@ -39,7 +45,20 @@ return { menu = { auto_show = true }, ghost_text = { enabled = true }, }, - keymap = { preset = "inherit" }, + keymap = { + [""] = { + "select_next", + -- "fallback" + }, + [""] = { + "select_prev", + -- "fallback" + }, + [""] = { + "select_accept_and_enter", + "fallback", + }, + }, }, completion = { diff --git a/nvim/lua/plugins/obsidian.lua b/nvim/lua/plugins/obsidian.lua index f3f1eab..1aea41f 100644 --- a/nvim/lua/plugins/obsidian.lua +++ b/nvim/lua/plugins/obsidian.lua @@ -1,16 +1,8 @@ return { "obsidian-nvim/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit + version = "*", lazy = true, ft = "markdown", - -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: - -- event = { - -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. - -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" - -- -- refer to `:h file-pattern` for more examples - -- "BufReadPre path/to/my-vault/*.md", - -- "BufNewFile path/to/my-vault/*.md", - -- }, dependencies = { -- Required. "nvim-lua/plenary.nvim", @@ -34,5 +26,29 @@ return { -- The options are passed directly to `vim.api.nvim_set_hl()`. See `:help nvim_set_hl`. ObsidianTodo = { fg = "NONE", bg = "NONE" }, }, + note_frontmatter_func = function(note) + local out = { + id = note.id, + created = os.date("%Y-%m-%d %H:%M:%S"), + link = "", + parent = "", + tags = { "note" }, -- Add your default tags here + } + + -- Add title as alias if it exists + if note.title then + note:add_alias(note.title) + out.aliases = note.aliases + end + + -- Preserve any existing metadata + if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then + for k, v in pairs(note.metadata) do + out[k] = v + end + end + + return out + end, }, } From b3b6fea89153f3ec4b565de042f7a8e85ce1e1e1 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sun, 7 Sep 2025 18:26:42 +1200 Subject: [PATCH 23/29] feat --- nvim/lua/plugins/cmp.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 9e20f20..8fd3c62 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -23,6 +23,8 @@ return { opts = { snippets = { preset = "luasnip" }, + fuzzy = { implementation = "prefer_rust_with_warning" }, + keymap = { [""] = { "select_next", @@ -41,7 +43,7 @@ return { cmdline = { enabled = true, completion = { - keyword = { range = "full" }, + -- keyword = { range = "full" }, menu = { auto_show = true }, ghost_text = { enabled = true }, }, @@ -55,7 +57,7 @@ return { -- "fallback" }, [""] = { - "select_accept_and_enter", + -- "select_accept_and_enter", "fallback", }, }, From d6ce9c39d95636b07c28d0feb661485b8e284b98 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 11 Sep 2025 02:04:36 +1200 Subject: [PATCH 24/29] feat --- nvim/lua/plugins/formatting.lua | 10 +++++----- nvim/lua/plugins/lsp.lua | 27 +++++++++++++++------------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/nvim/lua/plugins/formatting.lua b/nvim/lua/plugins/formatting.lua index 6342083..599658f 100644 --- a/nvim/lua/plugins/formatting.lua +++ b/nvim/lua/plugins/formatting.lua @@ -19,16 +19,16 @@ return { lua = { "stylua" }, go = { "gofmt" }, python = { "isort", "ruff_format" }, - -- markdown = { "injected" }, + markdown = { "injected" }, javascript = { "prettier" }, css = { "stylelint" }, yaml = { "yamlfix" }, sql = { "sqlfluff" }, ["*"] = { - -- "codespell", - -- "trim_newlines", - -- "injected", - -- "trim_whitespace", + "codespell", + "trim_newlines", + "injected", + "trim_whitespace", }, }, }) diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 531e350..10b9ea3 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -92,18 +92,21 @@ return { -- filetypes = { "markdown" }, -- settings = { ltex = { enabled = { "markdown" }, language = { "en-NZ" } } }, }, - -- lua_ls = { - -- cmd = { "lua-language-server", "--force-accept-workspace" }, - -- settings = { - -- Lua = { - -- runtime = { version = "LuaJIT" }, - -- diagnostics = { globals = { "vim" } }, - -- workspace = { library = ".", checkThirdParty = false }, - -- telemetry = { enable = false }, - -- }, - -- }, - -- }, - marksman = {}, + lua_ls = { + cmd = { + "lua-language-server", + -- "--force-accept-workspace" + }, + -- settings = { + -- Lua = { + -- runtime = { version = "LuaJIT" }, + -- diagnostics = { globals = { "vim" } }, + -- -- workspace = { library = ".", checkThirdParty = false }, + -- telemetry = { enable = false }, + -- }, + -- }, + }, + -- marksman = {}, prosemd_lsp = { cmd = { os.getenv("HOME") .. "/.cargo/bin/prosemd-lsp", "--stdio" }, }, From 12b590bbd057df2b7ee14882d73c978a9c65187f Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 11 Sep 2025 02:04:52 +1200 Subject: [PATCH 25/29] feat --- scripts/setup-fish.sh | 5 ++++ scripts/todo/go.mod | 3 +++ scripts/todo/todo.go | 53 +++++++++++++++++++++++++++++++++++++++ scripts/todo/todo_test.go | 21 ++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 scripts/setup-fish.sh create mode 100644 scripts/todo/go.mod create mode 100644 scripts/todo/todo.go create mode 100644 scripts/todo/todo_test.go diff --git a/scripts/setup-fish.sh b/scripts/setup-fish.sh new file mode 100644 index 0000000..7544d70 --- /dev/null +++ b/scripts/setup-fish.sh @@ -0,0 +1,5 @@ +mkdir -p "$XDG_CONFIG_HOME"/fish/functions +git clone https://github.com/edc/bass "$XDG_CONFIG_HOME"/fish/functions/bass +cd "$XDG_CONFIG_HOME"/fish/functions/bass && make install +cp ~/.config/fish/functions/* "$XDG_CONFIG_HOME"/fish/functions/ +rm -rf ~/.config/fish/functions/bass diff --git a/scripts/todo/go.mod b/scripts/todo/go.mod new file mode 100644 index 0000000..792b726 --- /dev/null +++ b/scripts/todo/go.mod @@ -0,0 +1,3 @@ +module todo + +go 1.22.3 diff --git a/scripts/todo/todo.go b/scripts/todo/todo.go new file mode 100644 index 0000000..3dce155 --- /dev/null +++ b/scripts/todo/todo.go @@ -0,0 +1,53 @@ +package main + +import "fmt" +import "os" + +func fileExists(fi string) bool { + _, err := os.Stat(fi) + return err == nil +} + +func main() { + args := os.Args + + // if we pass a CLI arg, then this is the project + var project string + + if len(args) == 2 { + project = args[1] + } + Resolve(project) +} + +func Resolve(project string) string { + // this is one way to have default args + // works, but I don't like it! + return ResolveToHome(project, "~/personal/project/") +} + +func ResolveToHome(project string, home string) string { + + fmt.Println("TODO for", project) + + // look for a todofile + if fileExists(".todofile") { + fmt.Println(".todofile found!") + // TODO - read from the .todofile + } + + // look for folder locally (ie local todo.md) + if fileExists("todo.md") { + fmt.Println("local todo.md found!") + } + + // check if a file exists in ~/personal/project/{project}/todo.md + + // fallback to project/{project}.md + filename := home + "/" + project + if !fileExists(filename) { + fmt.Println(filename, "does not exist") + } + + return filename +} diff --git a/scripts/todo/todo_test.go b/scripts/todo/todo_test.go new file mode 100644 index 0000000..5482230 --- /dev/null +++ b/scripts/todo/todo_test.go @@ -0,0 +1,21 @@ +package main + +import "testing" + +func TestTodo(t *testing.T) { + t.Run("no files exist, default to project directory", func(t *testing.T) { + got := ResolveToHome("fake.md", "tmp-dir") + want := "tmp-dir/fake.md" + if got != want { + t.Errorf("got %q want %q", got, want) + } + }) + + t.Run("local file exists", func(t *testing.T) { + got := ResolveToHome("fake", "tmp-dir") + want := "tmp-dir/fake" + if got != want { + t.Errorf("got %q want %q", got, want) + } + }) +} From 2287187a062e5da2223b4d06d7eb4c7596957ed7 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 11 Sep 2025 02:33:02 +1200 Subject: [PATCH 26/29] feat --- nvim/lazy-lock.json | 3 +- nvim/lua/config/option.lua | 4 +- nvim/lua/plugins/cmp.lua | 2 +- nvim/lua/plugins/lsp.lua | 186 +++++++++++++++++-------------------- 4 files changed, 90 insertions(+), 105 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 83b0711..2462e2d 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -22,13 +22,12 @@ "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, "mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" }, - "mini.indentscope": { "branch": "main", "commit": "9d9490c172a4718d7d1f20eaae668a28f160c2d7" }, "mini.nvim": { "branch": "main", "commit": "e7538b549361c9ac8416a07b0223ce03c508bfe7" }, "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, "nvim-bqf": { "branch": "main", "commit": "17680cda3538913e88dd4c6456c837db9ace40ae" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-lint": { "branch": "master", "commit": "f126af5345c7472e9a0cdbe1d1a29209be72c4c4" }, - "nvim-lspconfig": { "branch": "master", "commit": "8b597f8fd1cf33e925f783a812ddcb81c5611a34" }, + "nvim-lspconfig": { "branch": "master", "commit": "c8b90ae5cbe21d547b342b05c9266dcb8ca0de8f" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-treesitter-context": { "branch": "master", "commit": "dca8726fea2c14e1ce6adbaa76a04816fbfaff61" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, diff --git a/nvim/lua/config/option.lua b/nvim/lua/config/option.lua index 31b01dd..81c7992 100644 --- a/nvim/lua/config/option.lua +++ b/nvim/lua/config/option.lua @@ -56,8 +56,8 @@ vim.opt.ignorecase = true vim.opt.list = true vim.opt.listchars = "tab:>-" --- Enable spell checking and set language -vim.opt.spell = true +-- Spell checking and language +vim.opt.spell = false vim.opt.spelllang = "en_nz" vim.opt.spellsuggest = { "best", 9 } diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua index 8fd3c62..b2285dd 100644 --- a/nvim/lua/plugins/cmp.lua +++ b/nvim/lua/plugins/cmp.lua @@ -155,7 +155,7 @@ return { Package = "", Property = "󰜢", Reference = "󰈇", - Ripgrep = "", + Ripgrep = "", Snippet = "", String = "󰉿", Struct = "󰙅", diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 10b9ea3..e832e22 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -3,19 +3,13 @@ return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, config = function() - local lspconfig = require("lspconfig") - - -- Diagnostic Appearance - local signs = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, - } - - for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) - end + -- global diagnostic keymaps + -- TODO - should these be elsewhere? + local opts = { noremap = true, silent = true } + vim.keymap.set("n", "gl", vim.diagnostic.open_float, opts) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) + vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) vim.diagnostic.config({ virtual_text = false, @@ -40,100 +34,92 @@ return { }, }) - -- Key Mappings - local opts = { noremap = true, silent = true } - vim.keymap.set("n", "gl", vim.diagnostic.open_float, opts) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) - vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) - - -- Language Server Configs + -- basedpyright + vim.lsp.config["basedpyright"] = { + cmd = { "basedpyright-langserver", "--stdio" }, + filetypes = { "python" }, + root_markers = { ".git", "pyproject.toml", "setup.py", "setup.cfg", "requirements.txt" }, + settings = { + basedpyright = { + analysis = { + autoSearchPaths = true, + diagnosticMode = "openFilesOnly", + useLibraryCodeForTypes = true, + }, + }, + }, + } + vim.lsp.enable("basedpyright") - -- On Attach - local on_attach = function(client, bufnr) - local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) - vim.keymap.set("n", "k", vim.lsp.buf.signature_help, bufopts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) - vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set("n", "wl", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) - vim.keymap.set("n", "grr", vim.lsp.buf.rename, bufopts) - end + -- lua + vim.lsp.config["luals"] = { + cmd = { "lua-language-server" }, + filetypes = { "lua" }, + root_markers = { ".luarc.json", ".luarc.jsonc", ".git" }, + settings = { + Lua = { + runtime = { + version = "LuaJIT", + }, + diagnostics = { globals = { "vim" } }, + }, + }, + } + vim.lsp.enable("luals") - -- Capabilities - local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) - capabilities.textDocument.completion.completionItem.snippetSupport = true - capabilities.textDocument.completion.completionItem.resolveSupport = { - properties = { "documentation", "detail", "additionalTextEdits" }, + -- ruff + vim.lsp.config["ruff"] = { + cmd = { "ruff", "server" }, + filetypes = { "python" }, + single_file_support = true, + root_markers = { + "pyproject.toml", + "ruff.toml", + ".ruff.toml", + ".git", + }, } + vim.lsp.enable("ruff") - -- Flags - local lsp_flags = { - debounce_text_changes = 150, + -- gopls + vim.lsp.config["gopls"] = { + cmd = { "gopls" }, + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + root_markers = { "go.work", "go.mod", ".git" }, } + vim.lsp.enable("gopls") - -- Servers - local servers = { - -- bashls = {}, - -- dockerls = {}, - -- emmet_language_server = {}, - gopls = {}, - html = {}, - -- jsonls = {}, - ltex = { - -- filetypes = { "markdown" }, - -- settings = { ltex = { enabled = { "markdown" }, language = { "en-NZ" } } }, - }, - lua_ls = { - cmd = { - "lua-language-server", - -- "--force-accept-workspace" - }, - -- settings = { - -- Lua = { - -- runtime = { version = "LuaJIT" }, - -- diagnostics = { globals = { "vim" } }, - -- -- workspace = { library = ".", checkThirdParty = false }, - -- telemetry = { enable = false }, - -- }, - -- }, - }, - -- marksman = {}, - prosemd_lsp = { - cmd = { os.getenv("HOME") .. "/.cargo/bin/prosemd-lsp", "--stdio" }, - }, - basedpyright = {}, - ruff = { - cmd = { "ruff", "server" }, - filetypes = { "python" }, - -- root_dir = require("lspconfig").util.root_pattern( - -- ".git", - -- "pyproject.toml", - -- "setup.py", - -- "setup.cfg", - -- "requirements.txt" - -- ), - single_file_support = true, - }, - -- rust_analyzer = { settings = { ["rust-analyzer"] = {} } }, - -- tailwindcss = { cmd = { "tailwindcss-language-server", "--stdio" } }, - -- ts_ls = {}, + -- html + vim.lsp.config["html"] = { + cmd = { "vscode-html-language-server", "--stdio" }, + filetypes = { "html" }, + root_markers = { "package.json", ".git" }, + single_file_support = true, } - for server, config in pairs(servers) do - require("lspconfig")[server].setup(vim.tbl_deep_extend("force", { - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, - }, config)) - end + vim.lsp.enable("html") + + -- LSP keymaps and features on attach + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local bufnr = args.buf + local bufopts = { noremap = true, silent = true, buffer = bufnr } + + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) + vim.keymap.set("n", "k", vim.lsp.buf.signature_help, bufopts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) + vim.keymap.set("n", "grr", vim.lsp.buf.rename, bufopts) + end, + }) end, }, } From e1da2dc6fc9d45aa7e989f1714495b48585320f4 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 12 Sep 2025 23:10:19 +1200 Subject: [PATCH 27/29] feat --- nvim/lazy-lock.json | 1 + nvim/lua/plugins/text-editing.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 2462e2d..d5b2f63 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -17,6 +17,7 @@ "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "emmet-vim": { "branch": "master", "commit": "e98397144982d1e75b20d94d55a82de3ec8f648d" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "git-conflict.nvim": { "branch": "main", "commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4" }, "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, diff --git a/nvim/lua/plugins/text-editing.lua b/nvim/lua/plugins/text-editing.lua index 9816a21..774361c 100644 --- a/nvim/lua/plugins/text-editing.lua +++ b/nvim/lua/plugins/text-editing.lua @@ -1,4 +1,5 @@ return { + { "akinsho/git-conflict.nvim", version = "*", config = true }, { "toppair/peek.nvim", event = { "VeryLazy" }, From 3c89d81dc82eaa0cba777f0717f3047f468e4678 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 12 Sep 2025 23:13:37 +1200 Subject: [PATCH 28/29] feat --- fish/completions/fisher.fish | 7 - fish/completions/fzf_configure_bindings.fish | 8 - fish/conf.d/fzf.fish | 28 -- fish/config.fish | 27 -- fish/fish_plugins | 4 - fish/fish_variables | 44 ---- fish/functions/__bass.py | 140 ---------- .../_fzf_configure_bindings_help.fish | 43 ---- fish/functions/_fzf_extract_var_info.fish | 15 -- fish/functions/_fzf_preview_changed_file.fish | 49 ---- fish/functions/_fzf_preview_file.fish | 43 ---- fish/functions/_fzf_report_diff_type.fish | 18 -- fish/functions/_fzf_report_file_type.fish | 6 - fish/functions/_fzf_search_directory.fish | 33 --- fish/functions/_fzf_search_git_log.fish | 36 --- fish/functions/_fzf_search_git_status.fish | 41 --- fish/functions/_fzf_search_history.fish | 39 --- fish/functions/_fzf_search_processes.fish | 32 --- fish/functions/_fzf_search_variables.fish | 47 ---- fish/functions/_fzf_wrapper.fish | 21 -- fish/functions/bass.fish | 29 --- fish/functions/fisher.fish | 240 ------------------ fish/functions/fzf_configure_bindings.fish | 46 ---- fish/functions/search.fish | 14 - fish/setup.sh | 3 - 25 files changed, 1013 deletions(-) delete mode 100644 fish/completions/fisher.fish delete mode 100644 fish/completions/fzf_configure_bindings.fish delete mode 100644 fish/conf.d/fzf.fish delete mode 100644 fish/config.fish delete mode 100644 fish/fish_plugins delete mode 100644 fish/fish_variables delete mode 100644 fish/functions/__bass.py delete mode 100644 fish/functions/_fzf_configure_bindings_help.fish delete mode 100644 fish/functions/_fzf_extract_var_info.fish delete mode 100644 fish/functions/_fzf_preview_changed_file.fish delete mode 100644 fish/functions/_fzf_preview_file.fish delete mode 100644 fish/functions/_fzf_report_diff_type.fish delete mode 100644 fish/functions/_fzf_report_file_type.fish delete mode 100644 fish/functions/_fzf_search_directory.fish delete mode 100644 fish/functions/_fzf_search_git_log.fish delete mode 100644 fish/functions/_fzf_search_git_status.fish delete mode 100644 fish/functions/_fzf_search_history.fish delete mode 100644 fish/functions/_fzf_search_processes.fish delete mode 100644 fish/functions/_fzf_search_variables.fish delete mode 100644 fish/functions/_fzf_wrapper.fish delete mode 100644 fish/functions/bass.fish delete mode 100644 fish/functions/fisher.fish delete mode 100644 fish/functions/fzf_configure_bindings.fish delete mode 100644 fish/functions/search.fish delete mode 100644 fish/setup.sh diff --git a/fish/completions/fisher.fish b/fish/completions/fisher.fish deleted file mode 100644 index 6d23ce4..0000000 --- a/fish/completions/fisher.fish +++ /dev/null @@ -1,7 +0,0 @@ -complete --command fisher --exclusive --long help --description "Print help" -complete --command fisher --exclusive --long version --description "Print version" -complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins" -complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins" -complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins" -complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex" -complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)" diff --git a/fish/completions/fzf_configure_bindings.fish b/fish/completions/fzf_configure_bindings.fish deleted file mode 100644 index b38ef92..0000000 --- a/fish/completions/fzf_configure_bindings.fish +++ /dev/null @@ -1,8 +0,0 @@ -complete fzf_configure_bindings --no-files -complete fzf_configure_bindings --long help --short h --description "Print help" --condition "not __fish_seen_argument --help -h" -complete fzf_configure_bindings --long directory --description "Change the key binding for Search Directory" --condition "not __fish_seen_argument --directory" -complete fzf_configure_bindings --long git_log --description "Change the key binding for Search Git Log" --condition "not __fish_seen_argument --git_log" -complete fzf_configure_bindings --long git_status --description "Change the key binding for Search Git Status" --condition "not __fish_seen_argument --git_status" -complete fzf_configure_bindings --long history --description "Change the key binding for Search History" --condition "not __fish_seen_argument --history" -complete fzf_configure_bindings --long processes --description "Change the key binding for Search Processes" --condition "not __fish_seen_argument --processes" -complete fzf_configure_bindings --long variables --description "Change the key binding for Search Variables" --condition "not __fish_seen_argument --variables" diff --git a/fish/conf.d/fzf.fish b/fish/conf.d/fzf.fish deleted file mode 100644 index 8156c11..0000000 --- a/fish/conf.d/fzf.fish +++ /dev/null @@ -1,28 +0,0 @@ -# fzf.fish is only meant to be used in interactive mode. If not in interactive mode and not in CI, skip the config to speed up shell startup -if not status is-interactive && test "$CI" != true - exit -end - -# Because of scoping rules, to capture the shell variables exactly as they are, we must read -# them before even executing _fzf_search_variables. We use psub to store the -# variables' info in temporary files and pass in the filenames as arguments. -# This variable is global so that it can be referenced by fzf_configure_bindings and in tests -set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)' - - -# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings -fzf_configure_bindings - -# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased -function _fzf_uninstall --on-event fzf_uninstall - _fzf_uninstall_bindings - - set --erase _fzf_search_vars_command - functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings - complete --erase fzf_configure_bindings - - set_color cyan - echo "fzf.fish uninstalled." - echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings." - set_color normal -end diff --git a/fish/config.fish b/fish/config.fish deleted file mode 100644 index 9c2a829..0000000 --- a/fish/config.fish +++ /dev/null @@ -1,27 +0,0 @@ -# Enable Nix daemon -if test -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish' - source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish' -end - -# Source common environment variables -set -gx XDG_CONFIG_HOME ~/dotfiles -set -gx PERSONAL_PATH "$HOME/personal" -set -gx TODO "$PERSONAL_PATH/todo.md" -set -gx EDITOR nvim - -bass source ~/dotfiles/scripts/aliases.sh -alias 'claude'='npx claude' -alias 't'='tmux new' -alias 's'='search' - -# Add homebrew to PATH -set -gx PATH /opt/homebrew/bin $PATH - -# Disable fish greeting message -set -g fish_greeting - -if status is-interactive - bass source ~/dotfiles/scripts/aliases.sh - starship init fish | source - set -gx PATH ~/.fzf/bin $PATH -end diff --git a/fish/fish_plugins b/fish/fish_plugins deleted file mode 100644 index 21d890d..0000000 --- a/fish/fish_plugins +++ /dev/null @@ -1,4 +0,0 @@ -jorgebucaran/fisher -edc/bass -patrickf1/fzf.fish -jethrokuan/z diff --git a/fish/fish_variables b/fish/fish_variables deleted file mode 100644 index dda8531..0000000 --- a/fish/fish_variables +++ /dev/null @@ -1,44 +0,0 @@ -# This file contains fish universal variable definitions. -# VERSION: 3.0 -SETUVAR --export SSH_AGENT_PID:1692 -SETUVAR --export SSH_AUTH_SOCK:/var/folders/jw/lwkqkhhd0h75z8pbdfb1m4w40000gn/T//ssh\x2dMSmKgj2yyfo8/agent\x2e1691 -SETUVAR ZO_CMD:zo -SETUVAR Z_CMD:z -SETUVAR Z_DATA:/Users/adamgreen/\x2elocal/share/z/data -SETUVAR Z_DATA_DIR:/Users/adamgreen/\x2elocal/share/z -SETUVAR Z_EXCLUDE:\x5e/Users/adamgreen\x24 -SETUVAR __fish_initialized:3800 -SETUVAR _fisher_edc_2F_bass_files:\x7e/dotfiles/fish/functions/__bass\x2epy\x1e\x7e/dotfiles/fish/functions/bass\x2efish -SETUVAR _fisher_jethrokuan_2F_z_files:\x7e/dotfiles/fish/functions/__z\x2efish\x1e\x7e/dotfiles/fish/functions/__z_add\x2efish\x1e\x7e/dotfiles/fish/functions/__z_clean\x2efish\x1e\x7e/dotfiles/fish/functions/__z_complete\x2efish\x1e\x7e/dotfiles/fish/conf\x2ed/z\x2efish -SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/dotfiles/fish/functions/fisher\x2efish\x1e\x7e/dotfiles/fish/completions/fisher\x2efish -SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/dotfiles/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_history\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/dotfiles/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/dotfiles/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/dotfiles/fish/conf\x2ed/fzf\x2efish\x1e\x7e/dotfiles/fish/completions/fzf_configure_bindings\x2efish -SETUVAR _fisher_plugins:jorgebucaran/fisher\x1eedc/bass\x1epatrickf1/fzf\x2efish\x1ejethrokuan/z -SETUVAR _fisher_upgraded_to_4_4:\x1d -SETUVAR fish_color_autosuggestion:brblack -SETUVAR fish_color_cancel:\x2dr -SETUVAR fish_color_command:normal -SETUVAR fish_color_comment:red -SETUVAR fish_color_cwd:green -SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:green -SETUVAR fish_color_error:brred -SETUVAR fish_color_escape:brcyan -SETUVAR fish_color_history_current:\x2d\x2dbold -SETUVAR fish_color_host:normal -SETUVAR fish_color_host_remote:yellow -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:brcyan -SETUVAR fish_color_param:cyan -SETUVAR fish_color_quote:yellow -SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold -SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_status:red -SETUVAR fish_color_user:brgreen -SETUVAR fish_color_valid_path:\x2d\x2dunderline -SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_completion:normal -SETUVAR fish_pager_color_description:yellow\x1e\x2di -SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline -SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan -SETUVAR fish_pager_color_selected_background:\x2dr diff --git a/fish/functions/__bass.py b/fish/functions/__bass.py deleted file mode 100644 index 3f02bd4..0000000 --- a/fish/functions/__bass.py +++ /dev/null @@ -1,140 +0,0 @@ -""" -To be used with a companion fish function like this: - - function refish - set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x - end - -""" - -from __future__ import print_function - -import json -import os -import signal -import subprocess -import sys -import traceback - - -BASH = 'bash' - -FISH_READONLY = [ - 'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version', - 'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode' -] - -IGNORED = [ - 'PS1', 'XPC_SERVICE_NAME' -] - -def ignored(name): - if name == 'PWD': # this is read only, but has special handling - return False - # ignore other read only variables - if name in FISH_READONLY: - return True - if name in IGNORED or name.startswith("BASH_FUNC"): - return True - if name.startswith('%'): - return True - return False - -def escape(string): - # use json.dumps to reliably escape quotes and backslashes - return json.dumps(string).replace(r'$', r'\$') - -def escape_identifier(word): - return escape(word.replace('?', '\\?')) - -def comment(string): - return '\n'.join(['# ' + line for line in string.split('\n')]) - -def gen_script(): - # Use the following instead of /usr/bin/env to read environment so we can - # deal with multi-line environment variables (and other odd cases). - env_reader = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable) - args = [BASH, '-c', env_reader] - output = subprocess.check_output(args, universal_newlines=True) - old_env = output.strip() - - pipe_r, pipe_w = os.pipe() - if sys.version_info >= (3, 4): - os.set_inheritable(pipe_w, True) - command = 'eval $1 && ({}; alias) >&{}'.format( - env_reader, - pipe_w - ) - args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])] - p = subprocess.Popen(args, universal_newlines=True, close_fds=False) - os.close(pipe_w) - with os.fdopen(pipe_r) as f: - new_env = f.readline() - alias_str = f.read() - if p.wait() != 0: - raise subprocess.CalledProcessError( - returncode=p.returncode, - cmd=' '.join(sys.argv[1:]), - output=new_env + alias_str - ) - new_env = new_env.strip() - - old_env = json.loads(old_env) - new_env = json.loads(new_env) - - script_lines = [] - - for k, v in new_env.items(): - if ignored(k): - continue - v1 = old_env.get(k) - if not v1: - script_lines.append(comment('adding %s=%s' % (k, v))) - elif v1 != v: - script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v))) - # process special variables - if k == 'PWD': - script_lines.append('cd %s' % escape(v)) - continue - else: - continue - if k == 'PATH': - value = ' '.join([escape(directory) - for directory in v.split(':')]) - else: - value = escape(v) - script_lines.append('set -g -x %s %s' % (k, value)) - - for var in set(old_env.keys()) - set(new_env.keys()): - script_lines.append(comment('removing %s' % var)) - script_lines.append('set -e %s' % var) - - script = '\n'.join(script_lines) - - alias_lines = [] - for line in alias_str.splitlines(): - _, rest = line.split(None, 1) - k, v = rest.split("=", 1) - alias_lines.append("alias " + escape_identifier(k) + "=" + v) - alias = '\n'.join(alias_lines) - - return script + '\n' + alias - -script_file = os.fdopen(3, 'w') - -if not sys.argv[1:]: - print('__bass_usage', file=script_file, end='') - sys.exit(0) - -try: - script = gen_script() -except subprocess.CalledProcessError as e: - sys.exit(e.returncode) -except Exception: - print('Bass internal error!', file=sys.stderr) - raise # traceback will output to stderr -except KeyboardInterrupt: - signal.signal(signal.SIGINT, signal.SIG_DFL) - os.kill(os.getpid(), signal.SIGINT) -else: - script_file.write(script) diff --git a/fish/functions/_fzf_configure_bindings_help.fish b/fish/functions/_fzf_configure_bindings_help.fish deleted file mode 100644 index ecfe68e..0000000 --- a/fish/functions/_fzf_configure_bindings_help.fish +++ /dev/null @@ -1,43 +0,0 @@ -function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings." - echo "\ -USAGE: - fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...] - -DESCRIPTION - fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it - previously installed. It installs bindings for both default and insert modes. fzf.fish executes - it without options on fish startup to install the out-of-the-box key bindings. - - By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding - can be configured using a namesake corresponding option: - COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION - Search Directory | Ctrl+Alt+F (F for file) | --directory - Search Git Log | Ctrl+Alt+L (L for log) | --git_log - Search Git Status | Ctrl+Alt+S (S for status) | --git_status - Search History | Ctrl+R (R for reverse) | --history - Search Processes | Ctrl+Alt+P (P for process) | --processes - Search Variables | Ctrl+V (V for variable) | --variables - Override a command's binding by specifying its corresponding option with the desired key - sequence. Disable a command's binding by specifying its corresponding option with no value. - - Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly - executed multiple times. Once the desired fzf_configure_bindings command has been found, add it - to your config.fish in order to persist the customized bindings. - - In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an - equals sign between an option's name and value. However, it does not validate key sequences. - - Pass -h or --help to print this help message and exit. - -EXAMPLES - Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V - \$ fzf_configure_bindings --directory=\cf --variables=\e\cv - Default bindings but disable Search History - \$ fzf_configure_bindings --history= - An agglomeration of different options - \$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes= - -SEE Also - To learn more about fish key bindings, see bind(1) and fish_key_reader(1). -" -end diff --git a/fish/functions/_fzf_extract_var_info.fish b/fish/functions/_fzf_extract_var_info.fish deleted file mode 100644 index dd4e952..0000000 --- a/fish/functions/_fzf_extract_var_info.fish +++ /dev/null @@ -1,15 +0,0 @@ -# helper function for _fzf_search_variables -function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output." - # Extract only the lines about the variable, all of which begin with either - # $variable_name: ...or... $variable_name[ - string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output | - - # Strip the variable name prefix, including ": " for scope info lines - string replace --regex "^\\\$$variable_name(?:: )?" '' | - - # Distill the lines of values, replacing... - # [1]: |value| - # ...with... - # [1] value - string replace --regex ": \|(.*)\|" ' $1' -end diff --git a/fish/functions/_fzf_preview_changed_file.fish b/fish/functions/_fzf_preview_changed_file.fish deleted file mode 100644 index 78dd561..0000000 --- a/fish/functions/_fzf_preview_changed_file.fish +++ /dev/null @@ -1,49 +0,0 @@ -# helper for _fzf_search_git_status -# arg should be a line from git status --short, e.g. -# MM functions/_fzf_preview_changed_file.fish -# D README.md -# R LICENSE -> "New License" -function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file." - # remove quotes because they'll be interpreted literally by git diff - # no need to requote when referencing $path because fish does not perform word splitting - # https://fishshell.com/docs/current/fish_for_bash_users.html - set -f path (string unescape (string sub --start 4 $path_status)) - # first letter of short format shows index, second letter shows working tree - # https://git-scm.com/docs/git-status/2.35.0#_short_format - set -f index_status (string sub --length 1 $path_status) - set -f working_tree_status (string sub --start 2 --length 1 $path_status) - - set -f diff_opts --color=always - - if test $index_status = '?' - _fzf_report_diff_type Untracked - _fzf_preview_file $path - else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU - # Unmerged statuses taken directly from git status help's short format table - # Unmerged statuses are mutually exclusive with other statuses, so if we see - # these, then safe to assume the path is unmerged - _fzf_report_diff_type Unmerged - git diff $diff_opts -- $path - else - if test $index_status != ' ' - _fzf_report_diff_type Staged - - # renames are only detected in the index, never working tree, so only need to test for it here - # https://stackoverflow.com/questions/73954214 - if test $index_status = R - # diff the post-rename path with the original path, otherwise the diff will show the entire file as being added - set -f orig_and_new_path (string split --max 1 -- ' -> ' $path) - git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2] - # path currently has the form of "original -> current", so we need to correct it before it's used below - set path $orig_and_new_path[2] - else - git diff --staged $diff_opts -- $path - end - end - - if test $working_tree_status != ' ' - _fzf_report_diff_type Unstaged - git diff $diff_opts -- $path - end - end -end diff --git a/fish/functions/_fzf_preview_file.fish b/fish/functions/_fzf_preview_file.fish deleted file mode 100644 index c926475..0000000 --- a/fish/functions/_fzf_preview_file.fish +++ /dev/null @@ -1,43 +0,0 @@ -# helper function for _fzf_search_directory and _fzf_search_git_status -function _fzf_preview_file --description "Print a preview for the given file based on its file type." - # because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file - # as one argument, we collect all the arguments into one single variable and treat that as the path - set -f file_path $argv - - if test -L "$file_path" # symlink - # notify user and recurse on the target of the symlink, which can be any of these file types - set -l target_path (realpath "$file_path") - - set_color yellow - echo "'$file_path' is a symlink to '$target_path'." - set_color normal - - _fzf_preview_file "$target_path" - else if test -f "$file_path" # regular file - if set --query fzf_preview_file_cmd - # need to escape quotes to make sure eval receives file_path as a single arg - eval "$fzf_preview_file_cmd '$file_path'" - else - bat --style=numbers --color=always "$file_path" - end - else if test -d "$file_path" # directory - if set --query fzf_preview_dir_cmd - # see above - eval "$fzf_preview_dir_cmd '$file_path'" - else - # -A list hidden files as well, except for . and .. - # -F helps classify files by appending symbols after the file name - command ls -A -F "$file_path" - end - else if test -c "$file_path" - _fzf_report_file_type "$file_path" "character device file" - else if test -b "$file_path" - _fzf_report_file_type "$file_path" "block device file" - else if test -S "$file_path" - _fzf_report_file_type "$file_path" socket - else if test -p "$file_path" - _fzf_report_file_type "$file_path" "named pipe" - else - echo "$file_path doesn't exist." >&2 - end -end diff --git a/fish/functions/_fzf_report_diff_type.fish b/fish/functions/_fzf_report_diff_type.fish deleted file mode 100644 index cc26fb3..0000000 --- a/fish/functions/_fzf_report_diff_type.fish +++ /dev/null @@ -1,18 +0,0 @@ -# helper for _fzf_preview_changed_file -# prints out something like -# ╭────────╮ -# │ Staged │ -# ╰────────╯ -function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch." - # number of "-" to draw is the length of the string to box + 2 for padding - set -f repeat_count (math 2 + (string length $diff_type)) - set -f line (string repeat --count $repeat_count ─) - set -f top_border ╭$line╮ - set -f btm_border ╰$line╯ - - set_color yellow - echo $top_border - echo "│ $diff_type │" - echo $btm_border - set_color normal -end diff --git a/fish/functions/_fzf_report_file_type.fish b/fish/functions/_fzf_report_file_type.fish deleted file mode 100644 index 49e02e1..0000000 --- a/fish/functions/_fzf_report_file_type.fish +++ /dev/null @@ -1,6 +0,0 @@ -# helper function for _fzf_preview_file -function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file." - set_color red - echo "Cannot preview '$file_path': it is a $file_type." - set_color normal -end diff --git a/fish/functions/_fzf_search_directory.fish b/fish/functions/_fzf_search_directory.fish deleted file mode 100644 index 4541eec..0000000 --- a/fish/functions/_fzf_search_directory.fish +++ /dev/null @@ -1,33 +0,0 @@ -function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths." - # Directly use fd binary to avoid output buffering delay caused by a fd alias, if any. - # Debian-based distros install fd as fdfind and the fd package is something else, so - # check for fdfind first. Fall back to "fd" for a clear error message. - set -f fd_cmd (command -v fdfind || command -v fd || echo "fd") - set -f --append fd_cmd --color=always $fzf_fd_opts - - set -f fzf_arguments --multi --ansi $fzf_directory_opts - set -f token (commandline --current-token) - # expand any variables or leading tilde (~) in the token - set -f expanded_token (eval echo -- $token) - # unescape token because it's already quoted so backslashes will mess up the path - set -f unescaped_exp_token (string unescape -- $expanded_token) - - # If the current token is a directory and has a trailing slash, - # then use it as fd's base directory. - if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token" - set --append fd_cmd --base-directory=$unescaped_exp_token - # use the directory name as fzf's prompt to indicate the search is limited to that directory - set --prepend fzf_arguments --prompt="Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}" - set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) - else - set --prepend fzf_arguments --prompt="Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}' - set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) - end - - - if test $status -eq 0 - commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ') - end - - commandline --function repaint -end diff --git a/fish/functions/_fzf_search_git_log.fish b/fish/functions/_fzf_search_git_log.fish deleted file mode 100644 index aa54724..0000000 --- a/fish/functions/_fzf_search_git_log.fish +++ /dev/null @@ -1,36 +0,0 @@ -function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash." - if not git rev-parse --git-dir >/dev/null 2>&1 - echo '_fzf_search_git_log: Not in a git repository.' >&2 - else - if not set --query fzf_git_log_format - # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below - set -f fzf_git_log_format '%C(bold blue)%h%C(reset) - %C(cyan)%ad%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)' - end - - set -f preview_cmd 'git show --color=always --stat --patch {1}' - if set --query fzf_diff_highlighter - set preview_cmd "$preview_cmd | $fzf_diff_highlighter" - end - - set -f selected_log_lines ( - git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \ - _fzf_wrapper --ansi \ - --multi \ - --scheme=history \ - --prompt="Git Log> " \ - --preview=$preview_cmd \ - --query=(commandline --current-token) \ - $fzf_git_log_opts - ) - if test $status -eq 0 - for line in $selected_log_lines - set -f abbreviated_commit_hash (string split --field 1 " " $line) - set -f full_commit_hash (git rev-parse $abbreviated_commit_hash) - set -f --append commit_hashes $full_commit_hash - end - commandline --current-token --replace (string join ' ' $commit_hashes) - end - end - - commandline --function repaint -end diff --git a/fish/functions/_fzf_search_git_status.fish b/fish/functions/_fzf_search_git_status.fish deleted file mode 100644 index 358f88c..0000000 --- a/fish/functions/_fzf_search_git_status.fish +++ /dev/null @@ -1,41 +0,0 @@ -function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths." - if not git rev-parse --git-dir >/dev/null 2>&1 - echo '_fzf_search_git_status: Not in a git repository.' >&2 - else - set -f preview_cmd '_fzf_preview_changed_file {}' - if set --query fzf_diff_highlighter - set preview_cmd "$preview_cmd | $fzf_diff_highlighter" - end - - set -f selected_paths ( - # Pass configuration color.status=always to force status to use colors even though output is sent to a pipe - git -c color.status=always status --short | - _fzf_wrapper --ansi \ - --multi \ - --prompt="Git Status> " \ - --query=(commandline --current-token) \ - --preview=$preview_cmd \ - --nth="2.." \ - $fzf_git_status_opts - ) - if test $status -eq 0 - # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle - # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping") - set -f cleaned_paths - - for path in $selected_paths - if test (string sub --length 1 $path) = R - # path has been renamed and looks like "R LICENSE -> LICENSE.md" - # extract the path to use from after the arrow - set --append cleaned_paths (string split -- "-> " $path)[-1] - else - set --append cleaned_paths (string sub --start=4 $path) - end - end - - commandline --current-token --replace -- (string join ' ' $cleaned_paths) - end - end - - commandline --function repaint -end diff --git a/fish/functions/_fzf_search_history.fish b/fish/functions/_fzf_search_history.fish deleted file mode 100644 index cafbce9..0000000 --- a/fish/functions/_fzf_search_history.fish +++ /dev/null @@ -1,39 +0,0 @@ -function _fzf_search_history --description "Search command history. Replace the command line with the selected command." - # history merge incorporates history changes from other fish sessions - # it errors out if called in private mode - if test -z "$fish_private_mode" - builtin history merge - end - - if not set --query fzf_history_time_format - # Reference https://devhints.io/strftime to understand strftime format symbols - set -f fzf_history_time_format "%m-%d %H:%M:%S" - end - - # Delinate time from command in history entries using the vertical box drawing char (U+2502). - # Then, to get raw command from history entries, delete everything up to it. The ? on regex is - # necessary to make regex non-greedy so it won't match into commands containing the char. - set -f time_prefix_regex '^.*? │ ' - # Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line - set -f commands_selected ( - builtin history --null --show-time="$fzf_history_time_format │ " | - _fzf_wrapper --read0 \ - --print0 \ - --multi \ - --scheme=history \ - --prompt="History> " \ - --query=(commandline) \ - --preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \ - --preview-window="bottom:3:wrap" \ - $fzf_history_opts | - string split0 | - # remove timestamps from commands selected - string replace --regex $time_prefix_regex '' - ) - - if test $status -eq 0 - commandline --replace -- $commands_selected - end - - commandline --function repaint -end diff --git a/fish/functions/_fzf_search_processes.fish b/fish/functions/_fzf_search_processes.fish deleted file mode 100644 index 133a880..0000000 --- a/fish/functions/_fzf_search_processes.fish +++ /dev/null @@ -1,32 +0,0 @@ -function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process." - # Directly use ps command because it is often aliased to a different command entirely - # or with options that dirty the search results and preview output - set -f ps_cmd (command -v ps || echo "ps") - # use all caps to be consistent with ps default format - # snake_case because ps doesn't seem to allow spaces in the field names - set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command') - set -f processes_selected ( - $ps_cmd -A -opid,command | \ - _fzf_wrapper --multi \ - --prompt="Processes> " \ - --query (commandline --current-token) \ - --ansi \ - # first line outputted by ps is a header, so we need to mark it as so - --header-lines=1 \ - # ps uses exit code 1 if the process was not found, in which case show an message explaining so - --preview="$ps_cmd -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \ - --preview-window="bottom:4:wrap" \ - $fzf_processes_opts - ) - - if test $status -eq 0 - for process in $processes_selected - set -f --append pids_selected (string split --no-empty --field=1 -- " " $process) - end - - # string join to replace the newlines outputted by string split with spaces - commandline --current-token --replace -- (string join ' ' $pids_selected) - end - - commandline --function repaint -end diff --git a/fish/functions/_fzf_search_variables.fish b/fish/functions/_fzf_search_variables.fish deleted file mode 100644 index 52a7c70..0000000 --- a/fish/functions/_fzf_search_variables.fish +++ /dev/null @@ -1,47 +0,0 @@ -# This function expects the following two arguments: -# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables -# argument 2 = output of (set --names | psub), i.e. a file with all variable names -function _fzf_search_variables --argument-names set_show_output set_names_output --description "Search and preview shell variables. Replace the current token with the selected variable." - if test -z "$set_names_output" - printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2 - - commandline --function repaint - return 22 # 22 means invalid argument in POSIX - end - - # Exclude the history variable from being piped into fzf because - # 1. it's not included in $set_names_output - # 2. it tends to be a very large value => increases computation time - # 3._fzf_search_history is a much better way to examine history anyway - set -f all_variable_names (string match --invert history <$set_names_output) - - set -f current_token (commandline --current-token) - # Use the current token to pre-populate fzf's query. If the current token begins - # with a $, remove it from the query so that it will better match the variable names - set -f cleaned_curr_token (string replace -- '$' '' $current_token) - - set -f variable_names_selected ( - printf '%s\n' $all_variable_names | - _fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \ - --prompt="Variables> " \ - --preview-window="wrap" \ - --multi \ - --query=$cleaned_curr_token \ - $fzf_variables_opts - ) - - if test $status -eq 0 - # If the current token begins with a $, do not overwrite the $ when - # replacing the current token with the selected variable. - # Uses brace expansion to prepend $ to each variable name. - commandline --current-token --replace ( - if string match --quiet -- '$*' $current_token - string join " " \${$variable_names_selected} - else - string join " " $variable_names_selected - end - ) - end - - commandline --function repaint -end diff --git a/fish/functions/_fzf_wrapper.fish b/fish/functions/_fzf_wrapper.fish deleted file mode 100644 index 486e36c..0000000 --- a/fish/functions/_fzf_wrapper.fish +++ /dev/null @@ -1,21 +0,0 @@ -function _fzf_wrapper --description "Prepares some environment variables before executing fzf." - # Make sure fzf uses fish to execute preview commands, some of which - # are autoloaded fish functions so don't exist in other shells. - # Use --function so that it doesn't clobber SHELL outside this function. - set -f --export SHELL (command --search fish) - - # If neither FZF_DEFAULT_OPTS nor FZF_DEFAULT_OPTS_FILE are set, then set some sane defaults. - # See https://github.com/junegunn/fzf#environment-variables - set --query FZF_DEFAULT_OPTS FZF_DEFAULT_OPTS_FILE - if test $status -eq 2 - # cycle allows jumping between the first and last results, making scrolling faster - # layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env - # border shows where the fzf window begins and ends - # height=90% leaves space to see the current command and some scrollback, maintaining context of work - # preview-window=wrap wraps long lines in the preview window, making reading easier - # marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >) - set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"' - end - - fzf $argv -end diff --git a/fish/functions/bass.fish b/fish/functions/bass.fish deleted file mode 100644 index 2b3af16..0000000 --- a/fish/functions/bass.fish +++ /dev/null @@ -1,29 +0,0 @@ -function bass - set -l bash_args $argv - set -l bass_debug - if test "$bash_args[1]_" = '-d_' - set bass_debug true - set -e bash_args[1] - end - - set -l script_file (mktemp) - if command -v python3 >/dev/null 2>&1 - command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file - else - command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file - end - set -l bass_status $status - if test $bass_status -ne 0 - return $bass_status - end - - if test -n "$bass_debug" - cat $script_file - end - source $script_file - command rm $script_file -end - -function __bass_usage - echo "Usage: bass [-d] " -end diff --git a/fish/functions/fisher.fish b/fish/functions/fisher.fish deleted file mode 100644 index e915cb8..0000000 --- a/fish/functions/fisher.fish +++ /dev/null @@ -1,240 +0,0 @@ -function fisher --argument-names cmd --description "A plugin manager for Fish" - set --query fisher_path || set --local fisher_path $__fish_config_dir - set --local fisher_version 4.4.5 - set --local fish_plugins $__fish_config_dir/fish_plugins - - switch "$cmd" - case -v --version - echo "fisher, version $fisher_version" - case "" -h --help - echo "Usage: fisher install Install plugins" - echo " fisher remove Remove installed plugins" - echo " fisher update Update installed plugins" - echo " fisher update Update all installed plugins" - echo " fisher list [] List installed plugins matching regex" - echo "Options:" - echo " -v, --version Print version" - echo " -h, --help Print this help message" - echo "Variables:" - echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~ - case ls list - string match --entire --regex -- "$argv[2]" $_fisher_plugins - case install update remove - isatty || read --local --null --array stdin && set --append argv $stdin - - set --local install_plugins - set --local update_plugins - set --local remove_plugins - set --local arg_plugins $argv[2..-1] - set --local old_plugins $_fisher_plugins - set --local new_plugins - - test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins | string replace -- \~ ~) - - if ! set --query argv[2] - if test "$cmd" != update - echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1 - else if ! set --query file_plugins - echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1 - end - set arg_plugins $file_plugins - end - - for plugin in $arg_plugins - set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin) - contains -- "$plugin" $new_plugins || set --append new_plugins $plugin - end - - if set --query argv[2] - for plugin in $new_plugins - if contains -- "$plugin" $old_plugins - test "$cmd" = remove && - set --append remove_plugins $plugin || - set --append update_plugins $plugin - else if test "$cmd" = install - set --append install_plugins $plugin - else - echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1 - end - end - else - for plugin in $new_plugins - contains -- "$plugin" $old_plugins && - set --append update_plugins $plugin || - set --append install_plugins $plugin - end - - for plugin in $old_plugins - contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin - end - end - - set --local pid_list - set --local source_plugins - set --local fetch_plugins $update_plugins $install_plugins - set --local fish_path (status fish-path) - - echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal) - - for plugin in $fetch_plugins - set --local source (command mktemp -d) - set --append source_plugins $source - - command mkdir -p $source/{completions,conf.d,themes,functions} - - $fish_path --command " - if test -e $plugin - command cp -Rf $plugin/* $source - else - set temp (command mktemp -d) - set repo (string split -- \@ $plugin) || set repo[2] HEAD - - if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1]) - set name (string split -- / \$path)[-1] - set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz - else - set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2] - end - - echo Fetching (set_color --underline)\$url(set_color normal) - - if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null - command cp -Rf \$temp/*/* $source - else - echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2 - command rm -rf $source - end - - command rm -rf \$temp - end - - set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files - " & - - set --append pid_list (jobs --last --pid) - end - - wait $pid_list 2>/dev/null - - for plugin in $fetch_plugins - if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source - if set --local index (contains --index -- "$plugin" $install_plugins) - set --erase install_plugins[$index] - else - set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)] - end - end - end - - for plugin in $update_plugins $remove_plugins - if set --local index (contains --index -- "$plugin" $_fisher_plugins) - set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files - - if contains -- "$plugin" $remove_plugins - for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var) - emit {$name}_uninstall - end - printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ - set --erase _fisher_plugins[$index] - end - - command rm -rf (string replace -- \~ ~ $$plugin_files_var) - - functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var) - - for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var) - complete --erase --command $name - end - - set --erase $plugin_files_var - end - end - - if set --query update_plugins[1] || set --query install_plugins[1] - command mkdir -p $fisher_path/{functions,themes,conf.d,completions} - end - - for plugin in $update_plugins $install_plugins - set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] - set --local files $source/{functions,themes,conf.d,completions}/* - - if set --local index (contains --index -- $plugin $install_plugins) - set --local user_files $fisher_path/{functions,themes,conf.d,completions}/* - set --local conflict_files - - for file in (string replace -- $source/ $fisher_path/ $files) - contains -- $file $user_files && set --append conflict_files $file - end - - if set --query conflict_files[1] && set --erase install_plugins[$index] - echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2 - continue - end - end - - for file in (string replace -- $source/ "" $files) - command cp -RLf $source/$file $fisher_path/$file - end - - set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files - - set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~) - - contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin - contains -- $plugin $install_plugins && set --local event install || set --local event update - - printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ - - for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~) - source $file - if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file) - emit {$name}_$event - end - end - end - - command rm -rf $source_plugins - - if set --query _fisher_plugins[1] - set --local commit_plugins - - for plugin in $file_plugins - contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin - end - - for plugin in $_fisher_plugins - contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin - end - - string replace --regex -- $HOME \~ $commit_plugins >$fish_plugins - else - set --erase _fisher_plugins - command rm -f $fish_plugins - end - - set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins) - - test "$total" != "0 0 0" && echo (string join ", " ( - test $total[1] = 0 || echo "Installed $total[1]") ( - test $total[2] = 0 || echo "Updated $total[2]") ( - test $total[3] = 0 || echo "Removed $total[3]") - ) plugin/s - case \* - echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1 - end -end - -if ! set --query _fisher_upgraded_to_4_4 - set --universal _fisher_upgraded_to_4_4 - if functions --query _fisher_list - set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share - command rm -rf $XDG_DATA_HOME/fisher - functions --erase _fisher_{list,plugin_parse} - fisher update >/dev/null 2>/dev/null - else - for var in (set --names | string match --entire --regex '^_fisher_.+_files$') - set $var (string replace -- ~ \~ $$var) - end - functions --erase _fisher_fish_postexec - end -end diff --git a/fish/functions/fzf_configure_bindings.fish b/fish/functions/fzf_configure_bindings.fish deleted file mode 100644 index 4b4e7a2..0000000 --- a/fish/functions/fzf_configure_bindings.fish +++ /dev/null @@ -1,46 +0,0 @@ -# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect -# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1 -function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options." - # no need to install bindings if not in interactive mode or running tests - status is-interactive || test "$CI" = true; or return - - set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?' - argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null - if test $status -ne 0 - echo "Invalid option or a positional argument was provided." >&2 - _fzf_configure_bindings_help - return 22 - else if set --query _flag_help - _fzf_configure_bindings_help - return - else - # Initialize with default key sequences and then override or disable them based on flags - # index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables - set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape - set --query _flag_directory && set key_sequences[1] "$_flag_directory" - set --query _flag_git_log && set key_sequences[2] "$_flag_git_log" - set --query _flag_git_status && set key_sequences[3] "$_flag_git_status" - set --query _flag_history && set key_sequences[4] "$_flag_history" - set --query _flag_processes && set key_sequences[5] "$_flag_processes" - set --query _flag_variables && set key_sequences[6] "$_flag_variables" - - # If fzf bindings already exists, uninstall it first for a clean slate - if functions --query _fzf_uninstall_bindings - _fzf_uninstall_bindings - end - - for mode in default insert - test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory - test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log - test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status - test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history - test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes - test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command" - end - - function _fzf_uninstall_bindings --inherit-variable key_sequences - bind --erase -- $key_sequences - bind --erase --mode insert -- $key_sequences - end - end -end diff --git a/fish/functions/search.fish b/fish/functions/search.fish deleted file mode 100644 index 6fdf8a9..0000000 --- a/fish/functions/search.fish +++ /dev/null @@ -1,14 +0,0 @@ -function search -d "Search files with fzf and open in editor" - set term_height (tput lines) - set min_height 20 - - if test "$term_height" -ge "$min_height" - set files (fzf --preview 'bat --style=numbers --color=always {}' --height 60% -m) - else - set files (fzf --no-preview --height 40% -m) - end - - if test $status -eq 0; and test -n "$files" - eval "$EDITOR" $files - end -end \ No newline at end of file diff --git a/fish/setup.sh b/fish/setup.sh deleted file mode 100644 index 9fc9266..0000000 --- a/fish/setup.sh +++ /dev/null @@ -1,3 +0,0 @@ -curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher -fisher install edc/bass -fisher install jethrokuan/z From e89b0bd0c1f9f2f5c5768414be5d8cd7f7937c27 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Fri, 12 Sep 2025 23:13:52 +1200 Subject: [PATCH 29/29] feat --- fish/config.fish | 27 +++++++++++++++++++++++++++ fish/setup.sh | 3 +++ 2 files changed, 30 insertions(+) create mode 100644 fish/config.fish create mode 100644 fish/setup.sh diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..9c2a829 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,27 @@ +# Enable Nix daemon +if test -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish' + source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish' +end + +# Source common environment variables +set -gx XDG_CONFIG_HOME ~/dotfiles +set -gx PERSONAL_PATH "$HOME/personal" +set -gx TODO "$PERSONAL_PATH/todo.md" +set -gx EDITOR nvim + +bass source ~/dotfiles/scripts/aliases.sh +alias 'claude'='npx claude' +alias 't'='tmux new' +alias 's'='search' + +# Add homebrew to PATH +set -gx PATH /opt/homebrew/bin $PATH + +# Disable fish greeting message +set -g fish_greeting + +if status is-interactive + bass source ~/dotfiles/scripts/aliases.sh + starship init fish | source + set -gx PATH ~/.fzf/bin $PATH +end diff --git a/fish/setup.sh b/fish/setup.sh new file mode 100644 index 0000000..9fc9266 --- /dev/null +++ b/fish/setup.sh @@ -0,0 +1,3 @@ +curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher +fisher install edc/bass +fisher install jethrokuan/z