From 6d738e3497e012c79e04035bec9c9e56fee38ac2 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Wed, 15 Jan 2025 22:50:41 -0500 Subject: [PATCH 01/42] Bunch of neovim config changes, addition of Ghostty config --- .config/ghostty/config | 1 + .config/nvim/init.lua | 4 +- .config/nvim/lazy-lock.json | 54 ++++++++--------- .config/nvim/lua/custom/plugins/copilot.lua | 3 + .config/nvim/lua/custom/plugins/debug.lua | 8 --- .config/nvim/lua/custom/plugins/lint.lua | 2 +- .config/nvim/lua/custom/plugins/surround.lua | 12 ++++ .config/nvim/lua/custom/plugins/tabline.lua | 59 ------------------- .../nvim/lua/custom/plugins/todo-comments.lua | 4 +- .../nvim/lua/custom/plugins/vim-sleuth.lua | 6 -- .config/nvim/lua/custom/plugins/vs-tasks.lua | 23 -------- .config/nvim/lua/custom/plugins/zenmode.lua | 17 ------ .devcontainer/devcontainer.json | 2 - 13 files changed, 46 insertions(+), 149 deletions(-) create mode 100644 .config/nvim/lua/custom/plugins/copilot.lua create mode 100644 .config/nvim/lua/custom/plugins/surround.lua delete mode 100644 .config/nvim/lua/custom/plugins/tabline.lua delete mode 100644 .config/nvim/lua/custom/plugins/vim-sleuth.lua delete mode 100644 .config/nvim/lua/custom/plugins/vs-tasks.lua delete mode 100644 .config/nvim/lua/custom/plugins/zenmode.lua diff --git a/.config/ghostty/config b/.config/ghostty/config index 4437ccf..76400c8 100644 --- a/.config/ghostty/config +++ b/.config/ghostty/config @@ -4,5 +4,6 @@ # Additionally, each config option is also explained in detail # on Ghostty's website, at https://ghostty.org/docs/config. +command = /opt/homebrew/bin/fish theme = tokyonight diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index f826047..581b31f 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,6 +1,4 @@ -- Set ',' as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ',' vim.g.maplocalleader = ',' @@ -14,12 +12,14 @@ vim.g.have_nerd_font = true -- Make line numbers default vim.opt.number = true + -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' + -- Disable horizontal scroll. vim.opt.mousescroll = 'ver:3,hor:0' diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 969959f..688f9a5 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,49 +1,47 @@ { - "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" }, - "fidget.nvim": { "branch": "main", "commit": "9238947645ce17d96f30842e61ba81147185b657" }, + "conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" }, + "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, + "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, - "indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" }, - "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "gitsigns.nvim": { "branch": "main", "commit": "9541f5e8e24571723cb02a5c2bf078aeacc5a711" }, + "indent-blankline.nvim": { "branch": "master", "commit": "7a698a1d7ed755af9f5a88733b23ca246ce2df28" }, + "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, "lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, + "luvit-meta": { "branch": "main", "commit": "55709f183b0742a7e4f47688c284f81148ad4dc0" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.nvim": { "branch": "main", "commit": "2faada1cffce5609d78ac5e81eaf3754e0476758" }, - "neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "neo-tree.nvim": { "branch": "main", "commit": "e6645ecfcba3e064446a6def1c10d788c9873f51" }, "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" }, "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, - "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, - "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" }, - "nvim-dap": { "branch": "master", "commit": "665d3569a86395fe0dab85efbdb26d7d2ee57e49" }, - "nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" }, - "nvim-dap-ui": { "branch": "master", "commit": "e94d98649dccb6a3884b66aabc2e07beb279e535" }, - "nvim-lint": { "branch": "master", "commit": "1fea92f1d9908eaa5eb8bafe08b4293d7aadaa55" }, - "nvim-lspconfig": { "branch": "master", "commit": "ff2b85abaa810f6611233dbe6d31c07510ebf43d" }, + "nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" }, + "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, + "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, + "nvim-dap-go": { "branch": "main", "commit": "1bacf2fa7d4dc6a8a4f6cc390f1544e5b34c35a4" }, + "nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" }, + "nvim-lint": { "branch": "master", "commit": "dfa45de973c3ce7bd1b9a6d346f896a68ad07e44" }, + "nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-notify": { "branch": "master", "commit": "29b33efc802a304b1cf13ab200915d4e9e67373d" }, - "nvim-treesitter": { "branch": "master", "commit": "eb3e850acff4d9f2f2dd8dacd75353043c899753" }, - "nvim-web-devicons": { "branch": "master", "commit": "63f552a7f59badc6e6b6d22e603150f0d5abebb7" }, - "overseer.nvim": { "branch": "master", "commit": "10ee48ff96c8d1049efb278ea4c8cf9f3b0e4326" }, - "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, + "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" }, + "nvim-treesitter": { "branch": "master", "commit": "f0c928dbe93533b7e35894a8f957f40150d1f663" }, + "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, + "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" }, - "tokyonight.nvim": { "branch": "main", "commit": "45d22cf0e1b93476d3b6d362d720412b3d34465c" }, - "trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" }, + "tokyonight.nvim": { "branch": "main", "commit": "775f82f08a3d1fb55a37fc6d3a4ab10cd7ed8a10" }, + "trouble.nvim": { "branch": "main", "commit": "50481f414bd3c1a40122c1d759d7e424d5fafe84" }, "vim-helm": { "branch": "master", "commit": "ae1ebc160d2b9b90108477ab10df7a4fc501e358" }, - "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, - "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" }, - "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } + "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" } } diff --git a/.config/nvim/lua/custom/plugins/copilot.lua b/.config/nvim/lua/custom/plugins/copilot.lua new file mode 100644 index 0000000..84835e6 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/copilot.lua @@ -0,0 +1,3 @@ +return { + { 'github/copilot.vim' }, +} diff --git a/.config/nvim/lua/custom/plugins/debug.lua b/.config/nvim/lua/custom/plugins/debug.lua index caefdd9..69fe4c9 100644 --- a/.config/nvim/lua/custom/plugins/debug.lua +++ b/.config/nvim/lua/custom/plugins/debug.lua @@ -1,11 +1,3 @@ --- debug.lua --- --- Shows how to use the DAP plugin to debug your code. --- --- Primarily focused on configuring the debugger for Go, but can --- be extended to other languages as well. That's why it's called --- kickstart.nvim and not kitchen-sink.nvim ;) - return { -- NOTE: Yes, you can install new plugins here! 'mfussenegger/nvim-dap', diff --git a/.config/nvim/lua/custom/plugins/lint.lua b/.config/nvim/lua/custom/plugins/lint.lua index a34c0f9..eabc07c 100644 --- a/.config/nvim/lua/custom/plugins/lint.lua +++ b/.config/nvim/lua/custom/plugins/lint.lua @@ -5,7 +5,7 @@ return { config = function() local lint = require 'lint' lint.linters_by_ft = { - markdown = { 'markdownlint' }, + -- markdown = { 'markdownlint' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft, diff --git a/.config/nvim/lua/custom/plugins/surround.lua b/.config/nvim/lua/custom/plugins/surround.lua new file mode 100644 index 0000000..c3a9669 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/surround.lua @@ -0,0 +1,12 @@ +return { + { + 'kylechui/nvim-surround', + version = '*', -- Use for stability; omit to use `main` branch for the latest features + event = 'VeryLazy', + config = function() + require('nvim-surround').setup { + -- Configuration here, or leave empty to use defaults + } + end, + }, +} diff --git a/.config/nvim/lua/custom/plugins/tabline.lua b/.config/nvim/lua/custom/plugins/tabline.lua deleted file mode 100644 index 0bbac0d..0000000 --- a/.config/nvim/lua/custom/plugins/tabline.lua +++ /dev/null @@ -1,59 +0,0 @@ -return { - -- { - -- 'nanozuki/tabby.nvim', - -- -- event = 'VimEnter', -- if you want lazy load, see below - -- dependencies = 'nvim-tree/nvim-web-devicons', - -- config = function() - -- local theme = { - -- fill = 'TabLineFill', - -- -- Also you can do this: fill = { fg='#f2e9de', bg='#907aa9', style='italic' } - -- head = 'TabLine', - -- current_tab = 'TabLineSel', - -- tab = 'TabLine', - -- win = 'TabLine', - -- tail = 'TabLine', - -- } - -- require('tabby').setup { - -- line = function(line) - -- return { - -- { - -- { '  ', hl = theme.head }, - -- line.sep('', theme.head, theme.fill), - -- }, - -- line.tabs().foreach(function(tab) - -- local hl = tab.is_current() and theme.current_tab or theme.tab - -- return { - -- line.sep('', hl, theme.fill), - -- tab.is_current() and '' or '󰆣', - -- tab.number(), - -- tab.name(), - -- tab.close_btn '', - -- line.sep('', hl, theme.fill), - -- hl = hl, - -- margin = ' ', - -- } - -- end), - -- line.spacer(), - -- line.wins_in_tab(line.api.get_current_tab()).foreach(function(win) - -- return { - -- line.sep('', theme.win, theme.fill), - -- win.is_current() and '' or '', - -- win.buf_name(), - -- line.sep('', theme.win, theme.fill), - -- hl = theme.win, - -- margin = ' ', - -- } - -- end), - -- { - -- line.sep('', theme.tail, theme.fill), - -- { '  ', hl = theme.tail }, - -- }, - -- hl = theme.fill, - -- } - -- end, - -- -- option = {}, -- setup modules' option, - -- } - -- -- configs... - -- end, - -- }, -} diff --git a/.config/nvim/lua/custom/plugins/todo-comments.lua b/.config/nvim/lua/custom/plugins/todo-comments.lua index 8dc2cc7..34ddb5c 100644 --- a/.config/nvim/lua/custom/plugins/todo-comments.lua +++ b/.config/nvim/lua/custom/plugins/todo-comments.lua @@ -1,9 +1,7 @@ --- Highlight todo, notes, etc in comments return { { 'folke/todo-comments.nvim', - event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, - opts = { signs = false }, + opts = {}, }, } diff --git a/.config/nvim/lua/custom/plugins/vim-sleuth.lua b/.config/nvim/lua/custom/plugins/vim-sleuth.lua deleted file mode 100644 index aa8eda1..0000000 --- a/.config/nvim/lua/custom/plugins/vim-sleuth.lua +++ /dev/null @@ -1,6 +0,0 @@ --- Detect tabstop and shiftwidth automatically -return { - { - 'tpope/vim-sleuth', - }, -} diff --git a/.config/nvim/lua/custom/plugins/vs-tasks.lua b/.config/nvim/lua/custom/plugins/vs-tasks.lua deleted file mode 100644 index 4635d63..0000000 --- a/.config/nvim/lua/custom/plugins/vs-tasks.lua +++ /dev/null @@ -1,23 +0,0 @@ -return { - -- { - -- 'EthanJWright/vs-tasks.nvim', - -- dependencies = { - -- 'nvim-lua/popup.nvim', - -- 'nvim-lua/plenary.nvim', - -- 'nvim-telescope/telescope.nvim', - -- }, - -- config = function() - -- require('vstask').setup {} - -- end, - -- keys = { - -- { - -- 'ta', - -- function() - -- require('telescope').extensions.vstask.tasks() - -- end, - -- mode = 'n', - -- desc = 'VSCode [TA]sks', - -- }, - -- }, - -- }, -} diff --git a/.config/nvim/lua/custom/plugins/zenmode.lua b/.config/nvim/lua/custom/plugins/zenmode.lua deleted file mode 100644 index ff4b267..0000000 --- a/.config/nvim/lua/custom/plugins/zenmode.lua +++ /dev/null @@ -1,17 +0,0 @@ --- Enable ZenMode. --- --- Commands: --- ZenMode - Toggles Zen Mode. -return { - { - 'folke/zen-mode.nvim', - opts = { - plugins = { - tmux = { enabled = true }, - }, - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }, - }, -} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6c3600e..a8b8038 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,5 +29,3 @@ }, "remoteUser": "vscode" } - -/* vim: set filetype=jsonc : */ From 7ea83e65a5d069ac848c59ecacb76e91ee0a895e Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Fri, 24 Jan 2025 00:03:43 -0500 Subject: [PATCH 02/42] Nix tests --- .envrc | 2 ++ flake.nix | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .envrc create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..08c61d3 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use nix +MIKE=fasfasf diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..24a7dbc --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "A flake"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + }; + # outputs = { self, nixpkgs }: { + # packages = { + # aarch64-darwin = let + # pkgs = import nixpkgs { + # config = { + # allowUnfree = true; + # }; + # system = "aarch64-darwin"; + # }; + # in { + # shellcheck = pkgs.shellcheck; + # terraform = pkgs.terraform; + # }; + # }; + # }; + + outputs = { self, nixpkgs }: { + defaultPackage.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.terraform_1_10_3; + }; +} From 2122a2398114331185d2218ddfca7d18ae3bc101 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Fri, 24 Jan 2025 00:04:03 -0500 Subject: [PATCH 03/42] More nix test --- flake.lock | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7934a39 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1737003892, + "narHash": "sha256-RCzJE9wKByLCXmRBp+z8LK9EgdW+K+W/DXnJS4S/NVo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ae06b9c2d83cb5c8b12d7d0e32692e93d1379713", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} From c638a81084b29aa05f9db042f38cf239b0768542 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Thu, 30 Jan 2025 01:30:35 -0500 Subject: [PATCH 04/42] Committing local changes --- .config/fish/config.fish | 18 ++++++++ .config/fish/functions/.gitignore | 1 + .config/fish/functions/aws-ps.fish | 15 +++++++ .config/fish/functions/devexec.fish | 3 ++ .config/fish/functions/devup.fish | 3 ++ .config/fish/functions/lg.fish | 3 ++ .config/fish/functions/reload.fish | 8 ++++ .config/fish/functions/vi.fish | 3 ++ .config/fish/functions/vim.fish | 3 ++ .config/nvim/lazy-lock.json | 27 ++++++------ .config/nvim/lua/custom/plugins/lsp.lua | 43 +++++++++++-------- .config/nvim/lua/custom/plugins/markdown.lua | 6 +++ .config/nvim/lua/custom/plugins/mini.lua | 40 ----------------- .../nvim/lua/custom/plugins/treesitter.lua | 1 + .envrc | 1 - .wezterm.lua | 43 ------------------- flake.lock | 27 ------------ flake.nix | 25 ----------- shell.nix | 14 ++++++ 19 files changed, 119 insertions(+), 165 deletions(-) create mode 100644 .config/fish/config.fish create mode 100644 .config/fish/functions/.gitignore create mode 100644 .config/fish/functions/aws-ps.fish create mode 100644 .config/fish/functions/devexec.fish create mode 100644 .config/fish/functions/devup.fish create mode 100644 .config/fish/functions/lg.fish create mode 100644 .config/fish/functions/reload.fish create mode 100644 .config/fish/functions/vi.fish create mode 100644 .config/fish/functions/vim.fish create mode 100644 .config/nvim/lua/custom/plugins/markdown.lua delete mode 100644 .config/nvim/lua/custom/plugins/mini.lua delete mode 100644 .wezterm.lua delete mode 100644 flake.lock delete mode 100644 flake.nix create mode 100644 shell.nix diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..00ab3bb --- /dev/null +++ b/.config/fish/config.fish @@ -0,0 +1,18 @@ +if status is-interactive + # Commands to run in interactive sessions can go here + set PATH /opt/homebrew/bin:$PATH + + # Maybe check if atuin exists first. + atuin init fish | source +end + +set pure_enable_k8s true +set pure_show_system_time true +set pure_enable_nixdevshell true + +set -x NIXPKGS_ALLOW_UNFREE 1 +set -x TF_PLUGIN_CACHE_DIR "$HOME/.terraform.d/plugin-cache" + +# Load direnv hook for fish. +# https://direnv.net/docs/hook.html. +direnv hook fish | source diff --git a/.config/fish/functions/.gitignore b/.config/fish/functions/.gitignore new file mode 100644 index 0000000..43b580a --- /dev/null +++ b/.config/fish/functions/.gitignore @@ -0,0 +1 @@ +_pure*.fish diff --git a/.config/fish/functions/aws-ps.fish b/.config/fish/functions/aws-ps.fish new file mode 100644 index 0000000..08c0fff --- /dev/null +++ b/.config/fish/functions/aws-ps.fish @@ -0,0 +1,15 @@ +####################################### +# Switch between AWS Profiles. +# Arguments: +# None +####################################### +function aws-ps + # TODO There should be a "clear profile" option which unsets AWS_PROFILE. + + # Need to check profile if it's empty, not sure if this does that or not. + set profile $(aws configure list-profiles | fzf --height=30% --layout=reverse) + if set --query profile + set -gx AWS_PROFILE $profile + echo "AWS profile $AWS_PROFILE now active." + end +end diff --git a/.config/fish/functions/devexec.fish b/.config/fish/functions/devexec.fish new file mode 100644 index 0000000..f6d5c2f --- /dev/null +++ b/.config/fish/functions/devexec.fish @@ -0,0 +1,3 @@ +function devexec + devcontainer exec --workspace-folder . zsh +end diff --git a/.config/fish/functions/devup.fish b/.config/fish/functions/devup.fish new file mode 100644 index 0000000..b73c891 --- /dev/null +++ b/.config/fish/functions/devup.fish @@ -0,0 +1,3 @@ +function devup + devcontainer up --workspace-folder . --dotfiles-repository https://github.com/mpriscella/dotfiles.git +end diff --git a/.config/fish/functions/lg.fish b/.config/fish/functions/lg.fish new file mode 100644 index 0000000..217d870 --- /dev/null +++ b/.config/fish/functions/lg.fish @@ -0,0 +1,3 @@ +function lg + lazygit +end diff --git a/.config/fish/functions/reload.fish b/.config/fish/functions/reload.fish new file mode 100644 index 0000000..c857895 --- /dev/null +++ b/.config/fish/functions/reload.fish @@ -0,0 +1,8 @@ +####################################### +# Reload Fish configuration. +# Arguments: +# None +####################################### +function reload + source ~/.config/fish/config.fish # TODO Should reload all functions as well. +end diff --git a/.config/fish/functions/vi.fish b/.config/fish/functions/vi.fish new file mode 100644 index 0000000..776c744 --- /dev/null +++ b/.config/fish/functions/vi.fish @@ -0,0 +1,3 @@ +function vi + echo 'Use "nvim" instead of "vi"' +end diff --git a/.config/fish/functions/vim.fish b/.config/fish/functions/vim.fish new file mode 100644 index 0000000..8a4f07b --- /dev/null +++ b/.config/fish/functions/vim.fish @@ -0,0 +1,3 @@ +function vim + echo 'Use "nvim" instead of "vim"' +end diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 688f9a5..5ff3e77 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -4,17 +4,18 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" }, + "conform.nvim": { "branch": "master", "commit": "6dc21d4ce050c2e592d9635b7983d67baf216e3d" }, "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "9541f5e8e24571723cb02a5c2bf078aeacc5a711" }, - "indent-blankline.nvim": { "branch": "master", "commit": "7a698a1d7ed755af9f5a88733b23ca246ce2df28" }, + "gitsigns.nvim": { "branch": "main", "commit": "2ff0c29f2a6b1247d96cc59535d53e5589fb50b6" }, + "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, "lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "luvit-meta": { "branch": "main", "commit": "55709f183b0742a7e4f47688c284f81148ad4dc0" }, + "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, + "markview.nvim": { "branch": "main", "commit": "f2321ccb56a998ee048e6033d80c30680544260c" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, @@ -26,13 +27,13 @@ "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, "nvim-dap-go": { "branch": "main", "commit": "1bacf2fa7d4dc6a8a4f6cc390f1544e5b34c35a4" }, - "nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" }, - "nvim-lint": { "branch": "master", "commit": "dfa45de973c3ce7bd1b9a6d346f896a68ad07e44" }, - "nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" }, - "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, - "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" }, - "nvim-treesitter": { "branch": "master", "commit": "f0c928dbe93533b7e35894a8f957f40150d1f663" }, + "nvim-dap-ui": { "branch": "master", "commit": "0d5c37a43bc039c42a0a9bf801e53f77adf06a24" }, + "nvim-lint": { "branch": "master", "commit": "789b7ada1b4f00e08d026dffde410dcfa6a0ba87" }, + "nvim-lspconfig": { "branch": "master", "commit": "d1871c84b218931cc758dbbde1fec8e90c6d465c" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, + "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, + "nvim-treesitter": { "branch": "master", "commit": "07bd1b53bf465e42d53253b48b7437892d6c45e8" }, "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, @@ -40,8 +41,10 @@ "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" }, - "tokyonight.nvim": { "branch": "main", "commit": "775f82f08a3d1fb55a37fc6d3a4ab10cd7ed8a10" }, + "tokyonight.nvim": { "branch": "main", "commit": "c3ab53c3f544e4a04f2a05d43451fd9bedff51b4" }, "trouble.nvim": { "branch": "main", "commit": "50481f414bd3c1a40122c1d759d7e424d5fafe84" }, + "typr": { "branch": "main", "commit": "8904dc09ed4e4a4397fc3a4f2884f11e85d27c5d" }, "vim-helm": { "branch": "master", "commit": "ae1ebc160d2b9b90108477ab10df7a4fc501e358" }, + "volt": { "branch": "main", "commit": "1a7d6b1dfb2f176715ccc9e838be32d044f8a734" }, "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" } } diff --git a/.config/nvim/lua/custom/plugins/lsp.lua b/.config/nvim/lua/custom/plugins/lsp.lua index 0f2a20e..29d3356 100644 --- a/.config/nvim/lua/custom/plugins/lsp.lua +++ b/.config/nvim/lua/custom/plugins/lsp.lua @@ -4,7 +4,9 @@ return { 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim - { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants + -- Mason must be loaded before its dependents so we need to set it up here. + -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` + { 'williamboman/mason.nvim', opts = {} }, -- NOTE: Must be loaded before dependants 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', @@ -41,6 +43,12 @@ return { -- If you're wondering about lsp vs treesitter, you can check out the wonderfully -- and elegantly composed help section, `:help lsp-vs-treesitter` + -- vim.filetype.add { + -- pattern = { + -- ['.*/%.github[%w/]+workflows[%w/]+.*%.ya?ml'] = 'yaml.github', + -- }, + -- } + -- This function gets run when an LSP attaches to a particular buffer. -- That is to say, every time a new file is opened that is associated with -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this @@ -154,15 +162,16 @@ return { -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { bashls = {}, - helm_ls = { - settings = { - ['helm-ls'] = { - yamlls = { - path = 'yaml-language-server', - }, - }, - }, - }, + -- gh_actions_ls = {}, + -- helm_ls = { + -- settings = { + -- ['helm-ls'] = { + -- yamlls = { + -- path = 'yaml-language-server', + -- }, + -- }, + -- }, + -- }, lua_ls = { settings = { Lua = { @@ -175,15 +184,15 @@ return { }, }, }, - markdownlint = {}, + -- markdownlint = {}, phpactor = {}, - phpcs = { - cmd = { '/Users/michaelpriscella/workspace/wpcomvip/wgb-zenith/vendor/bin/phpcs', '-d', '-1' }, - }, + -- phpcs = { + -- cmd = { '/Users/michaelpriscella/workspace/wpcomvip/wgb-zenith/vendor/bin/phpcs', '-d', '-1' }, + -- }, shellcheck = {}, terraformls = {}, - tflint = {}, - ts_ls = {}, + -- tflint = {}, + -- ts_ls = {}, zls = {}, -- yamlls = { -- settings = { @@ -206,7 +215,7 @@ return { -- :Mason -- -- You can press `g?` for help in this menu. - require('mason').setup() + -- require('mason').setup() -- You can add other tools here that you want Mason to install -- for you, so that they are available from within Neovim. diff --git a/.config/nvim/lua/custom/plugins/markdown.lua b/.config/nvim/lua/custom/plugins/markdown.lua new file mode 100644 index 0000000..1a78c29 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/markdown.lua @@ -0,0 +1,6 @@ +return { + { + 'OXY2DEV/markview.nvim', + lazy = false, + }, +} diff --git a/.config/nvim/lua/custom/plugins/mini.lua b/.config/nvim/lua/custom/plugins/mini.lua deleted file mode 100644 index d9f991a..0000000 --- a/.config/nvim/lua/custom/plugins/mini.lua +++ /dev/null @@ -1,40 +0,0 @@ --- Collection of various small independent plugins/modules -return { - { - 'echasnovski/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() - - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } - - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l:%-2v' - end - - -- ... and there is more! - -- Check out: https://github.com/echasnovski/mini.nvim - end, - }, -} diff --git a/.config/nvim/lua/custom/plugins/treesitter.lua b/.config/nvim/lua/custom/plugins/treesitter.lua index 7c0c9af..75f1aa7 100644 --- a/.config/nvim/lua/custom/plugins/treesitter.lua +++ b/.config/nvim/lua/custom/plugins/treesitter.lua @@ -11,6 +11,7 @@ return { 'c', 'diff', 'html', + 'jsonc', 'lua', 'luadoc', 'markdown', diff --git a/.envrc b/.envrc index 08c61d3..1d953f4 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1 @@ use nix -MIKE=fasfasf diff --git a/.wezterm.lua b/.wezterm.lua deleted file mode 100644 index 6801c7b..0000000 --- a/.wezterm.lua +++ /dev/null @@ -1,43 +0,0 @@ --- https://wezfurlong.org/wezterm/config/files.html - --- Pull in the wezterm API -local wezterm = require("wezterm") - --- This will hold the configuration. -local config = wezterm.config_builder() - -config.font = wezterm.font_with_fallback({ "JetBrains Mono", "SpaceMono Nerd Font" }) -config.font_size = 11 -config.line_height = 1.2 --- config.color_scheme = "GitHub Dark" -config.color_scheme = "tokyonight" - -config.max_fps = 120 -config.hide_tab_bar_if_only_one_tab = true - --- neovim zen mode. -wezterm.on("user-var-changed", function(window, pane, name, value) - local overrides = window:get_config_overrides() or {} - if name == "ZEN_MODE" then - local incremental = value:find("+") - local number_value = tonumber(value) - if incremental ~= nil then - while number_value > 0 do - window:perform_action(wezterm.action.IncreaseFontSize, pane) - number_value = number_value - 1 - end - overrides.enable_tab_bar = false - elseif number_value < 0 then - window:perform_action(wezterm.action.ResetFontSize, pane) - overrides.font_size = nil - overrides.enable_tab_bar = true - else - overrides.font_size = number_value - overrides.enable_tab_bar = false - end - end - window:set_config_overrides(overrides) -end) - --- and finally, return the configuration to wezterm -return config diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 7934a39..0000000 --- a/flake.lock +++ /dev/null @@ -1,27 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1737003892, - "narHash": "sha256-RCzJE9wKByLCXmRBp+z8LK9EgdW+K+W/DXnJS4S/NVo=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "ae06b9c2d83cb5c8b12d7d0e32692e93d1379713", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 24a7dbc..0000000 --- a/flake.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - description = "A flake"; - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - }; - # outputs = { self, nixpkgs }: { - # packages = { - # aarch64-darwin = let - # pkgs = import nixpkgs { - # config = { - # allowUnfree = true; - # }; - # system = "aarch64-darwin"; - # }; - # in { - # shellcheck = pkgs.shellcheck; - # terraform = pkgs.terraform; - # }; - # }; - # }; - - outputs = { self, nixpkgs }: { - defaultPackage.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.terraform_1_10_3; - }; -} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..f84b02b --- /dev/null +++ b/shell.nix @@ -0,0 +1,14 @@ +let + nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz"; + pkgs = import nixpkgs { config = {}; overlays = []; }; +in + +pkgs.mkShellNoCC { + packages = with pkgs; [ + gh + git + shellcheck + terraform + terraform-ls + ]; +} From 58236f127835fda229d10be2cae1a58f90fc7d3a Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Wed, 5 Feb 2025 21:01:46 -0500 Subject: [PATCH 05/42] Replace other plugins with Snacks.nvim --- .config/nvim/lazy-lock.json | 44 +++---- .../lua/custom/plugins/autocompletion.lua | 1 + .../nvim/lua/custom/plugins/indent_line.lua | 9 -- .config/nvim/lua/custom/plugins/lazygit.lua | 22 ---- .config/nvim/lua/custom/plugins/lualine.lua | 30 ++--- .config/nvim/lua/custom/plugins/neo-tree.lua | 28 ---- .config/nvim/lua/custom/plugins/noice.lua | 56 -------- .config/nvim/lua/custom/plugins/snacks.lua | 91 +++++++++++++ .config/nvim/lua/custom/plugins/telescope.lua | 123 ------------------ .config/nvim/lua/custom/plugins/terminal.lua | 9 +- .devcontainer/devcontainer.json | 4 +- 11 files changed, 132 insertions(+), 285 deletions(-) delete mode 100644 .config/nvim/lua/custom/plugins/indent_line.lua delete mode 100644 .config/nvim/lua/custom/plugins/lazygit.lua delete mode 100644 .config/nvim/lua/custom/plugins/neo-tree.lua delete mode 100644 .config/nvim/lua/custom/plugins/noice.lua create mode 100644 .config/nvim/lua/custom/plugins/snacks.lua delete mode 100644 .config/nvim/lua/custom/plugins/telescope.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 5ff3e77..fd7e400 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -4,47 +4,41 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "conform.nvim": { "branch": "master", "commit": "6dc21d4ce050c2e592d9635b7983d67baf216e3d" }, + "conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" }, "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "2ff0c29f2a6b1247d96cc59535d53e5589fb50b6" }, - "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, - "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, - "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, - "lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" }, + "gitsigns.nvim": { "branch": "main", "commit": "9b36d497495436c135659902054ee637e0ba6021" }, + "lazy.nvim": { "branch": "main", "commit": "7527af40ddd4a93a02911be570b32609b9d4ea53" }, + "lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" }, + "lazygit.nvim": { "branch": "main", "commit": "adc37c5a6d7d6e8d0a039f08f3c7837971a1c77a" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, - "markview.nvim": { "branch": "main", "commit": "f2321ccb56a998ee048e6033d80c30680544260c" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, + "markview.nvim": { "branch": "main", "commit": "a39d03f8445971c4a250396a44b23fa9c6fd8921" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "374c78d3ebb5c53f43ea6bd906b6587b5e899b9e" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "neo-tree.nvim": { "branch": "main", "commit": "e6645ecfcba3e064446a6def1c10d788c9873f51" }, - "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" }, - "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" }, - "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, - "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, - "nvim-dap-go": { "branch": "main", "commit": "1bacf2fa7d4dc6a8a4f6cc390f1544e5b34c35a4" }, - "nvim-dap-ui": { "branch": "master", "commit": "0d5c37a43bc039c42a0a9bf801e53f77adf06a24" }, + "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, + "nvim-dap": { "branch": "master", "commit": "b4f27d451c187de912fa8d3229025a952917eb9e" }, + "nvim-dap-go": { "branch": "main", "commit": "07739481317d36ddb3e3e8fbdfcd8f90b4167d73" }, + "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, "nvim-lint": { "branch": "master", "commit": "789b7ada1b4f00e08d026dffde410dcfa6a0ba87" }, - "nvim-lspconfig": { "branch": "master", "commit": "d1871c84b218931cc758dbbde1fec8e90c6d465c" }, + "nvim-lspconfig": { "branch": "master", "commit": "66bc018936c6ff76beb75f89d986af6442db4001" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, - "nvim-treesitter": { "branch": "master", "commit": "07bd1b53bf465e42d53253b48b7437892d6c45e8" }, - "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, + "nvim-treesitter": { "branch": "master", "commit": "4e701776f8824fc188a6254f57d080971ce28c92" }, + "nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, + "snacks.nvim": { "branch": "main", "commit": "b773368f8aa6e84a68e979f0e335d23de71f405a" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" }, - "tokyonight.nvim": { "branch": "main", "commit": "c3ab53c3f544e4a04f2a05d43451fd9bedff51b4" }, - "trouble.nvim": { "branch": "main", "commit": "50481f414bd3c1a40122c1d759d7e424d5fafe84" }, - "typr": { "branch": "main", "commit": "8904dc09ed4e4a4397fc3a4f2884f11e85d27c5d" }, + "tokyonight.nvim": { "branch": "main", "commit": "dca4adba7dc5f09302a00b0e76078d54d82d2658" }, + "trouble.nvim": { "branch": "main", "commit": "6f380b8826fb819c752c8fd7daaee9ef96d4c689" }, "vim-helm": { "branch": "master", "commit": "ae1ebc160d2b9b90108477ab10df7a4fc501e358" }, - "volt": { "branch": "main", "commit": "1a7d6b1dfb2f176715ccc9e838be32d044f8a734" }, - "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" } + "which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" } } diff --git a/.config/nvim/lua/custom/plugins/autocompletion.lua b/.config/nvim/lua/custom/plugins/autocompletion.lua index e90ea08..c750249 100644 --- a/.config/nvim/lua/custom/plugins/autocompletion.lua +++ b/.config/nvim/lua/custom/plugins/autocompletion.lua @@ -1,4 +1,5 @@ -- Autocompletion +-- TODO: Look into using blink-cmp instead. return { { 'hrsh7th/nvim-cmp', diff --git a/.config/nvim/lua/custom/plugins/indent_line.lua b/.config/nvim/lua/custom/plugins/indent_line.lua deleted file mode 100644 index ed7f269..0000000 --- a/.config/nvim/lua/custom/plugins/indent_line.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - { -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help ibl` - main = 'ibl', - opts = {}, - }, -} diff --git a/.config/nvim/lua/custom/plugins/lazygit.lua b/.config/nvim/lua/custom/plugins/lazygit.lua deleted file mode 100644 index 275e08b..0000000 --- a/.config/nvim/lua/custom/plugins/lazygit.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - { - 'kdheepak/lazygit.nvim', - lazy = true, - cmd = { - 'LazyGit', - 'LazyGitConfig', - 'LazyGitCurrentFile', - 'LazyGitFilter', - 'LazyGitFilterCurrentFile', - }, - -- optional for floating window border decoration - dependencies = { - 'nvim-lua/plenary.nvim', - }, - -- setting the keybinding for LazyGit with 'keys' is recommended in - -- order to load the plugin when the command is run for the first time - keys = { - { 'lg', 'LazyGit', desc = 'LazyGit' }, - }, - }, -} diff --git a/.config/nvim/lua/custom/plugins/lualine.lua b/.config/nvim/lua/custom/plugins/lualine.lua index 48063a1..6ffe5e1 100644 --- a/.config/nvim/lua/custom/plugins/lualine.lua +++ b/.config/nvim/lua/custom/plugins/lualine.lua @@ -8,21 +8,21 @@ return { -- Credit: glepnir local lualine = require 'lualine' - -- Color table for highlights - -- stylua: ignore - local colors = { - bg = '#202328', - fg = '#bbc2cf', - yellow = '#ECBE7B', - cyan = '#008080', - darkblue = '#081633', - green = '#98be65', - orange = '#FF8800', - violet = '#a9a1e1', - magenta = '#c678dd', - blue = '#51afef', - red = '#ec5f67', - } + -- Color table for highlights + -- stylua: ignore + local colors = { + bg = '#202328', + fg = '#bbc2cf', + yellow = '#ECBE7B', + cyan = '#008080', + darkblue = '#081633', + green = '#98be65', + orange = '#FF8800', + violet = '#a9a1e1', + magenta = '#c678dd', + blue = '#51afef', + red = '#ec5f67', + } local conditions = { buffer_not_empty = function() diff --git a/.config/nvim/lua/custom/plugins/neo-tree.lua b/.config/nvim/lua/custom/plugins/neo-tree.lua deleted file mode 100644 index e217f17..0000000 --- a/.config/nvim/lua/custom/plugins/neo-tree.lua +++ /dev/null @@ -1,28 +0,0 @@ --- Neo-tree is a Neovim plugin to browse the file system --- https://github.com/nvim-neo-tree/neo-tree.nvim - -return { - 'nvim-neo-tree/neo-tree.nvim', - version = '*', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', - 'MunifTanjim/nui.nvim', - }, - cmd = 'Neotree', - keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, - }, - opts = { - window = { - position = 'right', - }, - filesystem = { - window = { - mappings = { - ['\\'] = 'close_window', - }, - }, - }, - }, -} diff --git a/.config/nvim/lua/custom/plugins/noice.lua b/.config/nvim/lua/custom/plugins/noice.lua deleted file mode 100644 index d40989f..0000000 --- a/.config/nvim/lua/custom/plugins/noice.lua +++ /dev/null @@ -1,56 +0,0 @@ -return { - { - 'folke/noice.nvim', - dependencies = { - 'MunifTanjim/nui.nvim', - 'rcarriga/nvim-notify', - }, - event = 'VeryLazy', - opts = { - lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** - override = { - ['vim.lsp.util.convert_input_to_markdown_lines'] = true, - ['vim.lsp.util.stylize_markdown'] = true, - ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp - }, - }, - -- you can enable a preset for easier configuration - presets = { - bottom_search = true, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help - }, - - routes = { - { - filter = { - event = 'msg_show', - kind = '', - find = 'written', - }, - opts = { skip = true }, - }, - { - filter = { - event = 'notify', - kind = 'info', - find = '[Neo-tree INFO]', - }, - opts = { skip = true }, - }, - -- Is there a way to filter by message title / source? - { - filter = { - event = 'notify', - kind = 'warn', - find = 'Config Change Detected.', - }, - opts = { skip = true }, - }, - }, - }, - }, -} diff --git a/.config/nvim/lua/custom/plugins/snacks.lua b/.config/nvim/lua/custom/plugins/snacks.lua new file mode 100644 index 0000000..3f20a12 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/snacks.lua @@ -0,0 +1,91 @@ +return { + { + -- @see https://github.com/folke/snacks.nvim + 'folke/snacks.nvim', + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + ---@type snacks.dashboard.Config|{} + dashboard = { enabled = true }, + ---@type snacks.explorer.Config|{} + explorer = { + enabled = true, + replace_netrw = true, + }, + ---@type snacks.indent.Config|{} + indent = { enabled = true }, + ---@type snacks.input.Config|{} + input = { enabled = true }, + ---@type snacks.lazygit.Config|{} + lazygit = { enabled = true }, + ---@type snacks.picker.Config|{} + picker = { + enabled = true, + sources = { + ---@type snacks.picker.explorer.Config|{} + explorer = { + auto_close = true, + git_status_open = true, + hidden = true, + layout = { layout = { position = 'right' } }, + }, + }, + }, + ---@type snacks.notifier.Config|{} + notifier = { enabled = true }, + ---@type snacks.quickfile.Config|{} + quickfile = { enabled = true }, + ---@type snacks.statuscolumn.Config|{} + statuscolumn = { enabled = true }, + ---@type snacks.words.Config|{} + words = { enabled = true }, + }, + keys = { + { + 'gd', + function() + Snacks.picker.lsp_definitions() + end, + desc = '[G]oto [D]efinition', + }, + { + 'sf', + function() + Snacks.picker.files { + hidden = true, + } + end, + desc = '[S]earch [F]iles', + }, + { + 'sg', + function() + Snacks.picker.grep() + end, + desc = '[S]earch [G]rep', + }, + { + 'sh', + function() + Snacks.picker.help() + end, + desc = '[S]earch [H]elp', + }, + { + 'lg', + function() + Snacks.lazygit() + end, + desc = 'Toggle Lazygit', + }, + { + '\\', + function() + Snacks.explorer() + end, + desc = 'Toggle Explorer', + }, + }, + }, +} diff --git a/.config/nvim/lua/custom/plugins/telescope.lua b/.config/nvim/lua/custom/plugins/telescope.lua deleted file mode 100644 index 67e37c3..0000000 --- a/.config/nvim/lua/custom/plugins/telescope.lua +++ /dev/null @@ -1,123 +0,0 @@ --- Fuzzy Finder (files, lsp, etc) -return { - { - 'nvim-telescope/telescope.nvim', - event = 'VimEnter', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions - 'nvim-telescope/telescope-fzf-native.nvim', - - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = 'make', - - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search - -- many different aspects of Neovim, your workspace, LSP, and more! - -- - -- The easiest way to use Telescope, is to start by doing something like: - -- :Telescope help_tags - -- - -- After running this command, a window will open up and you're able to - -- type in the prompt window. You'll see a list of `help_tags` options and - -- a corresponding preview of the help. - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! - - -- [[ Configure Telescope ]] - -- See `:help telescope` and `:help telescope.setup()` - require('telescope').setup { - -- You can put your default mappings / updates / etc. in here - -- All the info you're looking for is in `:help telescope.setup()` - -- - defaults = { - vimgrep_arguments = { - 'rg', - '--color=never', - '--no-heading', - '--with-filename', - '--line-number', - '--column', - '--smart-case', - '--hidden', - '--glob', - '!{**/.git/*}', - }, - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - }, - pickers = { - find_files = { - find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' }, - }, - }, - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - }, - } - - -- Enable Telescope extensions if they are installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set('n', '/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) - - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'sn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) - end, - }, -} diff --git a/.config/nvim/lua/custom/plugins/terminal.lua b/.config/nvim/lua/custom/plugins/terminal.lua index 3a2b987..ed69124 100644 --- a/.config/nvim/lua/custom/plugins/terminal.lua +++ b/.config/nvim/lua/custom/plugins/terminal.lua @@ -34,14 +34,15 @@ return { direction = 'float', } - function _k9s_toggle() + -- How to make this a local variable? Or do I create a module? M = {} and whatever. + function k9s_toggle() k9s:toggle() if k9s:is_open() then k9s:set_mode(mode.INSERT) end end - vim.keymap.set({ 'n', 't' }, '9', 'lua _k9s_toggle()', { desc = 'Toggle K9s' }) + vim.keymap.set({ 'n', 't' }, '9', 'lua k9s_toggle()', { desc = 'Toggle K9s' }) -- htop local htop = Terminal:new { @@ -50,14 +51,14 @@ return { direction = 'float', } - function _htop_toggle() + function htop_toggle() htop:toggle() if htop:is_open() then htop:set_mode(mode.INSERT) end end - vim.keymap.set({ 'n', 't' }, 'ht', 'lua _htop_toggle()', { desc = 'Toggle Htop' }) + vim.keymap.set({ 'n', 't' }, 'ht', 'lua htop_toggle()', { desc = 'Toggle Htop' }) end, }, } diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a8b8038..5052775 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,9 +17,7 @@ "sumneko.lua" ], "settings": { - "Lua.diagnostics.globals": ["vim"], - "vscode-neovim.neovimInitVimPaths.linux": "/workspaces/dotfiles/.config/nvim/init.lua", - "vscode-neovim.neovimExecutablePaths.linux": "/usr/local/bin/nvim" + "Lua.diagnostics.globals": ["vim"] } } }, From d9d8d8eb856ab9ffb1e2c40d5c427fffe43c2f8b Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Wed, 5 Feb 2025 22:26:32 -0500 Subject: [PATCH 06/42] Pushing incomplete changes to dotfiles install script --- dotfiles.sh | 211 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 125 insertions(+), 86 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index 8ba8696..0d52598 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -1,5 +1,20 @@ #!/bin/bash +# User defined configs. +ENABLE_TMUX=FALSE + +SUDO="" +if type sudo >/dev/null 2>&1; then + SUDO="sudo " +fi + +####################################### +# Print script usage. +# Globals: +# None +# Arguments: +# None +####################################### usage() { echo "Manages mpriscella/dotfiles." echo "" @@ -25,15 +40,27 @@ elif [ "$(uname -s)" = "Darwin" ]; then ADJUSTED_ID="darwin" fi +ARCHITECTURE="$(uname -m)" + # Install Homebrew on MacOS. if [ "${ADJUSTED_ID}" = "darwin" ]; then if ! type brew >/dev/null 2>&1; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + # Create $HOME/.zprofile if it doesn't exist. + if [ -f "$HOME"/.zprofile ]; then + echo >> "$HOME"/.zprofile + fi + + # shellcheck disable=SC2016 + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" fi fi # Determine what the package manager install command for the OS is. if type apt-get >/dev/null 2>&1; then + export DEBIAN_FRONTEND=noninteractive INSTALL_CMD=apt-get elif type brew >/dev/null 2>&1; then INSTALL_CMD=brew @@ -46,6 +73,7 @@ fi # Update package manager. # Globals: # INSTALL_CMD +# SUDO # Arguments: # None ####################################### @@ -53,7 +81,7 @@ pkg_mgr_update() { if [ "${INSTALL_CMD}" = "apt-get" ]; then if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then echo "Running apt-get update..." - sudo "${INSTALL_CMD}" update -y + "${SUDO}""${INSTALL_CMD}" update -y fi elif [ "${INSTALL_CMD}" = "brew" ]; then echo "Running brew update ..." @@ -64,15 +92,19 @@ pkg_mgr_update() { ####################################### # Ensure packages are installed. # Globals: +# ID # INSTALL_CMD +# SUDO # Arguments: # List of packages to install. ####################################### check_packages() { + # TODO: Check if package is installed and if so, skip it. + # Also, we shouldn't update for each package since that will take forever. if [ "${INSTALL_CMD}" = "apt-get" ]; then if ! dpkg -s "$@" >/dev/null 2>&1; then pkg_mgr_update - sudo "${INSTALL_CMD}" -y install --no-install-recommends "$@" + "${SUDO}""${INSTALL_CMD}" -y install --no-install-recommends "$@" fi elif [ "${INSTALL_CMD}" = "brew" ]; then pkg_mgr_update @@ -105,97 +137,108 @@ clean_up() { # Install package dependencies. # Globals: # ADJUSTED_ID +# ENABLE_TMUX # Arguments: # None ####################################### install_dependencies() { if [ "${ADJUSTED_ID}" = "debian" ]; then - check_packages ack curl exuberant-ctags fd-find fzf gawk git jq locales python3 \ - ripgrep tar tmux vim virt-what zsh + check_packages ack build-essential ca-certificates curl exuberant-ctags \ + fd-find fzf gawk git jq locales python3 ripgrep tar vim virt-what zsh + + # Do I need? + # - exuberant-ctags + # - python3 + + # Set locale. + sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen + echo 'LANG=en_US.UTF-8' > /etc/default/locale + locale-gen + + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash + nvm install 22 npm install -g tree-sitter-cli @devcontainers/cli curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh - curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - - check_packages nodejs - install_neovim >/dev/null 2>&1 - LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') - curl -Lo /tmp/lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" - tar xf /tmp/lazygit.tar.gz lazygit - sudo install lazygit /usr/local/bin - rm lazygit + install_neovim + + # TODO: Install: + # - fish + # - lazygit + elif [ "${ADJUSTED_ID}" = "darwin" ]; then - brew tap homebrew/cask-fonts - brew install --casks dbeaver-community devtoys font-space-mono-nerd-font wezterm - check_packages ack act atuin derailed/k9s/k9s dive fzf gh gnupg hadolint helm \ - jordanbaird-ice jq k6 kind jesseduffield/lazygit/lazygit neovim node \ - ripgrep shellcheck sslscan step terraform-ls tmux tree-sitter yq \ + brew install --casks dbeaver-community devtoys + # TODO: This list of packages should be a variable. Then we loop over it, + # check to see if it's installed, and if not, install it. This might be + # applicable to debian as well, perhaps we can create a function to check if + # a package is installed that's package manager agnostic. + check_packages ack act atuin derailed/k9s/k9s direnv dive fish fd fzf gh \ + gnupg helm jordanbaird-ice jq k6 kind jesseduffield/lazygit/lazygit \ + neovim nvm ripgrep shellcheck sslscan step terraform-ls tree-sitter yq \ yt-dlp + # Hopefully can move the following into nix: + # - dive + # - gnupg (?) + # - k6 + # - shellcheck + # - sslscan (?) + # - step + # - terraform-ls + # - tree-sitter + npm install -g @devcontainers/cli + + # TODO: Check /etc/shells to see if fish is already in there. + # Change shell to fishshell. + which fish | sudo tee -a /etc/shells + chsh -s "$(which fish)" fi - clean_up -} -####################################### -# Installs neovim from source. -# Necessary until this issue gets resolved: https://github.com/neovim/neovim/issues/15143 -# Globals: -# HOME -# PWD -# Arguments: -# None -####################################### -install_neovim() { - old_dir="$PWD" - cd "$HOME" || exit - git clone --depth 1 --branch stable https://github.com/neovim/neovim.git - cd neovim || exit - check_packages ninja-build gettext cmake unzip - make CMAKE_BUILD_TYPE=RelWithDebInfo - sudo make install - cd "$old_dir" || exit -} + # TODO: Maybe move changing of shell out of platform specfic conditional. -spinner_pid= + if [ "${ENABLE_TMUX}" = "TRUE" ]; then + install_tmux + fi -####################################### -# Starts a progress spinner. -# Globals: -# spinner_pid -# Arguments: -# A string to precede the spinner. -####################################### -function start_spinner { - set +m - echo -n "$1 " - { while :; do for X in ". " ".. " "..." " .." " ." " "; do - echo -en "\b\b\b$X" - sleep 0.1 - done; done & } 2>/dev/null - spinner_pid=$! + clean_up } ####################################### -# Stops a running progress spinner, identified by spinner_pid. +# Installs neovim. # Globals: -# spinner_pid +# ARCHITECTURE +# HOME +# PATH # Arguments: # None ####################################### -function stop_spinner { - { kill -9 "$spinner_pid" && wait; } 2>/dev/null - set -m - echo -en "\033[2K\r" +install_neovim() { + NEOVIM_VERSION=$(curl -s "https://api.github.com/repos/neovim/neovim/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') + if ARCHITECTURE="aarch64"; then + NEOVIM_ARCHITECTURE="arm64" + else + NEOVIM_ARCHITECTURE="$ARCHITECTURE" + fi + curl -Lo "${HOME}"/neovim.tar.gz "https://github.com/neovim/neovim/releases/download/v${NEOVIM_VERSION}/nvim-linux-${NEOVIM_ARCHITECTURE}.tar.gz" + mkdir -p "${HOME}"/neovim + tar xf "${HOME}"/neovim.tar.gz -C "${HOME}"/neovim --strip-components=1 + export PATH="${HOME}"/neovim/bin:"${PATH}" + rm "${HOME}"/neovim.tar.gz } -trap stop_spinner EXIT - ####################################### -# Installs tmux plugin manager. +# Installs and configures tmux. # Globals: # HOME # Arguments: # None ####################################### -config_tmux() { +install_tmux() { + check_packages tmux + + # NOTE: I can keep tmux, but I'm going to try and not use it as much. It + # shouldn't be installed by default. Same goes for it's config. Maybe we can + # have an env var that defaults to false and determines whether to install / + # configure tmux. if [ ! -d "$HOME"/.tmux/plugins/tpm ]; then TPM_VERSION=v3.1.0 git clone --depth 1 --branch "${TPM_VERSION}" https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm @@ -203,7 +246,7 @@ config_tmux() { "$HOME"/.tmux/plugins/tpm/bin/install_plugins } -files=".ackrc .config/ghostty .config/nvim .dotfiles.gitconfig .gitattributes .kshell.sh .tmux.conf .vimrc .zshrc" +files=".ackrc .config/ghostty .config/nvim .dotfiles.gitconfig .gitattributes .zshrc" ####################################### # Symlinks the dotfiles to their correct destination in the home directory. @@ -215,6 +258,19 @@ files=".ackrc .config/ghostty .config/nvim .dotfiles.gitconfig .gitattributes .k ####################################### install_dotfiles() { for i in $files; do + # If it doesn't exist, create it + # loop over files in dotfiles directory and symlink them to directory on host. + + # If the file is a directory + if [ -d "$i" ]; then + # Loop over files in the directory + # Probably needs to be recursive. + for j in "$i"/*; do + mkdir -p "$HOME"/"$i" + ln -s "$PWD"/"$j" "$HOME"/"$i" + done + fi + mkdir -p "$(dirname "$HOME"/"$i")" if [ "$(readlink "$HOME"/"$i")" != "$PWD"/"$i" ]; then rm "$HOME"/"$i" @@ -225,36 +281,19 @@ install_dotfiles() { ln -s "$PWD"/"$i" "$HOME"/"$i" done - if type nvim >/dev/null 2>&1; then - nvim --headless "+Lazy! install" +qa - fi - - if type tmux >/dev/null 2>&1; then - config_tmux - fi - + # TODO: Maybe put this in a function later. + # Probaly unnecessary since this is the only configuration needed for git. git config --global include.path "$HOME"/.dotfiles.gitconfig } case "$1" in "install") - start_spinner "Installing dependencies" - install_dependencies >/dev/null 2>&1 - stop_spinner + install_dependencies echo "✅ Dependencies installed." - start_spinner "Installing dotfiles" - install_dotfiles >/dev/null 2>&1 - stop_spinner + install_dotfiles echo "✅ Dotfiles installed." ;; -"clean") - for i in $files; do - if test -f "$HOME"/"$i".bkup; then - rm "$HOME"/"$i".bkup - fi - done - ;; *) usage ;; From e200cc9100f44224a6b0381709579c493e59075f Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Thu, 6 Feb 2025 21:40:36 -0500 Subject: [PATCH 07/42] More updates to install script --- dotfiles.sh | 55 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index 0d52598..8665052 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -42,21 +42,33 @@ fi ARCHITECTURE="$(uname -m)" -# Install Homebrew on MacOS. -if [ "${ADJUSTED_ID}" = "darwin" ]; then - if ! type brew >/dev/null 2>&1; then - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - - # Create $HOME/.zprofile if it doesn't exist. - if [ -f "$HOME"/.zprofile ]; then - echo >> "$HOME"/.zprofile +####################################### +# Ensure package manager is installed. +# Globals: +# ADJUSTED_ID +# HOME +# Arguments: +# None +####################################### +check_package_manager() { + # Install Homebrew on MacOS. + if [ "${ADJUSTED_ID}" = "darwin" ]; then + if ! type brew >/dev/null 2>&1; then + NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + # Create $HOME/.zprofile if it doesn't exist. + if [ -f "$HOME"/.zprofile ]; then + echo >> "$HOME"/.zprofile + fi + + # shellcheck disable=SC2016 + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + + export PATH="/opt/homebrew/bin:$PATH" fi - - # shellcheck disable=SC2016 - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile - eval "$(/opt/homebrew/bin/brew shellenv)" fi -fi +} # Determine what the package manager install command for the OS is. if type apt-get >/dev/null 2>&1; then @@ -175,6 +187,9 @@ install_dependencies() { gnupg helm jordanbaird-ice jq k6 kind jesseduffield/lazygit/lazygit \ neovim nvm ripgrep shellcheck sslscan step terraform-ls tree-sitter yq \ yt-dlp + + nvm install node + # Hopefully can move the following into nix: # - dive # - gnupg (?) @@ -185,12 +200,14 @@ install_dependencies() { # - terraform-ls # - tree-sitter + # Not working, probably cause node doesn't exist yet. npm install -g @devcontainers/cli - # TODO: Check /etc/shells to see if fish is already in there. # Change shell to fishshell. - which fish | sudo tee -a /etc/shells - chsh -s "$(which fish)" + if ! grep -q '/fish$' /etc/shells; then + which fish | sudo tee -a /etc/shells + chsh -s "$(which fish)" + fi fi # TODO: Maybe move changing of shell out of platform specfic conditional. @@ -288,11 +305,17 @@ install_dotfiles() { case "$1" in "install") + check_package_manager install_dependencies echo "✅ Dependencies installed." install_dotfiles echo "✅ Dotfiles installed." + echo "Opening fish shell..." + + # Open a fish shell and, when the shell exits, kill the shell that the + # script executed in. + fish && kill -9 $PPID ;; *) usage From 9d395e68e6a071fd81acb0cf053b66ff00cb5b8c Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Thu, 6 Feb 2025 22:30:44 -0500 Subject: [PATCH 08/42] Install brew using pkg file --- dotfiles.sh | 65 +++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index 8665052..f2d7756 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -42,33 +42,22 @@ fi ARCHITECTURE="$(uname -m)" -####################################### -# Ensure package manager is installed. -# Globals: -# ADJUSTED_ID -# HOME -# Arguments: -# None -####################################### -check_package_manager() { - # Install Homebrew on MacOS. - if [ "${ADJUSTED_ID}" = "darwin" ]; then - if ! type brew >/dev/null 2>&1; then - NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - - # Create $HOME/.zprofile if it doesn't exist. - if [ -f "$HOME"/.zprofile ]; then - echo >> "$HOME"/.zprofile - fi - - # shellcheck disable=SC2016 - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile - eval "$(/opt/homebrew/bin/brew shellenv)" - - export PATH="/opt/homebrew/bin:$PATH" +# Install Homebrew on MacOS. +if [ "${ADJUSTED_ID}" = "darwin" ]; then + if ! type brew >/dev/null 2>&1; then + install_homebrew + + # Create $HOME/.zprofile if it doesn't exist. + if [ -f "$HOME"/.zprofile ]; then + echo >> "$HOME"/.zprofile fi + + # shellcheck disable=SC2016 + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" fi -} + export PATH="/opt/homebrew/bin:$PATH" +fi # Determine what the package manager install command for the OS is. if type apt-get >/dev/null 2>&1; then @@ -202,15 +191,13 @@ install_dependencies() { # Not working, probably cause node doesn't exist yet. npm install -g @devcontainers/cli - - # Change shell to fishshell. - if ! grep -q '/fish$' /etc/shells; then - which fish | sudo tee -a /etc/shells - chsh -s "$(which fish)" - fi fi - # TODO: Maybe move changing of shell out of platform specfic conditional. + # Change shell to fishshell. + if ! grep -q '/fish$' /etc/shells; then + which fish | sudo tee -a /etc/shells + chsh -s "$(which fish)" + fi if [ "${ENABLE_TMUX}" = "TRUE" ]; then install_tmux @@ -219,6 +206,20 @@ install_dependencies() { clean_up } +####################################### +# Installs Homebrew. +# Globals: +# TMPDIR +# Arguments: +# None +####################################### +install_homebrew() { + VERSION=$(curl -s https://api.github.com/repos/Homebrew/brew/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name": "v?([^"]*).*/\1/') + CURL -Lo "${TMPDIR}"/brew.pkg "https://github.com/Homebrew/brew/releases/download/${VERSION}/Homebrew-${VERSION}.pkg" + sudo installer -pkg "${TMPDIR}"/brew.pkg -target / + rm "${TMPDIR}"/brew.pkg +} + ####################################### # Installs neovim. # Globals: From d60aec7bd59743a5e65aa4a7b379e885b7bb1d65 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Thu, 6 Feb 2025 23:15:33 -0500 Subject: [PATCH 09/42] Move homebrew installation to function --- dotfiles.sh | 72 ++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index f2d7756..a8b9b4f 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -27,6 +27,32 @@ usage() { echo "" } +####################################### +# Installs Homebrew. +# Globals: +# TMPDIR +# Arguments: +# None +####################################### +install_homebrew() { + if ! type brew >/dev/null 2>&1; then + VERSION=$(curl -s https://api.github.com/repos/Homebrew/brew/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name": "v?([^"]*).*/\1/') + CURL -Lo "${TMPDIR}"/brew.pkg "https://github.com/Homebrew/brew/releases/download/${VERSION}/Homebrew-${VERSION}.pkg" + sudo installer -pkg "${TMPDIR}"/brew.pkg -target / + rm "${TMPDIR}"/brew.pkg + + # Create $HOME/.zprofile if it doesn't exist. + if [ -f "$HOME"/.zprofile ]; then + echo >> "$HOME"/.zprofile + fi + + # shellcheck disable=SC2016 + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + fi + PATH="/opt/homebrew/bin:$PATH" +} + # Bring in ID and ID_LIKE, if the file exists. if [ -f /etc/os-release ]; then # shellcheck source=/dev/null @@ -42,21 +68,8 @@ fi ARCHITECTURE="$(uname -m)" -# Install Homebrew on MacOS. if [ "${ADJUSTED_ID}" = "darwin" ]; then - if ! type brew >/dev/null 2>&1; then - install_homebrew - - # Create $HOME/.zprofile if it doesn't exist. - if [ -f "$HOME"/.zprofile ]; then - echo >> "$HOME"/.zprofile - fi - - # shellcheck disable=SC2016 - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile - eval "$(/opt/homebrew/bin/brew shellenv)" - fi - export PATH="/opt/homebrew/bin:$PATH" + install_homebrew fi # Determine what the package manager install command for the OS is. @@ -144,12 +157,8 @@ clean_up() { ####################################### install_dependencies() { if [ "${ADJUSTED_ID}" = "debian" ]; then - check_packages ack build-essential ca-certificates curl exuberant-ctags \ - fd-find fzf gawk git jq locales python3 ripgrep tar vim virt-what zsh - - # Do I need? - # - exuberant-ctags - # - python3 + check_packages ack build-essential ca-certificates curl fd-find fzf gawk \ + git jq locales ripgrep tar vim virt-what zsh # Set locale. sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen @@ -159,7 +168,9 @@ install_dependencies() { curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash nvm install 22 npm install -g tree-sitter-cli @devcontainers/cli - curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh + + curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/download/v18.4.0/atuin-installer.sh | sh + install_neovim # TODO: Install: @@ -177,6 +188,7 @@ install_dependencies() { neovim nvm ripgrep shellcheck sslscan step terraform-ls tree-sitter yq \ yt-dlp + # TODO: This, and npm below, still don't work. I bet PATH is not set. nvm install node # Hopefully can move the following into nix: @@ -206,20 +218,6 @@ install_dependencies() { clean_up } -####################################### -# Installs Homebrew. -# Globals: -# TMPDIR -# Arguments: -# None -####################################### -install_homebrew() { - VERSION=$(curl -s https://api.github.com/repos/Homebrew/brew/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name": "v?([^"]*).*/\1/') - CURL -Lo "${TMPDIR}"/brew.pkg "https://github.com/Homebrew/brew/releases/download/${VERSION}/Homebrew-${VERSION}.pkg" - sudo installer -pkg "${TMPDIR}"/brew.pkg -target / - rm "${TMPDIR}"/brew.pkg -} - ####################################### # Installs neovim. # Globals: @@ -230,6 +228,7 @@ install_homebrew() { # None ####################################### install_neovim() { + # TODO: Check if neovim is installed already. NEOVIM_VERSION=$(curl -s "https://api.github.com/repos/neovim/neovim/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') if ARCHITECTURE="aarch64"; then NEOVIM_ARCHITECTURE="arm64" @@ -306,7 +305,6 @@ install_dotfiles() { case "$1" in "install") - check_package_manager install_dependencies echo "✅ Dependencies installed." @@ -317,6 +315,8 @@ case "$1" in # Open a fish shell and, when the shell exits, kill the shell that the # script executed in. fish && kill -9 $PPID + # TODO: Maybe there's a way to restart the current application? + # Maybe an automator script ;; *) usage From 44b41b2c03ddb236bd3df6306c020761a4fe9658 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Thu, 6 Feb 2025 23:30:00 -0500 Subject: [PATCH 10/42] Enforce running as sudo for MacOS --- dotfiles.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index a8b9b4f..f8060bf 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -1,5 +1,6 @@ #!/bin/bash + # User defined configs. ENABLE_TMUX=FALSE @@ -66,6 +67,12 @@ elif [ "$(uname -s)" = "Darwin" ]; then ADJUSTED_ID="darwin" fi +# Check if the script is run as root +if [[ $EUID -ne 0 && "$ADJUSTED_ID" != "darwin" ]]; then + echo "This script must be run as root. Please use sudo." + exit 1 +fi + ARCHITECTURE="$(uname -m)" if [ "${ADJUSTED_ID}" = "darwin" ]; then @@ -156,6 +163,8 @@ clean_up() { # None ####################################### install_dependencies() { + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash + if [ "${ADJUSTED_ID}" = "debian" ]; then check_packages ack build-essential ca-certificates curl fd-find fzf gawk \ git jq locales ripgrep tar vim virt-what zsh @@ -165,7 +174,6 @@ install_dependencies() { echo 'LANG=en_US.UTF-8' > /etc/default/locale locale-gen - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash nvm install 22 npm install -g tree-sitter-cli @devcontainers/cli @@ -183,17 +191,14 @@ install_dependencies() { # check to see if it's installed, and if not, install it. This might be # applicable to debian as well, perhaps we can create a function to check if # a package is installed that's package manager agnostic. - check_packages ack act atuin derailed/k9s/k9s direnv dive fish fd fzf gh \ - gnupg helm jordanbaird-ice jq k6 kind jesseduffield/lazygit/lazygit \ - neovim nvm ripgrep shellcheck sslscan step terraform-ls tree-sitter yq \ - yt-dlp + check_packages ack act atuin derailed/k9s/k9s direnv fish fd fzf gh gnupg \ + helm jordanbaird-ice jq kind jesseduffield/lazygit/lazygit neovim \ + ripgrep yq yt-dlp - # TODO: This, and npm below, still don't work. I bet PATH is not set. nvm install node # Hopefully can move the following into nix: # - dive - # - gnupg (?) # - k6 # - shellcheck # - sslscan (?) From 2ddb48b4fd63ac60c38898d445c5ae207c593eb9 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Thu, 6 Feb 2025 23:37:43 -0500 Subject: [PATCH 11/42] Fixed conditional --- dotfiles.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dotfiles.sh b/dotfiles.sh index f8060bf..e6d491e 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -68,7 +68,7 @@ elif [ "$(uname -s)" = "Darwin" ]; then fi # Check if the script is run as root -if [[ $EUID -ne 0 && "$ADJUSTED_ID" != "darwin" ]]; then +if [[ $EUID -ne 0 && "$ADJUSTED_ID" == "darwin" ]]; then echo "This script must be run as root. Please use sudo." exit 1 fi @@ -164,6 +164,8 @@ clean_up() { ####################################### install_dependencies() { curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash + NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" if [ "${ADJUSTED_ID}" = "debian" ]; then check_packages ack build-essential ca-certificates curl fd-find fzf gawk \ From 084dad0445f1088e78c881ea7de22a8b1ca5b722 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Fri, 7 Feb 2025 00:03:01 -0500 Subject: [PATCH 12/42] Move functions into separate file --- dotfiles.sh | 276 +-------------------------------------------------- functions.sh | 264 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 269 insertions(+), 271 deletions(-) create mode 100644 functions.sh diff --git a/dotfiles.sh b/dotfiles.sh index e6d491e..f8f3fb6 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -1,58 +1,16 @@ #!/bin/bash - # User defined configs. ENABLE_TMUX=FALSE SUDO="" if type sudo >/dev/null 2>&1; then SUDO="sudo " + sudo -v + while true; do sudo -v; sleep 60; done & fi -####################################### -# Print script usage. -# Globals: -# None -# Arguments: -# None -####################################### -usage() { - echo "Manages mpriscella/dotfiles." - echo "" - echo "Usage:" - echo " ./dotfiles.sh [command]" - echo "" - echo "Available Commands:" - echo " clean Removes any backup files generated from the install command." - echo " install Installs dotfiles and predefined packages." - echo "" -} - -####################################### -# Installs Homebrew. -# Globals: -# TMPDIR -# Arguments: -# None -####################################### -install_homebrew() { - if ! type brew >/dev/null 2>&1; then - VERSION=$(curl -s https://api.github.com/repos/Homebrew/brew/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name": "v?([^"]*).*/\1/') - CURL -Lo "${TMPDIR}"/brew.pkg "https://github.com/Homebrew/brew/releases/download/${VERSION}/Homebrew-${VERSION}.pkg" - sudo installer -pkg "${TMPDIR}"/brew.pkg -target / - rm "${TMPDIR}"/brew.pkg - - # Create $HOME/.zprofile if it doesn't exist. - if [ -f "$HOME"/.zprofile ]; then - echo >> "$HOME"/.zprofile - fi - - # shellcheck disable=SC2016 - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile - eval "$(/opt/homebrew/bin/brew shellenv)" - fi - PATH="/opt/homebrew/bin:$PATH" -} +. functions.sh # Bring in ID and ID_LIKE, if the file exists. if [ -f /etc/os-release ]; then @@ -67,12 +25,6 @@ elif [ "$(uname -s)" = "Darwin" ]; then ADJUSTED_ID="darwin" fi -# Check if the script is run as root -if [[ $EUID -ne 0 && "$ADJUSTED_ID" == "darwin" ]]; then - echo "This script must be run as root. Please use sudo." - exit 1 -fi - ARCHITECTURE="$(uname -m)" if [ "${ADJUSTED_ID}" = "darwin" ]; then @@ -90,226 +42,6 @@ else exit 1 fi -####################################### -# Update package manager. -# Globals: -# INSTALL_CMD -# SUDO -# Arguments: -# None -####################################### -pkg_mgr_update() { - if [ "${INSTALL_CMD}" = "apt-get" ]; then - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - "${SUDO}""${INSTALL_CMD}" update -y - fi - elif [ "${INSTALL_CMD}" = "brew" ]; then - echo "Running brew update ..." - "${INSTALL_CMD}" update - fi -} - -####################################### -# Ensure packages are installed. -# Globals: -# ID -# INSTALL_CMD -# SUDO -# Arguments: -# List of packages to install. -####################################### -check_packages() { - # TODO: Check if package is installed and if so, skip it. - # Also, we shouldn't update for each package since that will take forever. - if [ "${INSTALL_CMD}" = "apt-get" ]; then - if ! dpkg -s "$@" >/dev/null 2>&1; then - pkg_mgr_update - "${SUDO}""${INSTALL_CMD}" -y install --no-install-recommends "$@" - fi - elif [ "${INSTALL_CMD}" = "brew" ]; then - pkg_mgr_update - "${INSTALL_CMD}" install "$@" - else - echo "Linux distro ${ID} not supported." - exit 1 - fi -} - -####################################### -# Clean up package manager cache files. -# Globals: -# ADJUSTED_ID -# Arguments: -# None -####################################### -clean_up() { - case "${ADJUSTED_ID}" in - debian) - rm -rf /var/lib/apt/lists/* - ;; - darwin) - brew cleanup - ;; - esac -} - -####################################### -# Install package dependencies. -# Globals: -# ADJUSTED_ID -# ENABLE_TMUX -# Arguments: -# None -####################################### -install_dependencies() { - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash - NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - if [ "${ADJUSTED_ID}" = "debian" ]; then - check_packages ack build-essential ca-certificates curl fd-find fzf gawk \ - git jq locales ripgrep tar vim virt-what zsh - - # Set locale. - sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen - echo 'LANG=en_US.UTF-8' > /etc/default/locale - locale-gen - - nvm install 22 - npm install -g tree-sitter-cli @devcontainers/cli - - curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/download/v18.4.0/atuin-installer.sh | sh - - install_neovim - - # TODO: Install: - # - fish - # - lazygit - - elif [ "${ADJUSTED_ID}" = "darwin" ]; then - brew install --casks dbeaver-community devtoys - # TODO: This list of packages should be a variable. Then we loop over it, - # check to see if it's installed, and if not, install it. This might be - # applicable to debian as well, perhaps we can create a function to check if - # a package is installed that's package manager agnostic. - check_packages ack act atuin derailed/k9s/k9s direnv fish fd fzf gh gnupg \ - helm jordanbaird-ice jq kind jesseduffield/lazygit/lazygit neovim \ - ripgrep yq yt-dlp - - nvm install node - - # Hopefully can move the following into nix: - # - dive - # - k6 - # - shellcheck - # - sslscan (?) - # - step - # - terraform-ls - # - tree-sitter - - # Not working, probably cause node doesn't exist yet. - npm install -g @devcontainers/cli - fi - - # Change shell to fishshell. - if ! grep -q '/fish$' /etc/shells; then - which fish | sudo tee -a /etc/shells - chsh -s "$(which fish)" - fi - - if [ "${ENABLE_TMUX}" = "TRUE" ]; then - install_tmux - fi - - clean_up -} - -####################################### -# Installs neovim. -# Globals: -# ARCHITECTURE -# HOME -# PATH -# Arguments: -# None -####################################### -install_neovim() { - # TODO: Check if neovim is installed already. - NEOVIM_VERSION=$(curl -s "https://api.github.com/repos/neovim/neovim/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') - if ARCHITECTURE="aarch64"; then - NEOVIM_ARCHITECTURE="arm64" - else - NEOVIM_ARCHITECTURE="$ARCHITECTURE" - fi - curl -Lo "${HOME}"/neovim.tar.gz "https://github.com/neovim/neovim/releases/download/v${NEOVIM_VERSION}/nvim-linux-${NEOVIM_ARCHITECTURE}.tar.gz" - mkdir -p "${HOME}"/neovim - tar xf "${HOME}"/neovim.tar.gz -C "${HOME}"/neovim --strip-components=1 - export PATH="${HOME}"/neovim/bin:"${PATH}" - rm "${HOME}"/neovim.tar.gz -} - -####################################### -# Installs and configures tmux. -# Globals: -# HOME -# Arguments: -# None -####################################### -install_tmux() { - check_packages tmux - - # NOTE: I can keep tmux, but I'm going to try and not use it as much. It - # shouldn't be installed by default. Same goes for it's config. Maybe we can - # have an env var that defaults to false and determines whether to install / - # configure tmux. - if [ ! -d "$HOME"/.tmux/plugins/tpm ]; then - TPM_VERSION=v3.1.0 - git clone --depth 1 --branch "${TPM_VERSION}" https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm - fi - "$HOME"/.tmux/plugins/tpm/bin/install_plugins -} - -files=".ackrc .config/ghostty .config/nvim .dotfiles.gitconfig .gitattributes .zshrc" - -####################################### -# Symlinks the dotfiles to their correct destination in the home directory. -# Globals: -# files -# HOME -# Arguments: -# None -####################################### -install_dotfiles() { - for i in $files; do - # If it doesn't exist, create it - # loop over files in dotfiles directory and symlink them to directory on host. - - # If the file is a directory - if [ -d "$i" ]; then - # Loop over files in the directory - # Probably needs to be recursive. - for j in "$i"/*; do - mkdir -p "$HOME"/"$i" - ln -s "$PWD"/"$j" "$HOME"/"$i" - done - fi - - mkdir -p "$(dirname "$HOME"/"$i")" - if [ "$(readlink "$HOME"/"$i")" != "$PWD"/"$i" ]; then - rm "$HOME"/"$i" - elif [ ! -L "$HOME"/"$i" ] && [ -f "$HOME"/"$i" ]; then - mv "$HOME"/"$i" "$HOME"/"$i".bkup - fi - - ln -s "$PWD"/"$i" "$HOME"/"$i" - done - - # TODO: Maybe put this in a function later. - # Probaly unnecessary since this is the only configuration needed for git. - git config --global include.path "$HOME"/.dotfiles.gitconfig -} - case "$1" in "install") install_dependencies @@ -329,3 +61,5 @@ case "$1" in usage ;; esac + +trap 'kill %1' EXIT diff --git a/functions.sh b/functions.sh new file mode 100644 index 0000000..2ad16e4 --- /dev/null +++ b/functions.sh @@ -0,0 +1,264 @@ +#!/bin/bash + +####################################### +# Ensure packages are installed. +# Globals: +# ID +# INSTALL_CMD +# SUDO +# Arguments: +# List of packages to install. +####################################### +check_packages() { + # TODO: Check if package is installed and if so, skip it. + # Also, we shouldn't update for each package since that will take forever. + if [ "${INSTALL_CMD}" = "apt-get" ]; then + if ! dpkg -s "$@" >/dev/null 2>&1; then + pkg_mgr_update + "${SUDO}""${INSTALL_CMD}" -y install --no-install-recommends "$@" + fi + elif [ "${INSTALL_CMD}" = "brew" ]; then + pkg_mgr_update + "${INSTALL_CMD}" install "$@" + else + echo "Linux distro ${ID} not supported." + exit 1 + fi +} + +####################################### +# Clean up package manager cache files. +# Globals: +# ADJUSTED_ID +# Arguments: +# None +####################################### +clean_up() { + case "${ADJUSTED_ID}" in + debian) + rm -rf /var/lib/apt/lists/* + ;; + darwin) + brew cleanup + ;; + esac +} + +####################################### +# Install package dependencies. +# Globals: +# ADJUSTED_ID +# ENABLE_TMUX +# Arguments: +# None +####################################### +install_dependencies() { + curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/download/v18.4.0/atuin-installer.sh | sh + + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash + NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + nvm install node + npm install -g @devcontainers/cli + + if [ "${ADJUSTED_ID}" = "debian" ]; then + check_packages ack build-essential ca-certificates curl fd-find fzf gawk \ + git jq locales ripgrep tar vim virt-what zsh + + # Set locale. + sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen + echo 'LANG=en_US.UTF-8' > /etc/default/locale + locale-gen + + install_neovim + + # TODO: Install: + # - fish + # - lazygit + + elif [ "${ADJUSTED_ID}" = "darwin" ]; then + brew install --casks dbeaver-community devtoys + # TODO: This list of packages should be a variable. Then we loop over it, + # check to see if it's installed, and if not, install it. This might be + # applicable to debian as well, perhaps we can create a function to check if + # a package is installed that's package manager agnostic. + check_packages ack act derailed/k9s/k9s direnv fish fd fzf gh gnupg \ + helm jordanbaird-ice jq kind jesseduffield/lazygit/lazygit neovim \ + ripgrep yq yt-dlp + + nvm install node + + # Hopefully can move the following into nix: + # - dive + # - k6 + # - shellcheck + # - sslscan (?) + # - step + # - terraform-ls + # - tree-sitter + + # Change shell to fishshell. + if ! grep -q '/fish$' /etc/shells; then + which fish | "${SUDO}"tee -a /etc/shells + chsh -s "$(which fish)" + fi + fi + + if [ "${ENABLE_TMUX}" = "TRUE" ]; then + install_tmux + fi + + clean_up +} + +####################################### +# Symlinks the dotfiles to their correct destination in the home directory. +# Globals: +# files +# HOME +# Arguments: +# None +####################################### +install_dotfiles() { + files=".ackrc .config/ghostty .config/nvim .dotfiles.gitconfig .gitattributes .zshrc" + + for i in $files; do + # If it doesn't exist, create it + # loop over files in dotfiles directory and symlink them to directory on host. + + # If the file is a directory + if [ -d "$i" ]; then + # Loop over files in the directory + # Probably needs to be recursive. + for j in "$i"/*; do + mkdir -p "$HOME"/"$i" + ln -s "$PWD"/"$j" "$HOME"/"$i" + done + fi + + mkdir -p "$(dirname "$HOME"/"$i")" + if [ "$(readlink "$HOME"/"$i")" != "$PWD"/"$i" ]; then + rm "$HOME"/"$i" + elif [ ! -L "$HOME"/"$i" ] && [ -f "$HOME"/"$i" ]; then + mv "$HOME"/"$i" "$HOME"/"$i".bkup + fi + + ln -s "$PWD"/"$i" "$HOME"/"$i" + done + + # TODO: Maybe put this in a function later. + # Probaly unnecessary since this is the only configuration needed for git. + git config --global include.path "$HOME"/.dotfiles.gitconfig +} + +####################################### +# Installs Homebrew. +# Globals: +# TMPDIR +# Arguments: +# None +####################################### +install_homebrew() { + if ! type brew >/dev/null 2>&1; then + VERSION=$(curl -s https://api.github.com/repos/Homebrew/brew/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name": "v?([^"]*).*/\1/') + CURL -Lo "${TMPDIR}"/brew.pkg "https://github.com/Homebrew/brew/releases/download/${VERSION}/Homebrew-${VERSION}.pkg" + "${SUDO}"installer -pkg "${TMPDIR}"/brew.pkg -target / + rm "${TMPDIR}"/brew.pkg + + # Create $HOME/.zprofile if it doesn't exist. + if [ -f "$HOME"/.zprofile ]; then + echo >> "$HOME"/.zprofile + fi + + # shellcheck disable=SC2016 + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + fi + PATH="/opt/homebrew/bin:$PATH" +} + +####################################### +# Installs neovim. +# Globals: +# ARCHITECTURE +# HOME +# PATH +# Arguments: +# None +####################################### +install_neovim() { + # TODO: Check if neovim is installed already. + NEOVIM_VERSION=$(curl -s "https://api.github.com/repos/neovim/neovim/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') + if ARCHITECTURE="aarch64"; then + NEOVIM_ARCHITECTURE="arm64" + else + NEOVIM_ARCHITECTURE="$ARCHITECTURE" + fi + curl -Lo "${HOME}"/neovim.tar.gz "https://github.com/neovim/neovim/releases/download/v${NEOVIM_VERSION}/nvim-linux-${NEOVIM_ARCHITECTURE}.tar.gz" + mkdir -p "${HOME}"/neovim + tar xf "${HOME}"/neovim.tar.gz -C "${HOME}"/neovim --strip-components=1 + export PATH="${HOME}"/neovim/bin:"${PATH}" + rm "${HOME}"/neovim.tar.gz +} + +####################################### +# Installs and configures tmux. +# Globals: +# HOME +# Arguments: +# None +####################################### +install_tmux() { + check_packages tmux + + # NOTE: I can keep tmux, but I'm going to try and not use it as much. It + # shouldn't be installed by default. Same goes for it's config. Maybe we can + # have an env var that defaults to false and determines whether to install / + # configure tmux. + if [ ! -d "$HOME"/.tmux/plugins/tpm ]; then + TPM_VERSION=v3.1.0 + git clone --depth 1 --branch "${TPM_VERSION}" https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm + fi + "$HOME"/.tmux/plugins/tpm/bin/install_plugins +} + +####################################### +# Update package manager. +# Globals: +# INSTALL_CMD +# SUDO +# Arguments: +# None +####################################### +pkg_mgr_update() { + if [ "${INSTALL_CMD}" = "apt-get" ]; then + if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then + echo "Running apt-get update..." + "${SUDO}""${INSTALL_CMD}" update -y + fi + elif [ "${INSTALL_CMD}" = "brew" ]; then + echo "Running brew update ..." + "${INSTALL_CMD}" update + fi +} + +####################################### +# Print script usage. +# Globals: +# None +# Arguments: +# None +####################################### +usage() { + echo "Manages mpriscella/dotfiles." + echo "" + echo "Usage:" + echo " ./dotfiles.sh [command]" + echo "" + echo "Available Commands:" + echo " clean Removes any backup files generated from the install command." + echo " install Installs dotfiles and predefined packages." + echo "" +} + From 9f4108987b2502c750e4274b5b9708ea0d4e3ab8 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Fri, 7 Feb 2025 00:47:41 -0500 Subject: [PATCH 13/42] Updates to statusline --- .config/nvim/init.lua | 3 + .config/nvim/lua/custom/plugins/lualine.lua | 65 ++++++++++++--------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 581b31f..85a2eed 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -13,6 +13,9 @@ vim.g.have_nerd_font = true -- Make line numbers default vim.opt.number = true +-- Ensure statusline is full width. +vim.o.laststatus = 3 + -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! vim.opt.relativenumber = true diff --git a/.config/nvim/lua/custom/plugins/lualine.lua b/.config/nvim/lua/custom/plugins/lualine.lua index 6ffe5e1..bd3fa26 100644 --- a/.config/nvim/lua/custom/plugins/lualine.lua +++ b/.config/nvim/lua/custom/plugins/lualine.lua @@ -8,21 +8,21 @@ return { -- Credit: glepnir local lualine = require 'lualine' - -- Color table for highlights - -- stylua: ignore - local colors = { - bg = '#202328', - fg = '#bbc2cf', - yellow = '#ECBE7B', - cyan = '#008080', - darkblue = '#081633', - green = '#98be65', - orange = '#FF8800', - violet = '#a9a1e1', - magenta = '#c678dd', - blue = '#51afef', - red = '#ec5f67', - } + -- Color table for highlights + -- stylua: ignore + local colors = { + bg = '#202328', + fg = '#bbc2cf', + yellow = '#ECBE7B', + cyan = '#008080', + darkblue = '#081633', + green = '#98be65', + orange = '#FF8800', + violet = '#a9a1e1', + magenta = '#c678dd', + blue = '#51afef', + red = '#ec5f67', + } local conditions = { buffer_not_empty = function() @@ -135,6 +135,7 @@ return { 'filename', cond = conditions.buffer_not_empty, color = { fg = colors.magenta, gui = 'bold' }, + path = 4, } ins_left { 'location' } @@ -160,6 +161,12 @@ return { end, } + ins_left { + 'filetype', + colored = true, -- Displays filetype icon in color if set to true + icons_enabled = false, -- { align = 'right' }, + } + ins_left { -- Lsp server name . function() @@ -177,24 +184,24 @@ return { end return msg end, - icon = ' LSP:', + icon = ' ', color = { fg = '#ffffff', gui = 'bold' }, } -- Add components to right sections - ins_right { - 'o:encoding', -- option component same as &encoding in viml - fmt = string.upper, -- I'm not sure why it's upper case either ;) - cond = conditions.hide_in_width, - color = { fg = colors.green, gui = 'bold' }, - } - - ins_right { - 'fileformat', - fmt = string.upper, - icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh - color = { fg = colors.green, gui = 'bold' }, - } + -- ins_right { + -- 'o:encoding', -- option component same as &encoding in viml + -- fmt = string.upper, -- I'm not sure why it's upper case either ;) + -- cond = conditions.hide_in_width, + -- color = { fg = colors.green, gui = 'bold' }, + -- } + + -- ins_right { + -- 'fileformat', + -- fmt = string.upper, + -- icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh + -- color = { fg = colors.green, gui = 'bold' }, + -- } ins_right { 'branch', From 7528ab9134488d38941ae33f7a4df3f33e96cef1 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sat, 15 Feb 2025 22:24:44 -0500 Subject: [PATCH 14/42] Add gitignore and shell.nix file --- .config/ghostty/config | 2 + .config/nvim/lua/custom/plugins/lsp.lua | 36 +++++--------- .config/nvim/lua/custom/plugins/noice.lua | 55 ++++++++++++++++++++++ .config/nvim/lua/custom/plugins/snacks.lua | 14 +++++- .gitignore | 1 + shell.nix | 2 - 6 files changed, 82 insertions(+), 28 deletions(-) create mode 100644 .config/nvim/lua/custom/plugins/noice.lua create mode 100644 .gitignore diff --git a/.config/ghostty/config b/.config/ghostty/config index 76400c8..f03883c 100644 --- a/.config/ghostty/config +++ b/.config/ghostty/config @@ -6,4 +6,6 @@ command = /opt/homebrew/bin/fish theme = tokyonight +working-directory = home +quit-after-last-window-closed = true diff --git a/.config/nvim/lua/custom/plugins/lsp.lua b/.config/nvim/lua/custom/plugins/lsp.lua index 29d3356..0cff704 100644 --- a/.config/nvim/lua/custom/plugins/lsp.lua +++ b/.config/nvim/lua/custom/plugins/lsp.lua @@ -69,27 +69,27 @@ return { -- Jump to the definition of the word under your cursor. -- This is where a variable was first declared, or where a function is defined, etc. -- To jump back, press . - map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + -- map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') -- Find references for the word under your cursor. - map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + -- map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') -- Jump to the implementation of the word under your cursor. -- Useful when your language has ways of declaring types without an actual implementation. - map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + -- map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') -- Jump to the type of the word under your cursor. -- Useful when you're not sure what type a variable is and you want to see -- the definition of its *type*, not where it was *defined*. - map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + -- map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. - map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + -- map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. - map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + -- map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. @@ -172,6 +172,7 @@ return { -- }, -- }, -- }, + -- @see https://luals.github.io/wiki/settings/ lua_ls = { settings = { Lua = { @@ -179,34 +180,19 @@ return { callSnippet = 'Replace', }, diagnostics = { - globals = { 'vim' }, + globals = { 'snacks', 'vim' }, + }, + workspace = { + library = { '/Users/michaelpriscella/.local/share/nvim' }, }, }, }, }, - -- markdownlint = {}, - phpactor = {}, - -- phpcs = { - -- cmd = { '/Users/michaelpriscella/workspace/wpcomvip/wgb-zenith/vendor/bin/phpcs', '-d', '-1' }, - -- }, shellcheck = {}, terraformls = {}, -- tflint = {}, -- ts_ls = {}, zls = {}, - -- yamlls = { - -- settings = { - -- validate = true, - -- -- disable the schema store - -- schemaStore = { - -- enable = false, - -- url = '', - -- }, - -- schemas = { - -- ['https://json.schemastore.org/github-workflow.json'] = '.github/workflows/*.{yml,yaml}', - -- }, - -- }, - -- }, } -- Ensure the servers and tools above are installed diff --git a/.config/nvim/lua/custom/plugins/noice.lua b/.config/nvim/lua/custom/plugins/noice.lua new file mode 100644 index 0000000..e09b250 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/noice.lua @@ -0,0 +1,55 @@ +return { + { + 'folke/noice.nvim', + dependencies = { + 'MunifTanjim/nui.nvim', + 'rcarriga/nvim-notify', + }, + event = 'VeryLazy', + opts = { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ['vim.lsp.util.convert_input_to_markdown_lines'] = true, + ['vim.lsp.util.stylize_markdown'] = true, + ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp + }, + }, + ---@class NoicePresets|{} + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + routes = { + { + filter = { + event = 'msg_show', + kind = '', + find = 'written', + }, + opts = { skip = true }, + }, + { + filter = { + event = 'notify', + kind = 'info', + find = '[Neo-tree INFO]', + }, + opts = { skip = true }, + }, + -- Is there a way to filter by message title / source? + { + filter = { + event = 'notify', + kind = 'warn', + find = 'Config Change Detected.', + }, + opts = { skip = true }, + }, + }, + }, + }, +} diff --git a/.config/nvim/lua/custom/plugins/snacks.lua b/.config/nvim/lua/custom/plugins/snacks.lua index 3f20a12..eabf0ba 100644 --- a/.config/nvim/lua/custom/plugins/snacks.lua +++ b/.config/nvim/lua/custom/plugins/snacks.lua @@ -21,6 +21,8 @@ return { lazygit = { enabled = true }, ---@type snacks.picker.Config|{} picker = { + -- Is there a way to automatically close all other pickers when opening + -- a new one? enabled = true, sources = { ---@type snacks.picker.explorer.Config|{} @@ -28,12 +30,15 @@ return { auto_close = true, git_status_open = true, hidden = true, + ignored = true, layout = { layout = { position = 'right' } }, }, }, }, ---@type snacks.notifier.Config|{} - notifier = { enabled = true }, + notifier = { + enabled = true, + }, ---@type snacks.quickfile.Config|{} quickfile = { enabled = true }, ---@type snacks.statuscolumn.Config|{} @@ -49,6 +54,13 @@ return { end, desc = '[G]oto [D]efinition', }, + { + 'sb', + function() + Snacks.picker.buffers() + end, + desc = '[S]earch [B]uffers', + }, { 'sf', function() diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..92b2793 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.direnv diff --git a/shell.nix b/shell.nix index f84b02b..5c2e612 100644 --- a/shell.nix +++ b/shell.nix @@ -8,7 +8,5 @@ pkgs.mkShellNoCC { gh git shellcheck - terraform - terraform-ls ]; } From 7c9763599ee243cf3b042a7597952521d4da671c Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 16 Feb 2025 00:47:49 -0500 Subject: [PATCH 15/42] Committing current changes --- dotfiles.sh | 218 ++++++++++++++++++++++++++++++++++++++++++++++++--- functions.sh | 198 ---------------------------------------------- 2 files changed, 209 insertions(+), 207 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index f8f3fb6..69a3dc4 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -1,16 +1,214 @@ #!/bin/bash -# User defined configs. +source functions.sh + ENABLE_TMUX=FALSE -SUDO="" -if type sudo >/dev/null 2>&1; then - SUDO="sudo " - sudo -v - while true; do sudo -v; sleep 60; done & -fi +####################################### +# Install package dependencies. +# Globals: +# ADJUSTED_ID +# ENABLE_TMUX +# Arguments: +# None +####################################### +install_dependencies() { + # Install atuin. + curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/download/v18.4.0/atuin-installer.sh | sh + + # Install nvm. + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash + NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + + nvm install node + npm install -g @devcontainers/cli + + if [ "${ADJUSTED_ID}" = "debian" ]; then + check_packages ack build-essential ca-certificates curl fd-find fzf gawk \ + git jq locales ripgrep tar vim virt-what zsh + + # Set locale. + sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen + echo 'LANG=en_US.UTF-8' > /etc/default/locale + locale-gen + + install_neovim + + # TODO: Install: + # - fish + # - lazygit + + elif [ "${ADJUSTED_ID}" = "darwin" ]; then + brew install --casks dbeaver-community devtoys + # TODO: This list of packages should be a variable. Then we loop over it, + # check to see if it's installed, and if not, install it. This might be + # applicable to debian as well, perhaps we can create a function to check if + # a package is installed that's package manager agnostic. + check_packages ack act derailed/k9s/k9s direnv fish fd fzf gh gnupg \ + helm jordanbaird-ice jq kind jesseduffield/lazygit/lazygit neovim \ + orbstack ripgrep yq yt-dlp + + nvm install node + + # Hopefully can move the following into nix: + # - dive + # - k6 + # - shellcheck + # - sslscan (?) + # - step + # - terraform-ls + # - tree-sitter + + # Change shell to fishshell. + if ! grep -q '/fish$' /etc/shells; then + which fish | sudo tee -a /etc/shells + chsh -s "$(which fish)" + fi + fi + + if [ "${ENABLE_TMUX}" = "TRUE" ]; then + install_tmux + fi + + # Install fisher. + fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher" + + # Install pure. + fish -c "fisher install pure-fish/pure" + + clean_up +} + +####################################### +# Symlinks the dotfiles to their correct destination in the home directory. +# Globals: +# files +# HOME +# Arguments: +# None +####################################### +install_dotfiles() { + files=".ackrc .config/ghostty .config/nvim .dotfiles.gitconfig .gitattributes .zshrc" + + for i in $files; do + # If it doesn't exist, create it + # loop over files in dotfiles directory and symlink them to directory on host. + + # If the file is a directory + if [ -d "$i" ]; then + # Loop over files in the directory + # Probably needs to be recursive. + for j in "$i"/*; do + mkdir -p "$HOME"/"$i" + ln -s "$PWD"/"$j" "$HOME"/"$i" + done + fi + + mkdir -p "$(dirname "$HOME"/"$i")" + if [ "$(readlink "$HOME"/"$i")" != "$PWD"/"$i" ]; then + rm "$HOME"/"$i" + elif [ ! -L "$HOME"/"$i" ] && [ -f "$HOME"/"$i" ]; then + mv "$HOME"/"$i" "$HOME"/"$i".bkup + fi + + ln -s "$PWD"/"$i" "$HOME"/"$i" + done + + # TODO: Maybe put this in a function later. + # Probaly unnecessary since this is the only configuration needed for git. + git config --global include.path "$HOME"/.dotfiles.gitconfig +} + +####################################### +# Installs Homebrew. +# Globals: +# TMPDIR +# Arguments: +# None +####################################### +install_homebrew() { + if ! type brew >/dev/null 2>&1; then + VERSION=$(curl -s https://api.github.com/repos/Homebrew/brew/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name": "v?([^"]*).*/\1/') + CURL -Lo "${TMPDIR}"/brew.pkg "https://github.com/Homebrew/brew/releases/download/${VERSION}/Homebrew-${VERSION}.pkg" + sudo installer -pkg "${TMPDIR}"/brew.pkg -target / + rm "${TMPDIR}"/brew.pkg + + # Create $HOME/.zprofile if it doesn't exist. + if [ -f "$HOME"/.zprofile ]; then + echo >> "$HOME"/.zprofile + fi + + # shellcheck disable=SC2016 + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + fi + PATH="/opt/homebrew/bin:$PATH" +} + +####################################### +# Installs neovim. +# Globals: +# ARCHITECTURE +# HOME +# PATH +# Arguments: +# None +####################################### +install_neovim() { + # TODO: Check if neovim is installed already. + NEOVIM_VERSION=$(curl -s "https://api.github.com/repos/neovim/neovim/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') + if ARCHITECTURE="aarch64"; then + NEOVIM_ARCHITECTURE="arm64" + else + NEOVIM_ARCHITECTURE="$ARCHITECTURE" + fi + curl -Lo "${HOME}"/neovim.tar.gz "https://github.com/neovim/neovim/releases/download/v${NEOVIM_VERSION}/nvim-linux-${NEOVIM_ARCHITECTURE}.tar.gz" + mkdir -p "${HOME}"/neovim + tar xf "${HOME}"/neovim.tar.gz -C "${HOME}"/neovim --strip-components=1 + export PATH="${HOME}"/neovim/bin:"${PATH}" + rm "${HOME}"/neovim.tar.gz +} + +####################################### +# Installs and configures tmux. +# Globals: +# HOME +# Arguments: +# None +####################################### +install_tmux() { + check_packages tmux + + # NOTE: I can keep tmux, but I'm going to try and not use it as much. It + # shouldn't be installed by default. Same goes for it's config. Maybe we can + # have an env var that defaults to false and determines whether to install / + # configure tmux. + if [ ! -d "$HOME"/.tmux/plugins/tpm ]; then + TPM_VERSION=v3.1.0 + git clone --depth 1 --branch "${TPM_VERSION}" https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm + fi + "$HOME"/.tmux/plugins/tpm/bin/install_plugins +} -. functions.sh +####################################### +# Print script usage. +# Globals: +# None +# Arguments: +# None +####################################### +usage() { + echo "Manages mpriscella/dotfiles." + echo "" + echo "Usage:" + echo " ./dotfiles.sh [command]" + echo "" + echo "Available Commands:" + echo " clean Removes any backup files generated from the install command." + echo " install Installs dotfiles and predefined packages." + echo "" +} # Bring in ID and ID_LIKE, if the file exists. if [ -f /etc/os-release ]; then @@ -62,4 +260,6 @@ case "$1" in ;; esac -trap 'kill %1' EXIT +# TODO: How to run this automatically? +# nix profile install nixpkgs#nix-direnv +# echo "source $HOME/.nix-profile/share/nix-direnv/direnvrc" >> "$HOME"/.config/direnv/direnvrc diff --git a/functions.sh b/functions.sh index 2ad16e4..91930c2 100644 --- a/functions.sh +++ b/functions.sh @@ -44,185 +44,6 @@ clean_up() { esac } -####################################### -# Install package dependencies. -# Globals: -# ADJUSTED_ID -# ENABLE_TMUX -# Arguments: -# None -####################################### -install_dependencies() { - curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/download/v18.4.0/atuin-installer.sh | sh - - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash - NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - nvm install node - npm install -g @devcontainers/cli - - if [ "${ADJUSTED_ID}" = "debian" ]; then - check_packages ack build-essential ca-certificates curl fd-find fzf gawk \ - git jq locales ripgrep tar vim virt-what zsh - - # Set locale. - sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen - echo 'LANG=en_US.UTF-8' > /etc/default/locale - locale-gen - - install_neovim - - # TODO: Install: - # - fish - # - lazygit - - elif [ "${ADJUSTED_ID}" = "darwin" ]; then - brew install --casks dbeaver-community devtoys - # TODO: This list of packages should be a variable. Then we loop over it, - # check to see if it's installed, and if not, install it. This might be - # applicable to debian as well, perhaps we can create a function to check if - # a package is installed that's package manager agnostic. - check_packages ack act derailed/k9s/k9s direnv fish fd fzf gh gnupg \ - helm jordanbaird-ice jq kind jesseduffield/lazygit/lazygit neovim \ - ripgrep yq yt-dlp - - nvm install node - - # Hopefully can move the following into nix: - # - dive - # - k6 - # - shellcheck - # - sslscan (?) - # - step - # - terraform-ls - # - tree-sitter - - # Change shell to fishshell. - if ! grep -q '/fish$' /etc/shells; then - which fish | "${SUDO}"tee -a /etc/shells - chsh -s "$(which fish)" - fi - fi - - if [ "${ENABLE_TMUX}" = "TRUE" ]; then - install_tmux - fi - - clean_up -} - -####################################### -# Symlinks the dotfiles to their correct destination in the home directory. -# Globals: -# files -# HOME -# Arguments: -# None -####################################### -install_dotfiles() { - files=".ackrc .config/ghostty .config/nvim .dotfiles.gitconfig .gitattributes .zshrc" - - for i in $files; do - # If it doesn't exist, create it - # loop over files in dotfiles directory and symlink them to directory on host. - - # If the file is a directory - if [ -d "$i" ]; then - # Loop over files in the directory - # Probably needs to be recursive. - for j in "$i"/*; do - mkdir -p "$HOME"/"$i" - ln -s "$PWD"/"$j" "$HOME"/"$i" - done - fi - - mkdir -p "$(dirname "$HOME"/"$i")" - if [ "$(readlink "$HOME"/"$i")" != "$PWD"/"$i" ]; then - rm "$HOME"/"$i" - elif [ ! -L "$HOME"/"$i" ] && [ -f "$HOME"/"$i" ]; then - mv "$HOME"/"$i" "$HOME"/"$i".bkup - fi - - ln -s "$PWD"/"$i" "$HOME"/"$i" - done - - # TODO: Maybe put this in a function later. - # Probaly unnecessary since this is the only configuration needed for git. - git config --global include.path "$HOME"/.dotfiles.gitconfig -} - -####################################### -# Installs Homebrew. -# Globals: -# TMPDIR -# Arguments: -# None -####################################### -install_homebrew() { - if ! type brew >/dev/null 2>&1; then - VERSION=$(curl -s https://api.github.com/repos/Homebrew/brew/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name": "v?([^"]*).*/\1/') - CURL -Lo "${TMPDIR}"/brew.pkg "https://github.com/Homebrew/brew/releases/download/${VERSION}/Homebrew-${VERSION}.pkg" - "${SUDO}"installer -pkg "${TMPDIR}"/brew.pkg -target / - rm "${TMPDIR}"/brew.pkg - - # Create $HOME/.zprofile if it doesn't exist. - if [ -f "$HOME"/.zprofile ]; then - echo >> "$HOME"/.zprofile - fi - - # shellcheck disable=SC2016 - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile - eval "$(/opt/homebrew/bin/brew shellenv)" - fi - PATH="/opt/homebrew/bin:$PATH" -} - -####################################### -# Installs neovim. -# Globals: -# ARCHITECTURE -# HOME -# PATH -# Arguments: -# None -####################################### -install_neovim() { - # TODO: Check if neovim is installed already. - NEOVIM_VERSION=$(curl -s "https://api.github.com/repos/neovim/neovim/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') - if ARCHITECTURE="aarch64"; then - NEOVIM_ARCHITECTURE="arm64" - else - NEOVIM_ARCHITECTURE="$ARCHITECTURE" - fi - curl -Lo "${HOME}"/neovim.tar.gz "https://github.com/neovim/neovim/releases/download/v${NEOVIM_VERSION}/nvim-linux-${NEOVIM_ARCHITECTURE}.tar.gz" - mkdir -p "${HOME}"/neovim - tar xf "${HOME}"/neovim.tar.gz -C "${HOME}"/neovim --strip-components=1 - export PATH="${HOME}"/neovim/bin:"${PATH}" - rm "${HOME}"/neovim.tar.gz -} - -####################################### -# Installs and configures tmux. -# Globals: -# HOME -# Arguments: -# None -####################################### -install_tmux() { - check_packages tmux - - # NOTE: I can keep tmux, but I'm going to try and not use it as much. It - # shouldn't be installed by default. Same goes for it's config. Maybe we can - # have an env var that defaults to false and determines whether to install / - # configure tmux. - if [ ! -d "$HOME"/.tmux/plugins/tpm ]; then - TPM_VERSION=v3.1.0 - git clone --depth 1 --branch "${TPM_VERSION}" https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm - fi - "$HOME"/.tmux/plugins/tpm/bin/install_plugins -} - ####################################### # Update package manager. # Globals: @@ -243,22 +64,3 @@ pkg_mgr_update() { fi } -####################################### -# Print script usage. -# Globals: -# None -# Arguments: -# None -####################################### -usage() { - echo "Manages mpriscella/dotfiles." - echo "" - echo "Usage:" - echo " ./dotfiles.sh [command]" - echo "" - echo "Available Commands:" - echo " clean Removes any backup files generated from the install command." - echo " install Installs dotfiles and predefined packages." - echo "" -} - From e480852bacee94ad6aa768a94b72c92033c552b5 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Thu, 20 Feb 2025 23:57:33 -0500 Subject: [PATCH 16/42] Install CodeCompanion plugin --- .config/nvim/lazy-lock.json | 51 +++++++++---------- .../nvim/lua/custom/plugins/codecompanion.lua | 17 +++++++ .config/nvim/lua/custom/plugins/markdown.lua | 8 +++ 3 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 .config/nvim/lua/custom/plugins/codecompanion.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index fd7e400..321bf3e 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -3,42 +3,41 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "codecompanion.nvim": { "branch": "main", "commit": "453fda745c673a6092c685bc0abb6918915ea532" }, "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" }, - "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, - "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, + "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "9b36d497495436c135659902054ee637e0ba6021" }, - "lazy.nvim": { "branch": "main", "commit": "7527af40ddd4a93a02911be570b32609b9d4ea53" }, + "gitsigns.nvim": { "branch": "main", "commit": "6668f379ca634c36b8e11453118590b91bf8b295" }, + "lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" }, "lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" }, - "lazygit.nvim": { "branch": "main", "commit": "adc37c5a6d7d6e8d0a039f08f3c7837971a1c77a" }, - "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, - "markview.nvim": { "branch": "main", "commit": "a39d03f8445971c4a250396a44b23fa9c6fd8921" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, + "markview.nvim": { "branch": "main", "commit": "f1e2a57388b61fff8e9d7519ce05cee27a59a57e" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "26ea08fd5c7028ea54a3347ac139fc916baf1aa9" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "374c78d3ebb5c53f43ea6bd906b6587b5e899b9e" }, - "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, + "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, + "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" }, "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, - "nvim-dap": { "branch": "master", "commit": "b4f27d451c187de912fa8d3229025a952917eb9e" }, - "nvim-dap-go": { "branch": "main", "commit": "07739481317d36ddb3e3e8fbdfcd8f90b4167d73" }, + "nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" }, + "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, - "nvim-lint": { "branch": "master", "commit": "789b7ada1b4f00e08d026dffde410dcfa6a0ba87" }, - "nvim-lspconfig": { "branch": "master", "commit": "66bc018936c6ff76beb75f89d986af6442db4001" }, + "nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, + "nvim-lspconfig": { "branch": "master", "commit": "1110787f1b464888c59a044c48c5119d14078044" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, - "nvim-treesitter": { "branch": "master", "commit": "4e701776f8824fc188a6254f57d080971ce28c92" }, - "nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" }, - "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, - "snacks.nvim": { "branch": "main", "commit": "b773368f8aa6e84a68e979f0e335d23de71f405a" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, - "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "nvim-treesitter": { "branch": "master", "commit": "1a6e42bb8c5c23d8e2c0acb842dcacac5ee06761" }, + "nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "snacks.nvim": { "branch": "main", "commit": "aaed4a94111ddfd9d23cdecb01e4ae53030c2c3e" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" }, - "tokyonight.nvim": { "branch": "main", "commit": "dca4adba7dc5f09302a00b0e76078d54d82d2658" }, - "trouble.nvim": { "branch": "main", "commit": "6f380b8826fb819c752c8fd7daaee9ef96d4c689" }, + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, "vim-helm": { "branch": "master", "commit": "ae1ebc160d2b9b90108477ab10df7a4fc501e358" }, - "which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" } + "which-key.nvim": { "branch": "main", "commit": "5bf7a73fe851896d5ac26d313db849bf00f45b78" } } diff --git a/.config/nvim/lua/custom/plugins/codecompanion.lua b/.config/nvim/lua/custom/plugins/codecompanion.lua new file mode 100644 index 0000000..91139b0 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/codecompanion.lua @@ -0,0 +1,17 @@ +return { + { + 'olimorris/codecompanion.nvim', + config = true, + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + }, + keys = { + { + 'cc', + 'CodeCompanionChat Toggle', + desc = '[C]ode [C]ompanion', + }, + }, + }, +} diff --git a/.config/nvim/lua/custom/plugins/markdown.lua b/.config/nvim/lua/custom/plugins/markdown.lua index 1a78c29..8ba5c00 100644 --- a/.config/nvim/lua/custom/plugins/markdown.lua +++ b/.config/nvim/lua/custom/plugins/markdown.lua @@ -2,5 +2,13 @@ return { { 'OXY2DEV/markview.nvim', lazy = false, + ---@type mkv.config + opts = { + preview = { + filetypes = { 'markdown', 'codecompanion' }, + ignore_buftypes = {}, + hybrid_modes = { 'i' }, + }, + }, }, } From e92823dc8af55ae29b45f3aa6b4ec0baaddf77c3 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Wed, 12 Mar 2025 21:30:58 -0400 Subject: [PATCH 17/42] Small updates --- .config/nvim/lazy-lock.json | 31 ++++++++++--------- .../nvim/lua/custom/plugins/codecompanion.lua | 17 ++++++++-- .config/nvim/lua/custom/plugins/markdown.lua | 2 +- shell.nix | 1 - 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 321bf3e..3dde3c5 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -3,41 +3,42 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "codecompanion.nvim": { "branch": "main", "commit": "453fda745c673a6092c685bc0abb6918915ea532" }, + "codecompanion.nvim": { "branch": "main", "commit": "e9e602da8d3c3b56c2e5be96622caa7f104130cd" }, "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, + "conform.nvim": { "branch": "master", "commit": "db8a4a9edb217067b1d7a2e0362c74bfe9cc944d" }, + "copilot.vim": { "branch": "release", "commit": "cd7f01009fb7b30e22840cadc4faad88b05c6eef" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "6668f379ca634c36b8e11453118590b91bf8b295" }, - "lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" }, - "lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" }, + "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, - "markview.nvim": { "branch": "main", "commit": "f1e2a57388b61fff8e9d7519ce05cee27a59a57e" }, + "markview.nvim": { "branch": "main", "commit": "247a35176b3c89498b006d1556767e41cfe18762" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "26ea08fd5c7028ea54a3347ac139fc916baf1aa9" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "374c78d3ebb5c53f43ea6bd906b6587b5e899b9e" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "09220b99d63d5363f219daa2785242ee5fddba7f" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "5639d58a3d11ff7c05c8e31e159bfedae55d7961" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" }, - "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, - "nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" }, + "nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" }, + "nvim-dap": { "branch": "master", "commit": "8228cb00ab0850e483f8d58cc39cc580c05738d6" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, "nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, - "nvim-lspconfig": { "branch": "master", "commit": "1110787f1b464888c59a044c48c5119d14078044" }, + "nvim-lspconfig": { "branch": "master", "commit": "84e0cd5a3c58e88ef706fdf4a1eed59ded1d3ce2" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, - "nvim-treesitter": { "branch": "master", "commit": "1a6e42bb8c5c23d8e2c0acb842dcacac5ee06761" }, - "nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" }, + "nvim-treesitter": { "branch": "master", "commit": "55c5c762fee2e813b4e43bbfaf5b91d182bd2875" }, + "nvim-web-devicons": { "branch": "master", "commit": "ab4cfee554e501f497bce0856788d43cf2eb93d7" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "snacks.nvim": { "branch": "main", "commit": "aaed4a94111ddfd9d23cdecb01e4ae53030c2c3e" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, "vim-helm": { "branch": "master", "commit": "ae1ebc160d2b9b90108477ab10df7a4fc501e358" }, - "which-key.nvim": { "branch": "main", "commit": "5bf7a73fe851896d5ac26d313db849bf00f45b78" } + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/.config/nvim/lua/custom/plugins/codecompanion.lua b/.config/nvim/lua/custom/plugins/codecompanion.lua index 91139b0..5e72bfb 100644 --- a/.config/nvim/lua/custom/plugins/codecompanion.lua +++ b/.config/nvim/lua/custom/plugins/codecompanion.lua @@ -8,9 +8,22 @@ return { }, keys = { { - 'cc', + '', + 'CodeCompanionActions', + desc = 'CodeCompanion [A]ctions', + mode = { 'n', 'v' }, + }, + { + 'a', 'CodeCompanionChat Toggle', - desc = '[C]ode [C]ompanion', + desc = 'CodeCompanion Chat Toggle', + mode = { 'n', 'v' }, + }, + { + 'ga', + 'CodeCompanionChat Add', + desc = 'CodeCompanion Chat Add', + mode = 'v', }, }, }, diff --git a/.config/nvim/lua/custom/plugins/markdown.lua b/.config/nvim/lua/custom/plugins/markdown.lua index 8ba5c00..4de3011 100644 --- a/.config/nvim/lua/custom/plugins/markdown.lua +++ b/.config/nvim/lua/custom/plugins/markdown.lua @@ -7,7 +7,7 @@ return { preview = { filetypes = { 'markdown', 'codecompanion' }, ignore_buftypes = {}, - hybrid_modes = { 'i' }, + hybrid_modes = { 'i', 'n', 'v' }, }, }, }, diff --git a/shell.nix b/shell.nix index 5c2e612..2331667 100644 --- a/shell.nix +++ b/shell.nix @@ -6,7 +6,6 @@ in pkgs.mkShellNoCC { packages = with pkgs; [ gh - git shellcheck ]; } From 17ea1cb2f5992b92ca28bbae59a2121a394a4814 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Fri, 28 Mar 2025 00:25:41 -0400 Subject: [PATCH 18/42] Updates to custom plugin format --- .config/nvim/init.lua | 18 +- .config/nvim/lazy-lock.json | 38 +- .../lua/custom/plugins/autocompletion.lua | 155 ++---- .../nvim/lua/custom/plugins/autoformat.lua | 75 ++- .config/nvim/lua/custom/plugins/autopairs.lua | 9 - .../nvim/lua/custom/plugins/codecompanion.lua | 48 +- .config/nvim/lua/custom/plugins/codesnap.lua | 22 +- .config/nvim/lua/custom/plugins/copilot.lua | 5 +- .config/nvim/lua/custom/plugins/gitsigns.lua | 112 +++-- .config/nvim/lua/custom/plugins/helm.lua | 6 +- .config/nvim/lua/custom/plugins/icons.lua | 26 +- .config/nvim/lua/custom/plugins/lint.lua | 98 ++-- .config/nvim/lua/custom/plugins/lsp.lua | 444 +++++++++--------- .config/nvim/lua/custom/plugins/lualine.lua | 428 +++++++++-------- .config/nvim/lua/custom/plugins/markdown.lua | 18 +- .config/nvim/lua/custom/plugins/noice.lua | 88 ++-- .config/nvim/lua/custom/plugins/snacks.lua | 192 ++++---- .config/nvim/lua/custom/plugins/surround.lua | 18 +- .config/nvim/lua/custom/plugins/terminal.lua | 94 ++-- .../nvim/lua/custom/plugins/todo-comments.lua | 8 +- .../nvim/lua/custom/plugins/tokyonight.lua | 22 +- .../nvim/lua/custom/plugins/treesitter.lua | 88 ++-- .config/nvim/lua/custom/plugins/trouble.lua | 68 ++- .config/nvim/lua/custom/plugins/which-key.lua | 97 ++-- 24 files changed, 1025 insertions(+), 1152 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 85a2eed..af334be 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -10,14 +10,13 @@ vim.g.have_nerd_font = true -- NOTE: You can change these options as you wish! -- For more options, you can see `:help option-list` --- Make line numbers default +-- Make line numbers default. vim.opt.number = true -- Ensure statusline is full width. vim.o.laststatus = 3 --- You can also add relative line numbers, to help with jumping. --- Experiment for yourself to see if you like it! +-- Enable relative line numbers. vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! @@ -140,7 +139,7 @@ vim.api.nvim_create_autocmd('TextYankPost', { }) -- [[ Install `lazy.nvim` plugin manager ]] --- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info +-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info. local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' @@ -152,18 +151,7 @@ end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) -- [[ Configure and install plugins ]] --- --- To check the current status of your plugins, run --- :Lazy --- --- You can press `?` in this menu for help. Use `:q` to close the window --- --- To update plugins you can run --- :Lazy update --- --- NOTE: Here is where you install your plugins. require('lazy').setup { - -- LSP Plugins { -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins -- used for completion, annotations and signatures of Neovim apis diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 3dde3c5..8624031 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,38 +1,34 @@ { - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "codecompanion.nvim": { "branch": "main", "commit": "e9e602da8d3c3b56c2e5be96622caa7f104130cd" }, + "blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" }, + "codecompanion.nvim": { "branch": "main", "commit": "51fe5a782dbbd5cad8189420cb8d38fd7c245684" }, "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "conform.nvim": { "branch": "master", "commit": "db8a4a9edb217067b1d7a2e0362c74bfe9cc944d" }, - "copilot.vim": { "branch": "release", "commit": "cd7f01009fb7b30e22840cadc4faad88b05c6eef" }, + "conform.nvim": { "branch": "master", "commit": "f9ef25a7ef00267b7d13bfc00b0dea22d78702d5" }, + "copilot.vim": { "branch": "release", "commit": "a9228e015528c9307890c48083c925eb98a64a79" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" }, + "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, + "lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, - "markview.nvim": { "branch": "main", "commit": "247a35176b3c89498b006d1556767e41cfe18762" }, + "markview.nvim": { "branch": "main", "commit": "556cac8bb8eeb461013ebe0d015e2c48d3527c36" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "09220b99d63d5363f219daa2785242ee5fddba7f" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "5639d58a3d11ff7c05c8e31e159bfedae55d7961" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "ea387e0819ab189d536bb4067e4d8ece3801a292" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "98767d37f8e5255a5111fc1e3163232d4dc07bda" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, - "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, - "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" }, - "nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" }, - "nvim-dap": { "branch": "master", "commit": "8228cb00ab0850e483f8d58cc39cc580c05738d6" }, + "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, + "nvim-autopairs": { "branch": "master", "commit": "6522027785b305269fa17088395dfc0f456cedd2" }, + "nvim-dap": { "branch": "master", "commit": "2d1bd2b6bd0f366a531b6d5b0f8a955d804c918a" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, - "nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, - "nvim-lspconfig": { "branch": "master", "commit": "84e0cd5a3c58e88ef706fdf4a1eed59ded1d3ce2" }, + "nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" }, + "nvim-lspconfig": { "branch": "master", "commit": "85e0dd26b710e834a105d679200d01e326a3d2b0" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, - "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, - "nvim-treesitter": { "branch": "master", "commit": "55c5c762fee2e813b4e43bbfaf5b91d182bd2875" }, - "nvim-web-devicons": { "branch": "master", "commit": "ab4cfee554e501f497bce0856788d43cf2eb93d7" }, + "nvim-surround": { "branch": "main", "commit": "caf6f633d4d77a29b6e265b560c5a035d171a913" }, + "nvim-treesitter": { "branch": "master", "commit": "da5825bf70cc2ea7eacd1e60c32c07baf19adeba" }, + "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, diff --git a/.config/nvim/lua/custom/plugins/autocompletion.lua b/.config/nvim/lua/custom/plugins/autocompletion.lua index c750249..5ae253c 100644 --- a/.config/nvim/lua/custom/plugins/autocompletion.lua +++ b/.config/nvim/lua/custom/plugins/autocompletion.lua @@ -1,116 +1,53 @@ --- Autocompletion --- TODO: Look into using blink-cmp instead. return { - { - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - { - 'L3MON4D3/LuaSnip', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - { - 'rafamadriz/friendly-snippets', - config = function() - require('luasnip.loaders.from_vscode').lazy_load() - end, - }, - }, - }, - 'saadparwaiz1/cmp_luasnip', - - -- Adds other completion capabilities. - -- nvim-cmp does not ship with all sources by default. They are split - -- into multiple repos for maintenance purposes. - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = { 'rafamadriz/friendly-snippets' }, + + -- use a release tag to download pre-built binaries + version = '1.*', + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'default' }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', }, - config = function() - -- See `:help cmp` - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = 'menu,menuone,noinsert' }, - - -- For an understanding of why these mappings were - -- chosen, you will need to read `:help ins-completion` - -- - -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert { - -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), - - -- Scroll the documentation window [b]ack / [f]orward - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - -- Accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, - -- If you prefer more traditional completion keymaps, - -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, - --[''] = cmp.mapping.select_next_item(), - --[''] = cmp.mapping.select_prev_item(), - - -- Manually trigger a completion from nvim-cmp. - -- Generally you don't need this, because nvim-cmp will display - -- completions whenever it has completion options available. - [''] = cmp.mapping.complete {}, - - -- Think of as moving to the right of your snippet expansion. - -- So if you have a snippet that's like: - -- function $name($args) - -- $body - -- end - -- - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - sources = { - { - name = 'lazydev', - -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it - group_index = 0, - }, - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, - } - end, + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = 'prefer_rust_with_warning' }, }, + opts_extend = { 'sources.default' }, } diff --git a/.config/nvim/lua/custom/plugins/autoformat.lua b/.config/nvim/lua/custom/plugins/autoformat.lua index 10f209e..72439de 100644 --- a/.config/nvim/lua/custom/plugins/autoformat.lua +++ b/.config/nvim/lua/custom/plugins/autoformat.lua @@ -1,46 +1,39 @@ --- Autoformat return { - { - 'stevearc/conform.nvim', - event = { 'BufWritePre' }, - cmd = { 'ConformInfo' }, - keys = { - { - 'f', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = '[F]ormat buffer', - }, - }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { cpp = true } - local lsp_format_opt - if disable_filetypes[vim.bo[bufnr].filetype] then - lsp_format_opt = 'never' - else - lsp_format_opt = 'fallback' - end - return { - timeout_ms = 500, - lsp_format = lsp_format_opt, - } + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_format = 'fallback' } end, - formatters_by_ft = { - lua = { 'stylua' }, - php = { 'phpcbf' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, - }, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { cpp = true } + local lsp_format_opt + if disable_filetypes[vim.bo[bufnr].filetype] then + lsp_format_opt = 'never' + else + lsp_format_opt = 'fallback' + end + return { + timeout_ms = 500, + lsp_format = lsp_format_opt, + } + end, + formatters_by_ft = { + lua = { 'stylua' }, + php = { 'phpcbf' }, + c = { 'clang-format' }, }, }, } diff --git a/.config/nvim/lua/custom/plugins/autopairs.lua b/.config/nvim/lua/custom/plugins/autopairs.lua index 87a7e5f..ac0220d 100644 --- a/.config/nvim/lua/custom/plugins/autopairs.lua +++ b/.config/nvim/lua/custom/plugins/autopairs.lua @@ -1,16 +1,7 @@ --- autopairs --- https://github.com/windwp/nvim-autopairs - return { 'windwp/nvim-autopairs', event = 'InsertEnter', - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, config = function() require('nvim-autopairs').setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require 'nvim-autopairs.completion.cmp' - local cmp = require 'cmp' - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) end, } diff --git a/.config/nvim/lua/custom/plugins/codecompanion.lua b/.config/nvim/lua/custom/plugins/codecompanion.lua index 5e72bfb..e143dce 100644 --- a/.config/nvim/lua/custom/plugins/codecompanion.lua +++ b/.config/nvim/lua/custom/plugins/codecompanion.lua @@ -1,30 +1,28 @@ return { - { - 'olimorris/codecompanion.nvim', - config = true, - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-treesitter/nvim-treesitter', + 'olimorris/codecompanion.nvim', + config = true, + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + }, + keys = { + { + '', + 'CodeCompanionActions', + desc = 'CodeCompanion [A]ctions', + mode = { 'n', 'v' }, + }, + { + 'a', + 'CodeCompanionChat Toggle', + desc = 'CodeCompanion Chat Toggle', + mode = { 'n', 'v' }, }, - keys = { - { - '', - 'CodeCompanionActions', - desc = 'CodeCompanion [A]ctions', - mode = { 'n', 'v' }, - }, - { - 'a', - 'CodeCompanionChat Toggle', - desc = 'CodeCompanion Chat Toggle', - mode = { 'n', 'v' }, - }, - { - 'ga', - 'CodeCompanionChat Add', - desc = 'CodeCompanion Chat Add', - mode = 'v', - }, + { + 'ga', + 'CodeCompanionChat Add', + desc = 'CodeCompanion Chat Add', + mode = 'v', }, }, } diff --git a/.config/nvim/lua/custom/plugins/codesnap.lua b/.config/nvim/lua/custom/plugins/codesnap.lua index 7e9b4d7..d14cf15 100644 --- a/.config/nvim/lua/custom/plugins/codesnap.lua +++ b/.config/nvim/lua/custom/plugins/codesnap.lua @@ -1,15 +1,13 @@ return { - { - 'mistricky/codesnap.nvim', - build = 'make', - keys = { - { 'cc', 'CodeSnap', mode = 'x', desc = 'Save selected code snapshot into clipboard' }, - { 'cs', 'CodeSnapSave', mode = 'x', desc = 'Save selected code snapshot in ~/Pictures' }, - }, - opts = { - save_path = '~/Screenshots/CodeSnap', - has_breadcrumbs = true, - watermark = '@mpriscella', - }, + 'mistricky/codesnap.nvim', + build = 'make', + keys = { + { 'cc', 'CodeSnap', mode = 'x', desc = 'Save selected code snapshot into clipboard' }, + { 'cs', 'CodeSnapSave', mode = 'x', desc = 'Save selected code snapshot in ~/Pictures' }, + }, + opts = { + save_path = '~/Screenshots/CodeSnap', + has_breadcrumbs = true, + watermark = '@mpriscella', }, } diff --git a/.config/nvim/lua/custom/plugins/copilot.lua b/.config/nvim/lua/custom/plugins/copilot.lua index 84835e6..e23e05c 100644 --- a/.config/nvim/lua/custom/plugins/copilot.lua +++ b/.config/nvim/lua/custom/plugins/copilot.lua @@ -1,3 +1,6 @@ return { - { 'github/copilot.vim' }, + 'github/copilot.vim', + config = function() + vim.g.copilot_settings = { selectedCompletionModel = 'gpt-4o-copilot' } + end, } diff --git a/.config/nvim/lua/custom/plugins/gitsigns.lua b/.config/nvim/lua/custom/plugins/gitsigns.lua index 0effa40..a1f2b8d 100644 --- a/.config/nvim/lua/custom/plugins/gitsigns.lua +++ b/.config/nvim/lua/custom/plugins/gitsigns.lua @@ -1,65 +1,63 @@ -- Adds git related signs to the gutter, as well as utilities for managing changes return { - { - 'lewis6991/gitsigns.nvim', - opts = { - on_attach = function(bufnr) - local gitsigns = require 'gitsigns' + 'lewis6991/gitsigns.nvim', + opts = { + on_attach = function(bufnr) + local gitsigns = require 'gitsigns' - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end - -- Navigation - map('n', ']c', function() - if vim.wo.diff then - vim.cmd.normal { ']c', bang = true } - else - gitsigns.nav_hunk 'next' - end - end, { desc = 'Jump to next git [c]hange' }) + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal { ']c', bang = true } + else + gitsigns.nav_hunk 'next' + end + end, { desc = 'Jump to next git [c]hange' }) - map('n', '[c', function() - if vim.wo.diff then - vim.cmd.normal { '[c', bang = true } - else - gitsigns.nav_hunk 'prev' - end - end, { desc = 'Jump to previous git [c]hange' }) + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal { '[c', bang = true } + else + gitsigns.nav_hunk 'prev' + end + end, { desc = 'Jump to previous git [c]hange' }) - -- Actions - -- visual mode - map('v', 'hs', function() - gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'stage git hunk' }) - map('v', 'hr', function() - gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'reset git hunk' }) - -- normal mode - map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) - map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) - map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() - gitsigns.diffthis '@' - end, { desc = 'git [D]iff against last commit' }) - -- Toggles - map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) - end, - }, - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, + -- Actions + -- visual mode + map('v', 'hs', function() + gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) + map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'hD', function() + gitsigns.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) + -- Toggles + map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + end, + }, + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, }, } diff --git a/.config/nvim/lua/custom/plugins/helm.lua b/.config/nvim/lua/custom/plugins/helm.lua index 5b006ea..dbf16e6 100644 --- a/.config/nvim/lua/custom/plugins/helm.lua +++ b/.config/nvim/lua/custom/plugins/helm.lua @@ -1,6 +1,4 @@ return { - { - 'towolf/vim-helm', - ft = 'helm', - }, + 'towolf/vim-helm', + ft = 'helm', } diff --git a/.config/nvim/lua/custom/plugins/icons.lua b/.config/nvim/lua/custom/plugins/icons.lua index 4a95ebb..71ea12c 100644 --- a/.config/nvim/lua/custom/plugins/icons.lua +++ b/.config/nvim/lua/custom/plugins/icons.lua @@ -1,17 +1,15 @@ return { - { - 'nvim-tree/nvim-web-devicons', - config = function() - require('nvim-web-devicons').setup { - override = { - php = { - icon = '', - color = '#a074c4', - cterm_color = '140', - name = 'Php', - }, + 'nvim-tree/nvim-web-devicons', + config = function() + require('nvim-web-devicons').setup { + override = { + php = { + icon = '', + color = '#a074c4', + cterm_color = '140', + name = 'Php', }, - } - end, - }, + }, + } + end, } diff --git a/.config/nvim/lua/custom/plugins/lint.lua b/.config/nvim/lua/custom/plugins/lint.lua index eabc07c..11c445d 100644 --- a/.config/nvim/lua/custom/plugins/lint.lua +++ b/.config/nvim/lua/custom/plugins/lint.lua @@ -1,54 +1,52 @@ return { - { -- Linting - 'mfussenegger/nvim-lint', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local lint = require 'lint' - lint.linters_by_ft = { - -- markdown = { 'markdownlint' }, - } + 'mfussenegger/nvim-lint', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local lint = require 'lint' + lint.linters_by_ft = { + -- markdown = { 'markdownlint' }, + } - -- To allow other plugins to add linters to require('lint').linters_by_ft, - -- instead set linters_by_ft like this: - -- lint.linters_by_ft = lint.linters_by_ft or {} - -- lint.linters_by_ft['markdown'] = { 'markdownlint' } - -- - -- However, note that this will enable a set of default linters, - -- which will cause errors unless these tools are available: - -- { - -- clojure = { "clj-kondo" }, - -- dockerfile = { "hadolint" }, - -- inko = { "inko" }, - -- janet = { "janet" }, - -- json = { "jsonlint" }, - -- markdown = { "vale" }, - -- rst = { "vale" }, - -- ruby = { "ruby" }, - -- terraform = { "tflint" }, - -- text = { "vale" } - -- } - -- - -- You can disable the default linters by setting their filetypes to nil: - -- lint.linters_by_ft['clojure'] = nil - -- lint.linters_by_ft['dockerfile'] = nil - -- lint.linters_by_ft['inko'] = nil - -- lint.linters_by_ft['janet'] = nil - -- lint.linters_by_ft['json'] = nil - -- lint.linters_by_ft['markdown'] = nil - -- lint.linters_by_ft['rst'] = nil - -- lint.linters_by_ft['ruby'] = nil - -- lint.linters_by_ft['terraform'] = nil - -- lint.linters_by_ft['text'] = nil + -- To allow other plugins to add linters to require('lint').linters_by_ft, + -- instead set linters_by_ft like this: + -- lint.linters_by_ft = lint.linters_by_ft or {} + -- lint.linters_by_ft['markdown'] = { 'markdownlint' } + -- + -- However, note that this will enable a set of default linters, + -- which will cause errors unless these tools are available: + -- { + -- clojure = { "clj-kondo" }, + -- dockerfile = { "hadolint" }, + -- inko = { "inko" }, + -- janet = { "janet" }, + -- json = { "jsonlint" }, + -- markdown = { "vale" }, + -- rst = { "vale" }, + -- ruby = { "ruby" }, + -- terraform = { "tflint" }, + -- text = { "vale" } + -- } + -- + -- You can disable the default linters by setting their filetypes to nil: + -- lint.linters_by_ft['clojure'] = nil + -- lint.linters_by_ft['dockerfile'] = nil + -- lint.linters_by_ft['inko'] = nil + -- lint.linters_by_ft['janet'] = nil + -- lint.linters_by_ft['json'] = nil + -- lint.linters_by_ft['markdown'] = nil + -- lint.linters_by_ft['rst'] = nil + -- lint.linters_by_ft['ruby'] = nil + -- lint.linters_by_ft['terraform'] = nil + -- lint.linters_by_ft['text'] = nil - -- Create autocommand which carries out the actual linting - -- on the specified events. - local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) - vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { - group = lint_augroup, - callback = function() - lint.try_lint() - end, - }) - end, - }, + -- Create autocommand which carries out the actual linting + -- on the specified events. + local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + end, } diff --git a/.config/nvim/lua/custom/plugins/lsp.lua b/.config/nvim/lua/custom/plugins/lsp.lua index 0cff704..1b0f455 100644 --- a/.config/nvim/lua/custom/plugins/lsp.lua +++ b/.config/nvim/lua/custom/plugins/lsp.lua @@ -1,229 +1,227 @@ return { - { - -- Main LSP Configuration - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - -- Mason must be loaded before its dependents so we need to set it up here. - -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { 'williamboman/mason.nvim', opts = {} }, -- NOTE: Must be loaded before dependants - 'williamboman/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', - - -- Useful status updates for LSP. - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, - - -- Allows extra capabilities provided by nvim-cmp - 'hrsh7th/cmp-nvim-lsp', - }, - config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- LSP stands for Language Server Protocol. It's a protocol that helps editors - -- and language tooling communicate in a standardized fashion. - -- - -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers - -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone - -- processes that communicate with some "client" - in this case, Neovim! - -- - -- LSP provides Neovim with features like: - -- - Go to definition - -- - Find references - -- - Autocompletion - -- - Symbol Search - -- - and more! - -- - -- Thus, Language Servers are external tools that must be installed separately from - -- Neovim. This is where `mason` and related plugins come into play. - -- - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` - - -- vim.filetype.add { - -- pattern = { - -- ['.*/%.github[%w/]+workflows[%w/]+.*%.ya?ml'] = 'yaml.github', + -- Main LSP Configuration + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + -- Mason must be loaded before its dependents so we need to set it up here. + -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` + { 'williamboman/mason.nvim', opts = {} }, -- NOTE: Must be loaded before dependants + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + + -- Useful status updates for LSP. + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, + + -- Allows extra capabilities provided by nvim-cmp + -- 'hrsh7th/cmp-nvim-lsp', + }, + config = function() + -- Brief aside: **What is LSP?** + -- + -- LSP is an initialism you've probably heard, but might not understand what it is. + -- + -- LSP stands for Language Server Protocol. It's a protocol that helps editors + -- and language tooling communicate in a standardized fashion. + -- + -- In general, you have a "server" which is some tool built to understand a particular + -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers + -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone + -- processes that communicate with some "client" - in this case, Neovim! + -- + -- LSP provides Neovim with features like: + -- - Go to definition + -- - Find references + -- - Autocompletion + -- - Symbol Search + -- - and more! + -- + -- Thus, Language Servers are external tools that must be installed separately from + -- Neovim. This is where `mason` and related plugins come into play. + -- + -- If you're wondering about lsp vs treesitter, you can check out the wonderfully + -- and elegantly composed help section, `:help lsp-vs-treesitter` + + -- vim.filetype.add { + -- pattern = { + -- ['.*/%.github[%w/]+workflows[%w/]+.*%.ya?ml'] = 'yaml.github', + -- }, + -- } + + -- This function gets run when an LSP attaches to a particular buffer. + -- That is to say, every time a new file is opened that is associated with + -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this + -- function will be executed to configure the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + -- map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- Find references for the word under your cursor. + -- map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + -- map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + -- map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + -- map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + -- map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('rn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } + end, + }) + end + + -- The following code creates a keymap to toggle inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) + + -- LSP servers and clients are able to communicate to each other what features they support. + -- By default, Neovim doesn't support everything that is in the LSP specification. + -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. + local capabilities = vim.lsp.protocol.make_client_capabilities() + -- capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local servers = { + bashls = {}, + -- gh_actions_ls = {}, + -- helm_ls = { + -- settings = { + -- ['helm-ls'] = { + -- yamlls = { + -- path = 'yaml-language-server', + -- }, + -- }, -- }, - -- } - - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), - callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end - - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - -- map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - - -- Find references for the word under your cursor. - -- map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - -- map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - -- map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - -- map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - -- map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('rn', vim.lsp.buf.rename, '[R]e[n]ame') - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) - - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - end, - }) - end - - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end - end, - }) - - -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) - - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { - bashls = {}, - -- gh_actions_ls = {}, - -- helm_ls = { - -- settings = { - -- ['helm-ls'] = { - -- yamlls = { - -- path = 'yaml-language-server', - -- }, - -- }, - -- }, - -- }, - -- @see https://luals.github.io/wiki/settings/ - lua_ls = { - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - diagnostics = { - globals = { 'snacks', 'vim' }, - }, - workspace = { - library = { '/Users/michaelpriscella/.local/share/nvim' }, - }, + -- }, + -- @see https://luals.github.io/wiki/settings/ + lua_ls = { + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + diagnostics = { + globals = { 'require', 'snacks', 'vim' }, + }, + workspace = { + library = { '/Users/michaelpriscella/.local/share/nvim' }, }, }, }, - shellcheck = {}, - terraformls = {}, - -- tflint = {}, - -- ts_ls = {}, - zls = {}, - } - - -- Ensure the servers and tools above are installed - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - -- - -- You can press `g?` for help in this menu. - -- require('mason').setup() - - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'prettierd', - 'stylua', -- Used to format Lua code - }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } - - require('mason-lspconfig').setup { - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } - end, - }, + }, + shellcheck = {}, + terraformls = {}, + -- tflint = {}, + -- ts_ls = {}, + zls = {}, + } + + -- Ensure the servers and tools above are installed + -- To check the current status of installed tools and/or manually install + -- other tools, you can run + -- :Mason + -- + -- You can press `g?` for help in this menu. + -- require('mason').setup() + + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'prettierd', + 'stylua', -- Used to format Lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + require('mason-lspconfig').setup { + handlers = { + function(server_name) + local server = servers[server_name] or {} + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for ts_ls) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + end, } diff --git a/.config/nvim/lua/custom/plugins/lualine.lua b/.config/nvim/lua/custom/plugins/lualine.lua index bd3fa26..d37ca64 100644 --- a/.config/nvim/lua/custom/plugins/lualine.lua +++ b/.config/nvim/lua/custom/plugins/lualine.lua @@ -1,12 +1,11 @@ return { - { - 'nvim-lualine/lualine.nvim', - dependencies = { 'nvim-tree/nvim-web-devicons' }, - config = function() - -- Eviline config for lualine - -- Author: shadmansaleh - -- Credit: glepnir - local lualine = require 'lualine' + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + -- Eviline config for lualine + -- Author: shadmansaleh + -- Credit: glepnir + local lualine = require 'lualine' -- Color table for highlights -- stylua: ignore @@ -24,213 +23,212 @@ return { red = '#ec5f67', } - local conditions = { - buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand '%:t') ~= 1 - end, - hide_in_width = function() - return vim.fn.winwidth(0) > 80 - end, - check_git_workspace = function() - local filepath = vim.fn.expand '%:p:h' - local gitdir = vim.fn.finddir('.git', filepath .. ';') - return gitdir and #gitdir > 0 and #gitdir < #filepath - end, - } - - -- Config - local config = { - options = { - -- Disable sections and component separators - component_separators = '', - section_separators = '', - theme = { - -- We are going to use lualine_c an lualine_x as left and - -- right section. Both are highlighted by c theme . So we - -- are just setting default looks o statusline - normal = { c = { fg = colors.fg, bg = colors.bg } }, - inactive = { c = { fg = colors.fg, bg = colors.bg } }, - }, - }, - sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - -- These will be filled later - lualine_c = {}, - lualine_x = {}, - }, - inactive_sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - lualine_c = {}, - lualine_x = {}, - }, - } - - -- Inserts a component in lualine_c at left section - local function ins_left(component) - table.insert(config.sections.lualine_c, component) - end - - -- Inserts a component in lualine_x at right section - local function ins_right(component) - table.insert(config.sections.lualine_x, component) - end - - ins_left { - function() - return '▊' - end, - color = { fg = colors.blue }, -- Sets highlighting of component - padding = { left = 0, right = 1 }, -- We don't need space before this - } - - ins_left { - -- mode component - function() - return '' - end, - color = function() - -- auto change color according to neovims mode - local mode_color = { - n = colors.red, - i = colors.green, - v = colors.blue, - [''] = colors.blue, - V = colors.blue, - c = colors.magenta, - no = colors.red, - s = colors.orange, - S = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - R = colors.violet, - Rv = colors.violet, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, - t = colors.red, - } - return { fg = mode_color[vim.fn.mode()] } - end, - padding = { right = 1 }, - } - - ins_left { - -- filesize component - 'filesize', - cond = conditions.buffer_not_empty, - } - - ins_left { - 'filename', - cond = conditions.buffer_not_empty, - color = { fg = colors.magenta, gui = 'bold' }, - path = 4, - } - - ins_left { 'location' } - - ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } - - ins_left { - 'diagnostics', - sources = { 'nvim_diagnostic' }, - symbols = { error = ' ', warn = ' ', info = ' ' }, - diagnostics_color = { - error = { fg = colors.red }, - warn = { fg = colors.yellow }, - info = { fg = colors.cyan }, + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand '%:t') ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand '%:p:h' + local gitdir = vim.fn.finddir('.git', filepath .. ';') + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + -- Config + local config = { + options = { + -- Disable sections and component separators + component_separators = '', + section_separators = '', + theme = { + -- We are going to use lualine_c an lualine_x as left and + -- right section. Both are highlighted by c theme . So we + -- are just setting default looks o statusline + normal = { c = { fg = colors.fg, bg = colors.bg } }, + inactive = { c = { fg = colors.fg, bg = colors.bg } }, }, - } - - -- Insert mid section. You can make any number of sections in neovim :) - -- for lualine it's any number greater then 2 - ins_left { - function() - return '%=' - end, - } - - ins_left { - 'filetype', - colored = true, -- Displays filetype icon in color if set to true - icons_enabled = false, -- { align = 'right' }, - } - - ins_left { - -- Lsp server name . - function() - local msg = 'No Active Lsp' - local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 }) - local clients = vim.lsp.get_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end + }, + sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + } + + -- Inserts a component in lualine_c at left section + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + -- Inserts a component in lualine_x at right section + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + ins_left { + function() + return '▊' + end, + color = { fg = colors.blue }, -- Sets highlighting of component + padding = { left = 0, right = 1 }, -- We don't need space before this + } + + ins_left { + -- mode component + function() + return '' + end, + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.red, + i = colors.green, + v = colors.blue, + [''] = colors.blue, + V = colors.blue, + c = colors.magenta, + no = colors.red, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.violet, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { right = 1 }, + } + + ins_left { + -- filesize component + 'filesize', + cond = conditions.buffer_not_empty, + } + + ins_left { + 'filename', + cond = conditions.buffer_not_empty, + color = { fg = colors.magenta, gui = 'bold' }, + path = 4, + } + + ins_left { 'location' } + + ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } + + ins_left { + 'diagnostics', + sources = { 'nvim_diagnostic' }, + symbols = { error = ' ', warn = ' ', info = ' ' }, + diagnostics_color = { + error = { fg = colors.red }, + warn = { fg = colors.yellow }, + info = { fg = colors.cyan }, + }, + } + + -- Insert mid section. You can make any number of sections in neovim :) + -- for lualine it's any number greater then 2 + ins_left { + function() + return '%=' + end, + } + + ins_left { + 'filetype', + colored = true, -- Displays filetype icon in color if set to true + icons_enabled = false, -- { align = 'right' }, + } + + ins_left { + -- Lsp server name . + function() + local msg = 'No Active Lsp' + local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 }) + local clients = vim.lsp.get_clients() + if next(clients) == nil then return msg - end, - icon = ' ', - color = { fg = '#ffffff', gui = 'bold' }, - } - - -- Add components to right sections - -- ins_right { - -- 'o:encoding', -- option component same as &encoding in viml - -- fmt = string.upper, -- I'm not sure why it's upper case either ;) - -- cond = conditions.hide_in_width, - -- color = { fg = colors.green, gui = 'bold' }, - -- } - - -- ins_right { - -- 'fileformat', - -- fmt = string.upper, - -- icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh - -- color = { fg = colors.green, gui = 'bold' }, - -- } - - ins_right { - 'branch', - icon = '', - color = { fg = colors.violet, gui = 'bold' }, - } - - ins_right { - 'diff', - -- Is it me or the symbol for modified us really weird - symbols = { added = ' ', modified = '󰝤 ', removed = ' ' }, - diff_color = { - added = { fg = colors.green }, - modified = { fg = colors.orange }, - removed = { fg = colors.red }, - }, - cond = conditions.hide_in_width, - } - - ins_right { - function() - return '▊' - end, - color = { fg = colors.blue }, - padding = { left = 1 }, - } - - -- Now don't forget to initialize lualine - lualine.setup(config) - end, - }, + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = ' ', + color = { fg = '#ffffff', gui = 'bold' }, + } + + -- Add components to right sections + -- ins_right { + -- 'o:encoding', -- option component same as &encoding in viml + -- fmt = string.upper, -- I'm not sure why it's upper case either ;) + -- cond = conditions.hide_in_width, + -- color = { fg = colors.green, gui = 'bold' }, + -- } + + -- ins_right { + -- 'fileformat', + -- fmt = string.upper, + -- icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh + -- color = { fg = colors.green, gui = 'bold' }, + -- } + + ins_right { + 'branch', + icon = '', + color = { fg = colors.violet, gui = 'bold' }, + } + + ins_right { + 'diff', + -- Is it me or the symbol for modified us really weird + symbols = { added = ' ', modified = '󰝤 ', removed = ' ' }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, + } + + ins_right { + function() + return '▊' + end, + color = { fg = colors.blue }, + padding = { left = 1 }, + } + + -- Now don't forget to initialize lualine + lualine.setup(config) + end, } diff --git a/.config/nvim/lua/custom/plugins/markdown.lua b/.config/nvim/lua/custom/plugins/markdown.lua index 4de3011..3ed4ef9 100644 --- a/.config/nvim/lua/custom/plugins/markdown.lua +++ b/.config/nvim/lua/custom/plugins/markdown.lua @@ -1,14 +1,12 @@ return { - { - 'OXY2DEV/markview.nvim', - lazy = false, - ---@type mkv.config - opts = { - preview = { - filetypes = { 'markdown', 'codecompanion' }, - ignore_buftypes = {}, - hybrid_modes = { 'i', 'n', 'v' }, - }, + 'OXY2DEV/markview.nvim', + lazy = false, + ---@type mkv.config + opts = { + preview = { + filetypes = { 'markdown', 'codecompanion' }, + ignore_buftypes = {}, + hybrid_modes = { 'i', 'n', 'v' }, }, }, } diff --git a/.config/nvim/lua/custom/plugins/noice.lua b/.config/nvim/lua/custom/plugins/noice.lua index e09b250..81c9fd0 100644 --- a/.config/nvim/lua/custom/plugins/noice.lua +++ b/.config/nvim/lua/custom/plugins/noice.lua @@ -1,54 +1,52 @@ return { - { - 'folke/noice.nvim', - dependencies = { - 'MunifTanjim/nui.nvim', - 'rcarriga/nvim-notify', + 'folke/noice.nvim', + dependencies = { + 'MunifTanjim/nui.nvim', + 'rcarriga/nvim-notify', + }, + event = 'VeryLazy', + opts = { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ['vim.lsp.util.convert_input_to_markdown_lines'] = true, + ['vim.lsp.util.stylize_markdown'] = true, + ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp + }, + }, + ---@class NoicePresets|{} + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help }, - event = 'VeryLazy', - opts = { - lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** - override = { - ['vim.lsp.util.convert_input_to_markdown_lines'] = true, - ['vim.lsp.util.stylize_markdown'] = true, - ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp + routes = { + { + filter = { + event = 'msg_show', + kind = '', + find = 'written', }, + opts = { skip = true }, }, - ---@class NoicePresets|{} - presets = { - bottom_search = true, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help - }, - routes = { - { - filter = { - event = 'msg_show', - kind = '', - find = 'written', - }, - opts = { skip = true }, - }, - { - filter = { - event = 'notify', - kind = 'info', - find = '[Neo-tree INFO]', - }, - opts = { skip = true }, + { + filter = { + event = 'notify', + kind = 'info', + find = '[Neo-tree INFO]', }, - -- Is there a way to filter by message title / source? - { - filter = { - event = 'notify', - kind = 'warn', - find = 'Config Change Detected.', - }, - opts = { skip = true }, + opts = { skip = true }, + }, + -- Is there a way to filter by message title / source? + { + filter = { + event = 'notify', + kind = 'warn', + find = 'Config Change Detected.', }, + opts = { skip = true }, }, }, }, diff --git a/.config/nvim/lua/custom/plugins/snacks.lua b/.config/nvim/lua/custom/plugins/snacks.lua index eabf0ba..0f91865 100644 --- a/.config/nvim/lua/custom/plugins/snacks.lua +++ b/.config/nvim/lua/custom/plugins/snacks.lua @@ -1,103 +1,103 @@ return { - { - -- @see https://github.com/folke/snacks.nvim - 'folke/snacks.nvim', - priority = 1000, - lazy = false, - ---@type snacks.Config - opts = { - ---@type snacks.dashboard.Config|{} - dashboard = { enabled = true }, - ---@type snacks.explorer.Config|{} - explorer = { - enabled = true, - replace_netrw = true, - }, - ---@type snacks.indent.Config|{} - indent = { enabled = true }, - ---@type snacks.input.Config|{} - input = { enabled = true }, - ---@type snacks.lazygit.Config|{} - lazygit = { enabled = true }, - ---@type snacks.picker.Config|{} - picker = { - -- Is there a way to automatically close all other pickers when opening - -- a new one? - enabled = true, - sources = { - ---@type snacks.picker.explorer.Config|{} - explorer = { - auto_close = true, - git_status_open = true, - hidden = true, - ignored = true, - layout = { layout = { position = 'right' } }, - }, + -- @see https://github.com/folke/snacks.nvim + 'folke/snacks.nvim', + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + ---@type snacks.dashboard.Config|{} + dashboard = { enabled = true }, + ---@type snacks.explorer.Config|{} + explorer = { + enabled = true, + replace_netrw = true, + }, + ---@type snacks.indent.Config|{} + indent = { enabled = true }, + ---@type snacks.input.Config|{} + input = { enabled = true }, + ---@type snacks.lazygit.Config|{} + lazygit = { enabled = true }, + ---@type snacks.picker.Config|{} + picker = { + enabled = true, + sources = { + ---@type snacks.picker.explorer.Config|{} + explorer = { + auto_close = true, + git_status_open = true, + hidden = true, + ignored = true, + layout = { layout = { position = 'right' } }, + }, + ---@type snacks.picker.grep.Config|{} + grep = { + hidden = true, }, }, - ---@type snacks.notifier.Config|{} - notifier = { - enabled = true, - }, - ---@type snacks.quickfile.Config|{} - quickfile = { enabled = true }, - ---@type snacks.statuscolumn.Config|{} - statuscolumn = { enabled = true }, - ---@type snacks.words.Config|{} - words = { enabled = true }, }, - keys = { - { - 'gd', - function() - Snacks.picker.lsp_definitions() - end, - desc = '[G]oto [D]efinition', - }, - { - 'sb', - function() - Snacks.picker.buffers() - end, - desc = '[S]earch [B]uffers', - }, - { - 'sf', - function() - Snacks.picker.files { - hidden = true, - } - end, - desc = '[S]earch [F]iles', - }, - { - 'sg', - function() - Snacks.picker.grep() - end, - desc = '[S]earch [G]rep', - }, - { - 'sh', - function() - Snacks.picker.help() - end, - desc = '[S]earch [H]elp', - }, - { - 'lg', - function() - Snacks.lazygit() - end, - desc = 'Toggle Lazygit', - }, - { - '\\', - function() - Snacks.explorer() - end, - desc = 'Toggle Explorer', - }, + ---@type snacks.notifier.Config|{} + notifier = { + enabled = true, + }, + ---@type snacks.quickfile.Config|{} + quickfile = { enabled = true }, + ---@type snacks.statuscolumn.Config|{} + statuscolumn = { enabled = true }, + ---@type snacks.words.Config|{} + words = { enabled = true }, + }, + keys = { + { + 'gd', + function() + Snacks.picker.lsp_definitions() + end, + desc = '[G]oto [D]efinition', + }, + { + 'sb', + function() + Snacks.picker.buffers() + end, + desc = '[S]earch [B]uffers', + }, + { + 'sf', + function() + Snacks.picker.files { + hidden = true, + } + end, + desc = '[S]earch [F]iles', + }, + { + 'sg', + function() + Snacks.picker.grep() + end, + desc = '[S]earch [G]rep', + }, + { + 'sh', + function() + Snacks.picker.help() + end, + desc = '[S]earch [H]elp', + }, + { + 'lg', + function() + Snacks.lazygit() + end, + desc = 'Toggle Lazygit', + }, + { + '\\', + function() + Snacks.explorer() + end, + desc = 'Toggle Explorer', }, }, } diff --git a/.config/nvim/lua/custom/plugins/surround.lua b/.config/nvim/lua/custom/plugins/surround.lua index c3a9669..e32286c 100644 --- a/.config/nvim/lua/custom/plugins/surround.lua +++ b/.config/nvim/lua/custom/plugins/surround.lua @@ -1,12 +1,10 @@ return { - { - 'kylechui/nvim-surround', - version = '*', -- Use for stability; omit to use `main` branch for the latest features - event = 'VeryLazy', - config = function() - require('nvim-surround').setup { - -- Configuration here, or leave empty to use defaults - } - end, - }, + 'kylechui/nvim-surround', + version = '*', -- Use for stability; omit to use `main` branch for the latest features + event = 'VeryLazy', + config = function() + require('nvim-surround').setup { + -- Configuration here, or leave empty to use defaults + } + end, } diff --git a/.config/nvim/lua/custom/plugins/terminal.lua b/.config/nvim/lua/custom/plugins/terminal.lua index ed69124..79275a0 100644 --- a/.config/nvim/lua/custom/plugins/terminal.lua +++ b/.config/nvim/lua/custom/plugins/terminal.lua @@ -3,62 +3,60 @@ local size = 18 return { - { - 'akinsho/toggleterm.nvim', - version = 'v2.13.0', - opts = { - autochdir = true, - open_mapping = [[st]], - size = size, - }, - init = function() - vim.keymap.set('t', 'x', function() - -- This functionality may be good to extract into a separate plugin. - local current_size = vim.fn.winheight(0) - if current_size > size then - vim.cmd(string.format('resize %s', size)) - else - vim.cmd 'resize 100' - end - end, { desc = 'Toggle Maximized Terminal' }) + 'akinsho/toggleterm.nvim', + version = 'v2.13.0', + opts = { + autochdir = true, + open_mapping = [[st]], + size = size, + }, + init = function() + vim.keymap.set('t', 'x', function() + -- This functionality may be good to extract into a separate plugin. + local current_size = vim.fn.winheight(0) + if current_size > size then + vim.cmd(string.format('resize %s', size)) + else + vim.cmd 'resize 100' + end + end, { desc = 'Toggle Maximized Terminal' }) - vim.keymap.set('t', '', '', { desc = 'Move focus up' }) + vim.keymap.set('t', '', '', { desc = 'Move focus up' }) - -- K9s -- Should definitely be its own plugin. - local Terminal = require('toggleterm.terminal').Terminal - local mode = require('toggleterm.terminal').mode + -- K9s -- Should definitely be its own plugin. + local Terminal = require('toggleterm.terminal').Terminal + local mode = require('toggleterm.terminal').mode - local k9s = Terminal:new { - cmd = 'k9s', - hidden = true, - direction = 'float', - } + local k9s = Terminal:new { + cmd = 'k9s', + hidden = true, + direction = 'float', + } - -- How to make this a local variable? Or do I create a module? M = {} and whatever. - function k9s_toggle() - k9s:toggle() - if k9s:is_open() then - k9s:set_mode(mode.INSERT) - end + -- How to make this a local variable? Or do I create a module? M = {} and whatever. + function k9s_toggle() + k9s:toggle() + if k9s:is_open() then + k9s:set_mode(mode.INSERT) end + end - vim.keymap.set({ 'n', 't' }, '9', 'lua k9s_toggle()', { desc = 'Toggle K9s' }) + vim.keymap.set({ 'n', 't' }, '9', 'lua k9s_toggle()', { desc = 'Toggle K9s' }) - -- htop - local htop = Terminal:new { - cmd = 'htop', - hidden = true, - direction = 'float', - } + -- htop + local htop = Terminal:new { + cmd = 'htop', + hidden = true, + direction = 'float', + } - function htop_toggle() - htop:toggle() - if htop:is_open() then - htop:set_mode(mode.INSERT) - end + function htop_toggle() + htop:toggle() + if htop:is_open() then + htop:set_mode(mode.INSERT) end + end - vim.keymap.set({ 'n', 't' }, 'ht', 'lua htop_toggle()', { desc = 'Toggle Htop' }) - end, - }, + vim.keymap.set({ 'n', 't' }, 'ht', 'lua htop_toggle()', { desc = 'Toggle Htop' }) + end, } diff --git a/.config/nvim/lua/custom/plugins/todo-comments.lua b/.config/nvim/lua/custom/plugins/todo-comments.lua index 34ddb5c..ae041b0 100644 --- a/.config/nvim/lua/custom/plugins/todo-comments.lua +++ b/.config/nvim/lua/custom/plugins/todo-comments.lua @@ -1,7 +1,5 @@ return { - { - 'folke/todo-comments.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, - opts = {}, - }, + 'folke/todo-comments.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = {}, } diff --git a/.config/nvim/lua/custom/plugins/tokyonight.lua b/.config/nvim/lua/custom/plugins/tokyonight.lua index e57793c..e483e2d 100644 --- a/.config/nvim/lua/custom/plugins/tokyonight.lua +++ b/.config/nvim/lua/custom/plugins/tokyonight.lua @@ -1,16 +1,14 @@ return { - { - 'folke/tokyonight.nvim', - priority = 1000, - lazy = false, - opts = { - style = 'night', - on_colors = function(colors) - colors.border = 'orange' - end, - }, - init = function() - vim.cmd.colorscheme 'tokyonight-night' + 'folke/tokyonight.nvim', + priority = 1000, + lazy = false, + opts = { + style = 'night', + on_colors = function(colors) + colors.border = 'orange' end, }, + init = function() + vim.cmd.colorscheme 'tokyonight-night' + end, } diff --git a/.config/nvim/lua/custom/plugins/treesitter.lua b/.config/nvim/lua/custom/plugins/treesitter.lua index 75f1aa7..f5852c9 100644 --- a/.config/nvim/lua/custom/plugins/treesitter.lua +++ b/.config/nvim/lua/custom/plugins/treesitter.lua @@ -1,49 +1,47 @@ --- Highlight, edit, and navigate code return { - { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { - 'bash', - 'c', - 'diff', - 'html', - 'jsonc', - 'lua', - 'luadoc', - 'markdown', - 'markdown_inline', - 'query', - 'terraform', - 'zig', - 'vim', - 'vimdoc', - }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - -- additional_vim_regex_highlighting = { 'ruby' }, - }, - -- indent = { enable = true, disable = { 'ruby' } }, - indent = { enable = true }, + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + main = 'nvim-treesitter.configs', -- Sets main module to use for opts + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + opts = { + ensure_installed = { + 'bash', + 'c', + 'diff', + 'html', + 'http', + 'jsonc', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'terraform', + 'zig', + 'vim', + 'vimdoc', }, - config = function() - vim.opt.foldmethod = 'expr' - vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' - vim.opt.foldlevelstart = 99 - end, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + -- additional_vim_regex_highlighting = { 'ruby' }, + }, + -- indent = { enable = true, disable = { 'ruby' } }, + indent = { enable = true }, }, + config = function() + vim.opt.foldmethod = 'expr' + vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' + vim.opt.foldlevelstart = 99 + end, + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects } diff --git a/.config/nvim/lua/custom/plugins/trouble.lua b/.config/nvim/lua/custom/plugins/trouble.lua index 5f42998..40087b3 100644 --- a/.config/nvim/lua/custom/plugins/trouble.lua +++ b/.config/nvim/lua/custom/plugins/trouble.lua @@ -1,39 +1,37 @@ return { - { - 'folke/trouble.nvim', - opts = {}, - cmd = 'Trouble', - keys = { - { - 'xx', - 'Trouble diagnostics toggle', - desc = 'Diagnostics (Trouble)', - }, - { - 'xX', - 'Trouble diagnostics toggle filter.buf=0', - desc = 'Buffer Diagnostics (Trouble)', - }, - { - 'cs', - 'Trouble symbols toggle focus=false', - desc = 'Symbols (Trouble)', - }, - { - 'cl', - 'Trouble lsp toggle focus=false win.position=right', - desc = 'LSP Definitions / references / ... (Trouble)', - }, - { - 'xL', - 'Trouble loclist toggle', - desc = 'Location List (Trouble)', - }, - { - 'xQ', - 'Trouble qflist toggle', - desc = 'Quickfix List (Trouble)', - }, + 'folke/trouble.nvim', + opts = {}, + cmd = 'Trouble', + keys = { + { + 'xx', + 'Trouble diagnostics toggle', + desc = 'Diagnostics (Trouble)', + }, + { + 'xX', + 'Trouble diagnostics toggle filter.buf=0', + desc = 'Buffer Diagnostics (Trouble)', + }, + { + 'cs', + 'Trouble symbols toggle focus=false', + desc = 'Symbols (Trouble)', + }, + { + 'cl', + 'Trouble lsp toggle focus=false win.position=right', + desc = 'LSP Definitions / references / ... (Trouble)', + }, + { + 'xL', + 'Trouble loclist toggle', + desc = 'Location List (Trouble)', + }, + { + 'xQ', + 'Trouble qflist toggle', + desc = 'Quickfix List (Trouble)', }, }, } diff --git a/.config/nvim/lua/custom/plugins/which-key.lua b/.config/nvim/lua/custom/plugins/which-key.lua index f765edf..df30d21 100644 --- a/.config/nvim/lua/custom/plugins/which-key.lua +++ b/.config/nvim/lua/custom/plugins/which-key.lua @@ -1,56 +1,53 @@ --- Useful plugin to show you pending keybinds. return { - { - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - opts = { - icons = { - -- set icon mappings to true if you have a Nerd Font - mappings = vim.g.have_nerd_font, - -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { - Up = ' ', - Down = ' ', - Left = ' ', - Right = ' ', - C = ' ', - M = ' ', - D = ' ', - S = ' ', - CR = ' ', - Esc = ' ', - ScrollWheelDown = ' ', - ScrollWheelUp = ' ', - NL = ' ', - BS = ' ', - Space = ' ', - Tab = ' ', - F1 = '', - F2 = '', - F3 = '', - F4 = '', - F5 = '', - F6 = '', - F7 = '', - F8 = '', - F9 = '', - F10 = '', - F11 = '', - F12 = '', - }, + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + opts = { + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', }, + }, - -- Document existing key chains - spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]ocument' }, - { 'r', group = '[R]ename' }, - { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, - { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - }, + -- Document existing key chains + spec = { + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, }, } From bf7714d04bc4a4c7dededf9f39f364e0b819dad3 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Mon, 31 Mar 2025 00:58:37 -0400 Subject: [PATCH 19/42] Updates to plugins --- .config/nvim/lazy-lock.json | 15 ++-- .../lua/custom/plugins/autocompletion.lua | 6 -- .../nvim/lua/custom/plugins/codecompanion.lua | 10 +++ .config/nvim/lua/custom/plugins/copilot.lua | 3 + .config/nvim/lua/custom/plugins/lsp.lua | 13 ++- .config/nvim/lua/custom/plugins/snacks.lua | 1 - .../nvim/lua/custom/plugins/treesitter.lua | 80 +++++++++---------- .config/nvim/lua/custom/plugins/which-key.lua | 5 +- 8 files changed, 66 insertions(+), 67 deletions(-) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 8624031..ad9a9d6 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,17 +1,17 @@ { "blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" }, - "codecompanion.nvim": { "branch": "main", "commit": "51fe5a782dbbd5cad8189420cb8d38fd7c245684" }, + "codecompanion.nvim": { "branch": "main", "commit": "fc9509884b23adbd26938611d6ba53464b7c8d0c" }, "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "conform.nvim": { "branch": "master", "commit": "f9ef25a7ef00267b7d13bfc00b0dea22d78702d5" }, + "conform.nvim": { "branch": "master", "commit": "9e434d78751dcdcaef048b62555914ed4a2b7b61" }, "copilot.vim": { "branch": "release", "commit": "a9228e015528c9307890c48083c925eb98a64a79" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "gitsigns.nvim": { "branch": "main", "commit": "3c76f7fabac723aa682365ef782f88a83ccdb4ac" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, - "markview.nvim": { "branch": "main", "commit": "556cac8bb8eeb461013ebe0d015e2c48d3527c36" }, + "markview.nvim": { "branch": "main", "commit": "795382867430559f4b776ebf378ca632965f23ff" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "ea387e0819ab189d536bb4067e4d8ece3801a292" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "98767d37f8e5255a5111fc1e3163232d4dc07bda" }, @@ -19,15 +19,16 @@ "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, "nvim-autopairs": { "branch": "master", "commit": "6522027785b305269fa17088395dfc0f456cedd2" }, - "nvim-dap": { "branch": "master", "commit": "2d1bd2b6bd0f366a531b6d5b0f8a955d804c918a" }, + "nvim-dap": { "branch": "master", "commit": "7aade9e99bef5f0735cf966e715b3ce45515d786" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, "nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" }, - "nvim-lspconfig": { "branch": "master", "commit": "85e0dd26b710e834a105d679200d01e326a3d2b0" }, + "nvim-lspconfig": { "branch": "master", "commit": "ff6471d4f837354d8257dfa326b031dd8858b16e" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, "nvim-surround": { "branch": "main", "commit": "caf6f633d4d77a29b6e265b560c5a035d171a913" }, - "nvim-treesitter": { "branch": "master", "commit": "da5825bf70cc2ea7eacd1e60c32c07baf19adeba" }, + "nvim-treesitter": { "branch": "master", "commit": "9df671fda41bc4af91b9f7ea3fa1628ba988a77b" }, + "nvim-treesitter-context": { "branch": "master", "commit": "93b29a32d5f4be10e39226c6b796f28d68a8b483" }, "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, diff --git a/.config/nvim/lua/custom/plugins/autocompletion.lua b/.config/nvim/lua/custom/plugins/autocompletion.lua index 5ae253c..025986d 100644 --- a/.config/nvim/lua/custom/plugins/autocompletion.lua +++ b/.config/nvim/lua/custom/plugins/autocompletion.lua @@ -1,14 +1,8 @@ return { 'saghen/blink.cmp', - -- optional: provides snippets for the snippet source dependencies = { 'rafamadriz/friendly-snippets' }, - -- use a release tag to download pre-built binaries version = '1.*', - -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust - -- build = 'cargo build --release', - -- If you use nix, you can build from source using latest nightly rust with: - -- build = 'nix run .#build-plugin', ---@module 'blink.cmp' ---@type blink.cmp.Config diff --git a/.config/nvim/lua/custom/plugins/codecompanion.lua b/.config/nvim/lua/custom/plugins/codecompanion.lua index e143dce..2417d8a 100644 --- a/.config/nvim/lua/custom/plugins/codecompanion.lua +++ b/.config/nvim/lua/custom/plugins/codecompanion.lua @@ -5,6 +5,16 @@ return { 'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter', }, + opts = { + strategies = { + chat = { + adapter = 'githubmodels', + }, + inline = { + adapter = 'copilot', + }, + }, + }, keys = { { '', diff --git a/.config/nvim/lua/custom/plugins/copilot.lua b/.config/nvim/lua/custom/plugins/copilot.lua index e23e05c..35e07b6 100644 --- a/.config/nvim/lua/custom/plugins/copilot.lua +++ b/.config/nvim/lua/custom/plugins/copilot.lua @@ -1,6 +1,9 @@ return { 'github/copilot.vim', config = function() + vim.g.copilot_filetypes = { + ['codecompanion'] = false, + } vim.g.copilot_settings = { selectedCompletionModel = 'gpt-4o-copilot' } end, } diff --git a/.config/nvim/lua/custom/plugins/lsp.lua b/.config/nvim/lua/custom/plugins/lsp.lua index 1b0f455..997efa9 100644 --- a/.config/nvim/lua/custom/plugins/lsp.lua +++ b/.config/nvim/lua/custom/plugins/lsp.lua @@ -1,16 +1,13 @@ return { - -- Main LSP Configuration 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. - -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` { 'williamboman/mason.nvim', opts = {} }, -- NOTE: Must be loaded before dependants 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, -- Allows extra capabilities provided by nvim-cmp @@ -42,11 +39,11 @@ return { -- If you're wondering about lsp vs treesitter, you can check out the wonderfully -- and elegantly composed help section, `:help lsp-vs-treesitter` - -- vim.filetype.add { - -- pattern = { - -- ['.*/%.github[%w/]+workflows[%w/]+.*%.ya?ml'] = 'yaml.github', - -- }, - -- } + vim.filetype.add { + pattern = { + ['.*/%.github[%w/]+workflows[%w/]+.*%.ya?ml'] = 'yaml.github', + }, + } -- This function gets run when an LSP attaches to a particular buffer. -- That is to say, every time a new file is opened that is associated with diff --git a/.config/nvim/lua/custom/plugins/snacks.lua b/.config/nvim/lua/custom/plugins/snacks.lua index 0f91865..d01eb2c 100644 --- a/.config/nvim/lua/custom/plugins/snacks.lua +++ b/.config/nvim/lua/custom/plugins/snacks.lua @@ -24,7 +24,6 @@ return { sources = { ---@type snacks.picker.explorer.Config|{} explorer = { - auto_close = true, git_status_open = true, hidden = true, ignored = true, diff --git a/.config/nvim/lua/custom/plugins/treesitter.lua b/.config/nvim/lua/custom/plugins/treesitter.lua index f5852c9..197b908 100644 --- a/.config/nvim/lua/custom/plugins/treesitter.lua +++ b/.config/nvim/lua/custom/plugins/treesitter.lua @@ -1,47 +1,41 @@ return { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { - 'bash', - 'c', - 'diff', - 'html', - 'http', - 'jsonc', - 'lua', - 'luadoc', - 'markdown', - 'markdown_inline', - 'query', - 'terraform', - 'zig', - 'vim', - 'vimdoc', + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + main = 'nvim-treesitter.configs', + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + opts = { + ensure_installed = { + 'bash', + 'c', + 'diff', + 'html', + 'http', + 'jsonc', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'terraform', + 'zig', + 'vim', + 'vimdoc', + }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + }, + indent = { enable = true }, }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - -- additional_vim_regex_highlighting = { 'ruby' }, - }, - -- indent = { enable = true, disable = { 'ruby' } }, - indent = { enable = true }, + config = function() + vim.opt.foldmethod = 'expr' + vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' + vim.opt.foldlevelstart = 99 + end, + }, + { + 'nvim-treesitter/nvim-treesitter-context', }, - config = function() - vim.opt.foldmethod = 'expr' - vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' - vim.opt.foldlevelstart = 99 - end, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects } diff --git a/.config/nvim/lua/custom/plugins/which-key.lua b/.config/nvim/lua/custom/plugins/which-key.lua index df30d21..2391721 100644 --- a/.config/nvim/lua/custom/plugins/which-key.lua +++ b/.config/nvim/lua/custom/plugins/which-key.lua @@ -1,9 +1,9 @@ return { 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' + event = 'VimEnter', opts = { + ---@class wk.Opts icons = { - -- set icon mappings to true if you have a Nerd Font mappings = vim.g.have_nerd_font, -- If you are using a Nerd Font: set icons.keys to an empty table which will use the -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table @@ -40,6 +40,7 @@ return { }, -- Document existing key chains + ---@type wk.Spec spec = { { 'c', group = '[C]ode', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, From 8633c2ce214b783e12377a2f5964eecfc42c4fa8 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Mon, 19 May 2025 00:54:24 -0400 Subject: [PATCH 20/42] Modify k9s plugin --- .config/k9s/plugins.yaml | 2 +- shell.nix | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.config/k9s/plugins.yaml b/.config/k9s/plugins.yaml index 8f2e597..d401e84 100644 --- a/.config/k9s/plugins.yaml +++ b/.config/k9s/plugins.yaml @@ -2,7 +2,7 @@ plugins: # Create debug container for selected pod in current namespace. # See https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/#ephemeral-container debug-container: - shortCut: Shift-D + shortCut: d description: Add debug container dangerous: true scopes: diff --git a/shell.nix b/shell.nix index 2331667..9d3fd10 100644 --- a/shell.nix +++ b/shell.nix @@ -1,11 +1,14 @@ let - nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz"; - pkgs = import nixpkgs { config = {}; overlays = []; }; + pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/c16a6c8efedb65e10d565633e3f45f73bbbdf8ab.tar.gz") { + config = { + allowUnfree = true; + }; + overlays = []; + }; in - -pkgs.mkShellNoCC { - packages = with pkgs; [ - gh - shellcheck - ]; -} + pkgs.mkShellNoCC { + buildInputs = [ + pkgs.gh + pkgs.shellcheck + ]; + } From 509fe3af40867990703a92ed8340d763555ea240 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Mon, 19 May 2025 01:11:36 -0400 Subject: [PATCH 21/42] Committing fish config --- .config/fish/config.fish | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 00ab3bb..9ccd5f6 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -1,18 +1,25 @@ if status is-interactive # Commands to run in interactive sessions can go here - set PATH /opt/homebrew/bin:$PATH - # Maybe check if atuin exists first. - atuin init fish | source + # Set up Homebrew. + set --global --export HOMEBREW_PREFIX "/opt/homebrew"; + set --global --export HOMEBREW_CELLAR "/opt/homebrew/Cellar"; + set --global --export HOMEBREW_REPOSITORY "/opt/homebrew"; + fish_add_path --global --move --path "/opt/homebrew/bin" "/opt/homebrew/sbin"; + if test -n "$MANPATH[1]"; set --global --export MANPATH '' $MANPATH; end; + if not contains "/opt/homebrew/share/info" $INFOPATH; set --global --export INFOPATH "/opt/homebrew/share/info" $INFOPATH; end; + + if type -q atuin; then + atuin init fish | source + end end set pure_enable_k8s true set pure_show_system_time true set pure_enable_nixdevshell true -set -x NIXPKGS_ALLOW_UNFREE 1 -set -x TF_PLUGIN_CACHE_DIR "$HOME/.terraform.d/plugin-cache" - -# Load direnv hook for fish. -# https://direnv.net/docs/hook.html. -direnv hook fish | source +if type -q direnv; then + # Load direnv hook for fish. + # https://direnv.net/docs/hook.html. + direnv hook fish | source +end From 84f94e895be3f74789a94ad4573b348d4fae8bec Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Mon, 19 May 2025 01:12:03 -0400 Subject: [PATCH 22/42] Update ghostty config --- .config/ghostty/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/ghostty/config b/.config/ghostty/config index f03883c..1acd011 100644 --- a/.config/ghostty/config +++ b/.config/ghostty/config @@ -8,4 +8,4 @@ command = /opt/homebrew/bin/fish theme = tokyonight working-directory = home quit-after-last-window-closed = true - +window-inherit-working-directory = false From 2a5c07b81ae14a0a58a028be60f6a702f2e789fa Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Mon, 19 May 2025 01:13:22 -0400 Subject: [PATCH 23/42] Commit plugin changes --- .config/nvim/lazy-lock.json | 57 ++++++++++------- .config/nvim/lua/custom/plugins/avante.lua | 59 ++++++++++++++++++ .../nvim/lua/custom/plugins/codecompanion.lua | 38 ------------ .config/nvim/lua/custom/plugins/copilot.lua | 3 + .config/nvim/lua/custom/plugins/hardline.lua | 6 ++ .config/nvim/lua/custom/plugins/lsp.lua | 1 + .config/nvim/lua/custom/plugins/markdown.lua | 12 ---- .config/nvim/lua/custom/plugins/which-key.lua | 62 ++++++++++--------- 8 files changed, 134 insertions(+), 104 deletions(-) create mode 100644 .config/nvim/lua/custom/plugins/avante.lua delete mode 100644 .config/nvim/lua/custom/plugins/codecompanion.lua create mode 100644 .config/nvim/lua/custom/plugins/hardline.lua delete mode 100644 .config/nvim/lua/custom/plugins/markdown.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index ad9a9d6..ab31c7e 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,37 +1,46 @@ { - "blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" }, - "codecompanion.nvim": { "branch": "main", "commit": "fc9509884b23adbd26938611d6ba53464b7c8d0c" }, - "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "conform.nvim": { "branch": "master", "commit": "9e434d78751dcdcaef048b62555914ed4a2b7b61" }, - "copilot.vim": { "branch": "release", "commit": "a9228e015528c9307890c48083c925eb98a64a79" }, + "avante.nvim": { "branch": "main", "commit": "e98bb8d3bae102662c5ad4ada1ce63a9aacac4e0" }, + "blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" }, + "codesnap.nvim": { "branch": "main", "commit": "be6d6b9a3b5e6999edbda76b16dace03d9bfcd3d" }, + "conform.nvim": { "branch": "master", "commit": "a4bb5d6c4ae6f32ab13114e62e70669fa67745b9" }, + "copilot.lua": { "branch": "master", "commit": "0929c92097a49b6ae3565aab157fa2bce398d953" }, + "copilot.vim": { "branch": "release", "commit": "d1e8429bef7f7709586886b0a23a46fbecc685c4" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, - "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "3c76f7fabac723aa682365ef782f88a83ccdb4ac" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "fzf-lua": { "branch": "main", "commit": "66e620a7a724364809e78a1ae4b5bfe73e37df49" }, + "gitsigns.nvim": { "branch": "main", "commit": "39e0d1cd44eafed5f30c372e377ab1cb1781ec9f" }, + "hardtime.nvim": { "branch": "main", "commit": "882e62292ac9fc0ab764253a16d9387ed995ad94" }, + "img-clip.nvim": { "branch": "main", "commit": "08a02e14c8c0d42fa7a92c30a98fd04d6993b35d" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" }, + "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, - "markview.nvim": { "branch": "main", "commit": "795382867430559f4b776ebf378ca632965f23ff" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "ea387e0819ab189d536bb4067e4d8ece3801a292" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "98767d37f8e5255a5111fc1e3163232d4dc07bda" }, - "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" }, + "mason.nvim": { "branch": "main", "commit": "888d6ee499d8089a3a4be4309d239d6be1c1e6c0" }, + "mini.pick": { "branch": "main", "commit": "fa1e449e1080bf7aa9b2890ee186d23b1b4e1287" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, - "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, - "nvim-autopairs": { "branch": "master", "commit": "6522027785b305269fa17088395dfc0f456cedd2" }, - "nvim-dap": { "branch": "master", "commit": "7aade9e99bef5f0735cf966e715b3ce45515d786" }, + "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, - "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, - "nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" }, - "nvim-lspconfig": { "branch": "master", "commit": "ff6471d4f837354d8257dfa326b031dd8858b16e" }, + "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, + "nvim-lint": { "branch": "master", "commit": "fdb04e9285edefbe25a02a31a35e8fbb10fe054d" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, - "nvim-surround": { "branch": "main", "commit": "caf6f633d4d77a29b6e265b560c5a035d171a913" }, - "nvim-treesitter": { "branch": "master", "commit": "9df671fda41bc4af91b9f7ea3fa1628ba988a77b" }, - "nvim-treesitter-context": { "branch": "master", "commit": "93b29a32d5f4be10e39226c6b796f28d68a8b483" }, - "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, + "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, + "nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" }, + "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, + "nvim-treesitter-context": { "branch": "master", "commit": "5c48b8ba1b0b7b25feb6e34e7eb293ea893aedc4" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "overseer.nvim": { "branch": "master", "commit": "72c68aab0358c92f451168b704c411c4a3e3410e" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "render-markdown.nvim": { "branch": "main", "commit": "a1b0988f5ab26698afb56b9c2f0525a4de1195c1" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, diff --git a/.config/nvim/lua/custom/plugins/avante.lua b/.config/nvim/lua/custom/plugins/avante.lua new file mode 100644 index 0000000..1eb59b0 --- /dev/null +++ b/.config/nvim/lua/custom/plugins/avante.lua @@ -0,0 +1,59 @@ +return { + 'yetone/avante.nvim', + event = 'VeryLazy', + version = false, -- Never set this value to "*"! Never! + opts = { + -- add any opts here + -- for example + provider = 'openai', + openai = { + endpoint = 'https://api.openai.com/v1', + model = 'gpt-4o', -- your desired model (or use gpt-4o, etc.) + timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models + temperature = 0, + max_completion_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models) + --reasoning_effort = "medium", -- low|medium|high, only used for reasoning models + }, + }, + -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` + build = 'make', + -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'stevearc/dressing.nvim', + 'nvim-lua/plenary.nvim', + 'MunifTanjim/nui.nvim', + --- The below dependencies are optional, + 'echasnovski/mini.pick', -- for file_selector provider mini.pick + 'nvim-telescope/telescope.nvim', -- for file_selector provider telescope + 'hrsh7th/nvim-cmp', -- autocompletion for avante commands and mentions + 'ibhagwan/fzf-lua', -- for file_selector provider fzf + 'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons + 'zbirenbaum/copilot.lua', -- for providers='copilot' + { + -- support for image pasting + 'HakonHarnes/img-clip.nvim', + event = 'VeryLazy', + opts = { + -- recommended settings + default = { + embed_image_as_base64 = false, + prompt_for_file_name = false, + drag_and_drop = { + insert_mode = true, + }, + -- required for Windows users + use_absolute_path = true, + }, + }, + }, + { + -- Make sure to set this up properly if you have lazy=true + 'MeanderingProgrammer/render-markdown.nvim', + opts = { + file_types = { 'markdown', 'Avante' }, + }, + ft = { 'markdown', 'Avante' }, + }, + }, +} diff --git a/.config/nvim/lua/custom/plugins/codecompanion.lua b/.config/nvim/lua/custom/plugins/codecompanion.lua deleted file mode 100644 index 2417d8a..0000000 --- a/.config/nvim/lua/custom/plugins/codecompanion.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - 'olimorris/codecompanion.nvim', - config = true, - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-treesitter/nvim-treesitter', - }, - opts = { - strategies = { - chat = { - adapter = 'githubmodels', - }, - inline = { - adapter = 'copilot', - }, - }, - }, - keys = { - { - '', - 'CodeCompanionActions', - desc = 'CodeCompanion [A]ctions', - mode = { 'n', 'v' }, - }, - { - 'a', - 'CodeCompanionChat Toggle', - desc = 'CodeCompanion Chat Toggle', - mode = { 'n', 'v' }, - }, - { - 'ga', - 'CodeCompanionChat Add', - desc = 'CodeCompanion Chat Add', - mode = 'v', - }, - }, -} diff --git a/.config/nvim/lua/custom/plugins/copilot.lua b/.config/nvim/lua/custom/plugins/copilot.lua index 35e07b6..c4a31de 100644 --- a/.config/nvim/lua/custom/plugins/copilot.lua +++ b/.config/nvim/lua/custom/plugins/copilot.lua @@ -3,6 +3,9 @@ return { config = function() vim.g.copilot_filetypes = { ['codecompanion'] = false, + ['helm'] = false, + ['markdown'] = false, + ['terraform'] = false, } vim.g.copilot_settings = { selectedCompletionModel = 'gpt-4o-copilot' } end, diff --git a/.config/nvim/lua/custom/plugins/hardline.lua b/.config/nvim/lua/custom/plugins/hardline.lua new file mode 100644 index 0000000..1119b6d --- /dev/null +++ b/.config/nvim/lua/custom/plugins/hardline.lua @@ -0,0 +1,6 @@ +return { + 'm4xshen/hardtime.nvim', + lazy = false, + dependencies = { 'MunifTanjim/nui.nvim' }, + opts = {}, +} diff --git a/.config/nvim/lua/custom/plugins/lsp.lua b/.config/nvim/lua/custom/plugins/lsp.lua index 997efa9..c4e2dab 100644 --- a/.config/nvim/lua/custom/plugins/lsp.lua +++ b/.config/nvim/lua/custom/plugins/lsp.lua @@ -42,6 +42,7 @@ return { vim.filetype.add { pattern = { ['.*/%.github[%w/]+workflows[%w/]+.*%.ya?ml'] = 'yaml.github', + ['*.mdx'] = 'markdown', }, } diff --git a/.config/nvim/lua/custom/plugins/markdown.lua b/.config/nvim/lua/custom/plugins/markdown.lua deleted file mode 100644 index 3ed4ef9..0000000 --- a/.config/nvim/lua/custom/plugins/markdown.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - 'OXY2DEV/markview.nvim', - lazy = false, - ---@type mkv.config - opts = { - preview = { - filetypes = { 'markdown', 'codecompanion' }, - ignore_buftypes = {}, - hybrid_modes = { 'i', 'n', 'v' }, - }, - }, -} diff --git a/.config/nvim/lua/custom/plugins/which-key.lua b/.config/nvim/lua/custom/plugins/which-key.lua index 2391721..7d66fd2 100644 --- a/.config/nvim/lua/custom/plugins/which-key.lua +++ b/.config/nvim/lua/custom/plugins/which-key.lua @@ -1,42 +1,44 @@ return { 'folke/which-key.nvim', event = 'VimEnter', + dependencies = { 'nvim-tree/nvim-web-devicons' }, opts = { ---@class wk.Opts icons = { mappings = vim.g.have_nerd_font, -- If you are using a Nerd Font: set icons.keys to an empty table which will use the -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { - Up = ' ', - Down = ' ', - Left = ' ', - Right = ' ', - C = ' ', - M = ' ', - D = ' ', - S = ' ', - CR = ' ', - Esc = ' ', - ScrollWheelDown = ' ', - ScrollWheelUp = ' ', - NL = ' ', - BS = ' ', - Space = ' ', - Tab = ' ', - F1 = '', - F2 = '', - F3 = '', - F4 = '', - F5 = '', - F6 = '', - F7 = '', - F8 = '', - F9 = '', - F10 = '', - F11 = '', - F12 = '', - }, + keys = vim.g.have_nerd_font and {}, + -- keys = vim.g.have_nerd_font and {} or { + -- Up = ' ', + -- Down = ' ', + -- Left = ' ', + -- Right = ' ', + -- C = ' ', + -- M = ' ', + -- D = ' ', + -- S = ' ', + -- CR = ' ', + -- Esc = ' ', + -- ScrollWheelDown = ' ', + -- ScrollWheelUp = ' ', + -- NL = ' ', + -- BS = ' ', + -- Space = ' ', + -- Tab = ' ', + -- F1 = '', + -- F2 = '', + -- F3 = '', + -- F4 = '', + -- F5 = '', + -- F6 = '', + -- F7 = '', + -- F8 = '', + -- F9 = '', + -- F10 = '', + -- F11 = '', + -- F12 = '', + -- }, }, -- Document existing key chains From 4ab89dd5c22edd8c0333facffde861105fbaabe9 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Mon, 19 May 2025 01:36:12 -0400 Subject: [PATCH 24/42] Update lazy lock file --- .config/nvim/lazy-lock.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index ab31c7e..6ab1a66 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -19,7 +19,7 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" }, - "mason.nvim": { "branch": "main", "commit": "888d6ee499d8089a3a4be4309d239d6be1c1e6c0" }, + "mason.nvim": { "branch": "main", "commit": "1aceba8bc158b5aaf90649077cad06744bc23ac4" }, "mini.pick": { "branch": "main", "commit": "fa1e449e1080bf7aa9b2890ee186d23b1b4e1287" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, @@ -36,7 +36,6 @@ "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, "nvim-treesitter-context": { "branch": "master", "commit": "5c48b8ba1b0b7b25feb6e34e7eb293ea893aedc4" }, "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, - "overseer.nvim": { "branch": "master", "commit": "72c68aab0358c92f451168b704c411c4a3e3410e" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "render-markdown.nvim": { "branch": "main", "commit": "a1b0988f5ab26698afb56b9c2f0525a4de1195c1" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, From 311deb847985ea267da785dc1040518d90b4ebf3 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Mon, 19 May 2025 01:38:47 -0400 Subject: [PATCH 25/42] Load atuin and nvm if they exist --- .zshrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.zshrc b/.zshrc index e64a281..7db9fac 100644 --- a/.zshrc +++ b/.zshrc @@ -202,3 +202,14 @@ if [[ "$TERM_PROGRAM" != "tmux" ]]; then fi export RPROMPT=$gen_prompt + +if [ -d "$HOME/.atuin" ]; then + . "$HOME/.atuin/bin/env" + eval "$(atuin init zsh)" +fi + +if [ -f "$HOME/.nvm/nvm.sh" ]; then + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +fi From 11da5d20ae3ce1f740f34bafd6541337a8eebaad Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 10:06:23 -0400 Subject: [PATCH 26/42] Initial commit of nix home-manager configuration --- .config/home-manager/common.nix | 216 ++++++++++++++++++ .config/home-manager/hosts/macbook-air.nix | 15 ++ .../home-manager/hosts/work-macbook-pro.nix | 17 ++ .../home-manager/modules/machine-config.nix | 32 +++ 4 files changed, 280 insertions(+) create mode 100644 .config/home-manager/common.nix create mode 100644 .config/home-manager/hosts/macbook-air.nix create mode 100644 .config/home-manager/hosts/work-macbook-pro.nix create mode 100644 .config/home-manager/modules/machine-config.nix diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix new file mode 100644 index 0000000..eb1b3cd --- /dev/null +++ b/.config/home-manager/common.nix @@ -0,0 +1,216 @@ +{ config, pkgs, ... }: + +{ + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + pkgs.ack + pkgs.act + pkgs.awscli2 + pkgs.fd + pkgs.fzf + pkgs.gh + pkgs.git # Explicitly install git for programs.git to work + pkgs.gnupg + pkgs.kind + pkgs.k9s + pkgs.kubectl + pkgs.kubernetes-helm + pkgs.lazygit + pkgs.neovim + pkgs.ripgrep + pkgs.tmux + pkgs.yq + pkgs.yt-dlp + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # Method 1: Inline content (best for small config files) +# ".gitignore_global".text = '' +# # OS generated files +# .DS_Store +# .DS_Store? +# ._* +# .Spotlight-V100 +# .Trashes +# ehthumbs.db +# Thumbs.db + +# # IDE files +# .vscode/ +# .idea/ +# *.swp +# *.swo +# *~ + +# # Build artifacts +# node_modules/ +# target/ +# dist/ +# build/ + +# # Environment files +# .env +# .env.local +# ''; + + # Method 2: Simple file with basic content +# ".hushlogin".text = ""; # Suppress login banner + + # Method 3: Executable script +# ".local/bin/hello".text = '' +# #!/usr/bin/env bash +# echo "Hello from Home Manager!" +# ''; +# ".local/bin/hello".executable = true; + + # Method 2: Source from external files (best for large configs) +# ".tmux.conf".source = ../../tmux.conf; +# ".gitconfig".source = ../../gitconfig; + + # Method 3: Conditional files (using Nix expressions) +# ".vimrc".text = '' +# set number +# set relativenumber +# set tabstop=2 +# set shiftwidth=2 +# set expandtab +# ${if pkgs.stdenv.isDarwin then "set clipboard=unnamed" else "set clipboard=unnamedplus"} +# ''; + }; + + # Common session variables + home.sessionVariables = { + EDITOR = "nvim"; + }; + + # Enable and configure Fish shell + programs.fish = { + enable = true; + + plugins = [ + { + name = "pure"; + src = pkgs.fishPlugins.pure.src; + } + ]; + + functions = { + aws-ps = '' + set profile $(aws configure list-profiles | fzf --height=30% --layout=reverse) + if set --query profile + set -gx AWS_PROFILE $profile + echo "AWS profile $AWS_PROFILE now active." + end + ''; + +# # Function to reload Fish shell configuration +# reload = '' +# echo "Reloading Fish shell configuration..." +# exec fish +# ''; + +# # Enhanced rebuild function that reloads Fish afterwards +# hm-switch = '' +# if test -n "$HM_CONFIG_PATH" +# echo "Switching Home Manager configuration..." +# home-manager switch --file "$HM_CONFIG_PATH" $argv +# and begin +# echo "Reloading Fish shell..." +# exec fish +# end +# else +# echo "Error: HM_CONFIG_PATH not set. Please set it to your machine config path." +# return 1 +# end +# ''; + }; + + # Fish shell configuration + shellInit = '' + # Commands to run when fish starts (non-interactive) + set PATH $PATH /opt/homebrew/bin + set PATH $HOME/.orbstack/bin $PATH + ''; + + interactiveShellInit = '' + # Commands to run in interactive sessions + # Initialize atuin if available + if command -q atuin + atuin init fish | source + end + ''; + + # Fish shell aliases + shellAliases = { + lg = "lazygit"; + + # Quick reload aliases + rl = "exec fish"; + src = "source ~/.config/fish/config.fish"; + + # Home Manager aliases + hm = "home-manager"; + hms = "home-manager switch"; + hmb = "home-manager build --no-out-link"; + }; + }; + + # Configure direnv with nix-direnv for automatic Nix environment loading + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + programs.git = { + enable = true; + userName = "Mike Priscella"; + userEmail = "mpriscella@gmail.com"; + + extraConfig = { + core.editor = "nvim"; + color.ui = "auto"; + init.defaultBranch = "main"; + pull.rebase = false; + push.default = "simple"; + }; + + aliases = { + chb = "checkout -b"; + empty = "commit --allow-empty -n -m 'Empty-Commit'"; + }; + + ignores = [ + # OS generated files + ".DS_Store" + ".DS_Store?" + "._*" + ".Spotlight-V100" + ".Trashes" + "ehthumbs.db" + "Thumbs.db" + + # IDE files + ".vscode/" + ".idea/" + "*.swp" + "*.swo" + "*~" + + # Build artifacts + "node_modules/" + "target/" + "dist/" + "build/" + + # Environment files + ".env" + ".env.local" + ]; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/.config/home-manager/hosts/macbook-air.nix b/.config/home-manager/hosts/macbook-air.nix new file mode 100644 index 0000000..393d673 --- /dev/null +++ b/.config/home-manager/hosts/macbook-air.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + imports = [ ../common.nix ]; + + # Machine-specific configuration + home.username = "michaelpriscella"; + home.homeDirectory = "/Users/michaelpriscella"; + home.stateVersion = "25.05"; + + # Machine-specific packages or overrides can go here + # home.packages = with pkgs; [ + # # Additional packages for this machine + # ]; +} diff --git a/.config/home-manager/hosts/work-macbook-pro.nix b/.config/home-manager/hosts/work-macbook-pro.nix new file mode 100644 index 0000000..5be5cc6 --- /dev/null +++ b/.config/home-manager/hosts/work-macbook-pro.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../common.nix + ../modules/machine-config.nix + ]; + + home.username = "michaelpriscella"; + home.homeDirectory = "/Users/michaelpriscella"; + home.stateVersion = "25.05"; + + # Custom configuration using our module + myConfig = { + configPath = "${config.home.homeDirectory}/.config/home-manager/hosts/work-macbook-pro.nix"; + }; +} diff --git a/.config/home-manager/modules/machine-config.nix b/.config/home-manager/modules/machine-config.nix new file mode 100644 index 0000000..a3ba73a --- /dev/null +++ b/.config/home-manager/modules/machine-config.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + options.myConfig = { + configPath = mkOption { + type = types.str; + default = "${config.home.homeDirectory}/.config/home-manager/home.nix"; + description = "Path to the home-manager configuration file for this machine"; + }; + }; + + config = { + # Use your custom options here + home.packages = with pkgs; [ + # Custom build script + (writeShellScriptBin "home-manager-build" '' + echo "Building Home Manager configuration..." + echo "Using config: ${config.myConfig.configPath}" + exec home-manager build --file "${config.myConfig.configPath}" "$@" + '') + + # Custom switch script + (writeShellScriptBin "home-manager-switch" '' + echo "Switching Home Manager configuration..." + echo "Using config: ${config.myConfig.configPath}" + exec home-manager switch --file "${config.myConfig.configPath}" "$@" + '') + ]; + }; +} From 02681b93cf2d59f95167cf8dc65189c71d21da81 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 10:06:38 -0400 Subject: [PATCH 27/42] Move fish config into home-manager conifg --- .config/fish/config.fish | 25 ------------------------- .config/fish/functions/.gitignore | 1 - .config/fish/functions/aws-ps.fish | 15 --------------- .config/fish/functions/devexec.fish | 3 --- .config/fish/functions/devup.fish | 3 --- .config/fish/functions/lg.fish | 3 --- .config/fish/functions/reload.fish | 8 -------- .config/fish/functions/vi.fish | 3 --- .config/fish/functions/vim.fish | 3 --- 9 files changed, 64 deletions(-) delete mode 100644 .config/fish/config.fish delete mode 100644 .config/fish/functions/.gitignore delete mode 100644 .config/fish/functions/aws-ps.fish delete mode 100644 .config/fish/functions/devexec.fish delete mode 100644 .config/fish/functions/devup.fish delete mode 100644 .config/fish/functions/lg.fish delete mode 100644 .config/fish/functions/reload.fish delete mode 100644 .config/fish/functions/vi.fish delete mode 100644 .config/fish/functions/vim.fish diff --git a/.config/fish/config.fish b/.config/fish/config.fish deleted file mode 100644 index 9ccd5f6..0000000 --- a/.config/fish/config.fish +++ /dev/null @@ -1,25 +0,0 @@ -if status is-interactive - # Commands to run in interactive sessions can go here - - # Set up Homebrew. - set --global --export HOMEBREW_PREFIX "/opt/homebrew"; - set --global --export HOMEBREW_CELLAR "/opt/homebrew/Cellar"; - set --global --export HOMEBREW_REPOSITORY "/opt/homebrew"; - fish_add_path --global --move --path "/opt/homebrew/bin" "/opt/homebrew/sbin"; - if test -n "$MANPATH[1]"; set --global --export MANPATH '' $MANPATH; end; - if not contains "/opt/homebrew/share/info" $INFOPATH; set --global --export INFOPATH "/opt/homebrew/share/info" $INFOPATH; end; - - if type -q atuin; then - atuin init fish | source - end -end - -set pure_enable_k8s true -set pure_show_system_time true -set pure_enable_nixdevshell true - -if type -q direnv; then - # Load direnv hook for fish. - # https://direnv.net/docs/hook.html. - direnv hook fish | source -end diff --git a/.config/fish/functions/.gitignore b/.config/fish/functions/.gitignore deleted file mode 100644 index 43b580a..0000000 --- a/.config/fish/functions/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_pure*.fish diff --git a/.config/fish/functions/aws-ps.fish b/.config/fish/functions/aws-ps.fish deleted file mode 100644 index 08c0fff..0000000 --- a/.config/fish/functions/aws-ps.fish +++ /dev/null @@ -1,15 +0,0 @@ -####################################### -# Switch between AWS Profiles. -# Arguments: -# None -####################################### -function aws-ps - # TODO There should be a "clear profile" option which unsets AWS_PROFILE. - - # Need to check profile if it's empty, not sure if this does that or not. - set profile $(aws configure list-profiles | fzf --height=30% --layout=reverse) - if set --query profile - set -gx AWS_PROFILE $profile - echo "AWS profile $AWS_PROFILE now active." - end -end diff --git a/.config/fish/functions/devexec.fish b/.config/fish/functions/devexec.fish deleted file mode 100644 index f6d5c2f..0000000 --- a/.config/fish/functions/devexec.fish +++ /dev/null @@ -1,3 +0,0 @@ -function devexec - devcontainer exec --workspace-folder . zsh -end diff --git a/.config/fish/functions/devup.fish b/.config/fish/functions/devup.fish deleted file mode 100644 index b73c891..0000000 --- a/.config/fish/functions/devup.fish +++ /dev/null @@ -1,3 +0,0 @@ -function devup - devcontainer up --workspace-folder . --dotfiles-repository https://github.com/mpriscella/dotfiles.git -end diff --git a/.config/fish/functions/lg.fish b/.config/fish/functions/lg.fish deleted file mode 100644 index 217d870..0000000 --- a/.config/fish/functions/lg.fish +++ /dev/null @@ -1,3 +0,0 @@ -function lg - lazygit -end diff --git a/.config/fish/functions/reload.fish b/.config/fish/functions/reload.fish deleted file mode 100644 index c857895..0000000 --- a/.config/fish/functions/reload.fish +++ /dev/null @@ -1,8 +0,0 @@ -####################################### -# Reload Fish configuration. -# Arguments: -# None -####################################### -function reload - source ~/.config/fish/config.fish # TODO Should reload all functions as well. -end diff --git a/.config/fish/functions/vi.fish b/.config/fish/functions/vi.fish deleted file mode 100644 index 776c744..0000000 --- a/.config/fish/functions/vi.fish +++ /dev/null @@ -1,3 +0,0 @@ -function vi - echo 'Use "nvim" instead of "vi"' -end diff --git a/.config/fish/functions/vim.fish b/.config/fish/functions/vim.fish deleted file mode 100644 index 8a4f07b..0000000 --- a/.config/fish/functions/vim.fish +++ /dev/null @@ -1,3 +0,0 @@ -function vim - echo 'Use "nvim" instead of "vim"' -end From 389bbd671dd0873e1d8f1c0ce36e0b0d6692055a Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 10:07:20 -0400 Subject: [PATCH 28/42] Move gitconfig into home-manager --- .dotfiles.gitconfig | 52 --------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 .dotfiles.gitconfig diff --git a/.dotfiles.gitconfig b/.dotfiles.gitconfig deleted file mode 100644 index 82351d5..0000000 --- a/.dotfiles.gitconfig +++ /dev/null @@ -1,52 +0,0 @@ -[user] -name = Mike Priscella -email = mpriscella@gmail.com - -[alias] -branches = branch -a -chb = checkout -b -# Show the diff between the latest commit and the current state -d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" -# Remove branches that have already been merged with master -# a.k.a. ‘delete merged’ -dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d; git remote -v update -p" -empty = commit --allow-empty -n -m "Empty-Commit" -g = grep --break --heading --line-number -# View abbreviated SHA, description, and history graph of the latest 20 commits -l = log --pretty=oneline -n 20 --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit -remotes = remote -v -# View the current working tree status using the short format -s = status -s -su = "!git branch --set-upstream-to=origin/$1 $1" -tags = tag -l -ytd-commits = !"git rev-list --count HEAD --since=\"Jan 1 $(date +%Y)\" --before=\"Dec 31 $(date +%Y)\"" - -[color] -ui = auto - -[fetch] -prune = true - -[rebase] -autosquash = true - -[push] -default = current - -[grep] -extendRegexp = true -lineNumber = true - -[filter "lfs"] -clean = git-lfs clean %f -smudge = git-lfs smudge %f -required = true - -[pull] -rebase = false - -[core] -editor = nvim -attributesFile = ~/.gitattributes - -# vim: set filetype=gitconfig : From 67bdb7a83110af685994f323342554783c439d91 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 10:12:11 -0400 Subject: [PATCH 29/42] Added a couple more packages --- .config/home-manager/common.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix index eb1b3cd..5edddbf 100644 --- a/.config/home-manager/common.nix +++ b/.config/home-manager/common.nix @@ -7,15 +7,18 @@ pkgs.ack pkgs.act pkgs.awscli2 + pkgs.dive pkgs.fd pkgs.fzf pkgs.gh pkgs.git # Explicitly install git for programs.git to work pkgs.gnupg + pkgs.jq pkgs.kind pkgs.k9s pkgs.kubectl pkgs.kubernetes-helm + pkgs.lazydocker pkgs.lazygit pkgs.neovim pkgs.ripgrep From 34ab2ab21f91de80ed7900c9c8d230c9b31f53f2 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 13:51:48 -0400 Subject: [PATCH 30/42] Cleanup files --- .config/home-manager/common.nix | 81 +++------------------------------ 1 file changed, 6 insertions(+), 75 deletions(-) diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix index 5edddbf..5e7c89f 100644 --- a/.config/home-manager/common.nix +++ b/.config/home-manager/common.nix @@ -27,61 +27,13 @@ pkgs.yt-dlp ]; - # Home Manager is pretty good at managing dotfiles. The primary way to manage - # plain files is through 'home.file'. home.file = { - # Method 1: Inline content (best for small config files) -# ".gitignore_global".text = '' -# # OS generated files -# .DS_Store -# .DS_Store? -# ._* -# .Spotlight-V100 -# .Trashes -# ehthumbs.db -# Thumbs.db - -# # IDE files -# .vscode/ -# .idea/ -# *.swp -# *.swo -# *~ - -# # Build artifacts -# node_modules/ -# target/ -# dist/ -# build/ - -# # Environment files -# .env -# .env.local -# ''; - - # Method 2: Simple file with basic content -# ".hushlogin".text = ""; # Suppress login banner - - # Method 3: Executable script -# ".local/bin/hello".text = '' -# #!/usr/bin/env bash -# echo "Hello from Home Manager!" -# ''; -# ".local/bin/hello".executable = true; - - # Method 2: Source from external files (best for large configs) -# ".tmux.conf".source = ../../tmux.conf; -# ".gitconfig".source = ../../gitconfig; - - # Method 3: Conditional files (using Nix expressions) -# ".vimrc".text = '' -# set number -# set relativenumber -# set tabstop=2 -# set shiftwidth=2 -# set expandtab -# ${if pkgs.stdenv.isDarwin then "set clipboard=unnamed" else "set clipboard=unnamedplus"} -# ''; + ".ackrc".text = '' + --pager=less -R + --ignore-case + ''; + + ".tmux.conf".source = ../../tmux.conf; }; # Common session variables @@ -108,27 +60,6 @@ echo "AWS profile $AWS_PROFILE now active." end ''; - -# # Function to reload Fish shell configuration -# reload = '' -# echo "Reloading Fish shell configuration..." -# exec fish -# ''; - -# # Enhanced rebuild function that reloads Fish afterwards -# hm-switch = '' -# if test -n "$HM_CONFIG_PATH" -# echo "Switching Home Manager configuration..." -# home-manager switch --file "$HM_CONFIG_PATH" $argv -# and begin -# echo "Reloading Fish shell..." -# exec fish -# end -# else -# echo "Error: HM_CONFIG_PATH not set. Please set it to your machine config path." -# return 1 -# end -# ''; }; # Fish shell configuration From 28473d36bcd2a129a465cc694a53feb581e3f73b Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 13:52:01 -0400 Subject: [PATCH 31/42] Move ackrc and tmux conf to home-manager --- .ackrc | 2 -- .tmux.conf | 50 -------------------------------------------------- 2 files changed, 52 deletions(-) delete mode 100644 .ackrc delete mode 100644 .tmux.conf diff --git a/.ackrc b/.ackrc deleted file mode 100644 index a72aa9d..0000000 --- a/.ackrc +++ /dev/null @@ -1,2 +0,0 @@ ---pager=less -R ---ignore-case diff --git a/.tmux.conf b/.tmux.conf deleted file mode 100644 index a4b4cf3..0000000 --- a/.tmux.conf +++ /dev/null @@ -1,50 +0,0 @@ -# https://tmuxcheatsheet.com/ - -set -g default-terminal "$TERM" -set -ag terminal-overrides ",$TERM:Tc" - -set -g mouse on - -# Change prefix command to C-a. -# Works best if Ctrl is remapped to Caps Lock. -unbind C-b -set -g prefix C-a -bind C-a send-prefix - -# Start windows and panes at 1, not 0. -set -g base-index 1 -set -g pane-base-index 1 -set-window-option -g pane-base-index 1 -set-option -g renumber-windows on - -# Open panes in current directory -bind '"' split-window -v -c "#{pane_current_path}" -bind % split-window -h -c "#{pane_current_path}" - -set-option -g allow-rename off - -# Download tpm if not already downloaded. -if-shell -b '[ ! -d $HOME/.tmux/plugins/tpm ]' { - run-shell 'git clone --depth 1 https://github.com/tmux-plugins/tpm $HOME/.tmux/plugins/tpm' -} - -# Install plugins. -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-sensible' -set -g @plugin 'catppuccin/tmux' - -# Configure catppuccin. -set -g @catppuccin_custom_plugin_dir "$HOME"/.tmux/modules -set -g @catppuccin_window_current_text "#W" -set -g @catppuccin_window_default_text "#W" -set -g @catppuccin_status_modules_left "" -set -g @catppuccin_status_modules_right "kubernetes time" - -set -ga terminal-features "*:hyperlinks" - -# Enables nvim zen mode. -set-option -g allow-passthrough on - -set-option -g default-terminal "tmux-256color" - -run '$HOME/.tmux/plugins/tpm/tpm' From 62c3989cc9f79007e858a5471edb9260e50a95ad Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 14:06:30 -0400 Subject: [PATCH 32/42] More nix updates --- .config/home-manager/common.nix | 9 ++++-- tmux.conf | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 tmux.conf diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix index 5e7c89f..1bdbf7d 100644 --- a/.config/home-manager/common.nix +++ b/.config/home-manager/common.nix @@ -1,8 +1,6 @@ { config, pkgs, ... }: { - # The home.packages option allows you to install Nix packages into your - # environment. home.packages = [ pkgs.ack pkgs.act @@ -11,7 +9,7 @@ pkgs.fd pkgs.fzf pkgs.gh - pkgs.git # Explicitly install git for programs.git to work + pkgs.git pkgs.gnupg pkgs.jq pkgs.kind @@ -34,11 +32,16 @@ ''; ".tmux.conf".source = ../../tmux.conf; + + ".config/atuin/config.toml".source = ../atuin/config.toml; + ".config/ghostty/config".source = ../ghostty/config; }; # Common session variables home.sessionVariables = { + AWS_CLI_AUTO_PROMPT = "on-partial"; EDITOR = "nvim"; + KUBE_EDITOR = "nvim"; }; # Enable and configure Fish shell diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 0000000..a4b4cf3 --- /dev/null +++ b/tmux.conf @@ -0,0 +1,50 @@ +# https://tmuxcheatsheet.com/ + +set -g default-terminal "$TERM" +set -ag terminal-overrides ",$TERM:Tc" + +set -g mouse on + +# Change prefix command to C-a. +# Works best if Ctrl is remapped to Caps Lock. +unbind C-b +set -g prefix C-a +bind C-a send-prefix + +# Start windows and panes at 1, not 0. +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +# Open panes in current directory +bind '"' split-window -v -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" + +set-option -g allow-rename off + +# Download tpm if not already downloaded. +if-shell -b '[ ! -d $HOME/.tmux/plugins/tpm ]' { + run-shell 'git clone --depth 1 https://github.com/tmux-plugins/tpm $HOME/.tmux/plugins/tpm' +} + +# Install plugins. +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'catppuccin/tmux' + +# Configure catppuccin. +set -g @catppuccin_custom_plugin_dir "$HOME"/.tmux/modules +set -g @catppuccin_window_current_text "#W" +set -g @catppuccin_window_default_text "#W" +set -g @catppuccin_status_modules_left "" +set -g @catppuccin_status_modules_right "kubernetes time" + +set -ga terminal-features "*:hyperlinks" + +# Enables nvim zen mode. +set-option -g allow-passthrough on + +set-option -g default-terminal "tmux-256color" + +run '$HOME/.tmux/plugins/tpm/tpm' From 862097171f8942d003225fbb7a50e9efb13d608e Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 14:10:18 -0400 Subject: [PATCH 33/42] Add nvim files --- .config/nvim/after/ftplugin/terraform.lua | 13 ++++-- .config/nvim/lazy-lock.json | 44 ++++++++++---------- .config/nvim/lua/custom/plugins/codesnap.lua | 1 + .config/nvim/lua/custom/plugins/snacks.lua | 2 +- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/.config/nvim/after/ftplugin/terraform.lua b/.config/nvim/after/ftplugin/terraform.lua index 616b23d..ae5925e 100644 --- a/.config/nvim/after/ftplugin/terraform.lua +++ b/.config/nvim/after/ftplugin/terraform.lua @@ -1,18 +1,23 @@ vim.bo.commentstring = '# %s' local function add_comment_header() - local line_number = vim.api.nvim_win_get_cursor(0)[1] + local line_length = 80 + local current_line = vim.api.nvim_win_get_cursor(0)[1] local line = vim.api.nvim_get_current_line() local bookend = '################################################################################' - vim.api.nvim_buf_set_lines(0, line_number - 1, line_number, true, { + -- for i = 1, line_length, 1 do + -- bookend = bookend .. '#' + -- end + + vim.api.nvim_buf_set_lines(0, current_line - 1, current_line, true, { bookend, '# ' .. line, }) - vim.api.nvim_buf_set_lines(0, line_number + 1, line_number + 1, true, { bookend }) + vim.api.nvim_buf_set_lines(0, current_line + 1, current_line + 1, true, { bookend }) if line == '' then - vim.api.nvim_win_set_cursor(0, { line_number + 1, 2 }) + vim.api.nvim_win_set_cursor(0, { current_line + 1, 2 }) vim.cmd 'startinsert' end end diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 6ab1a66..a3d2b60 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,49 +1,49 @@ { - "avante.nvim": { "branch": "main", "commit": "e98bb8d3bae102662c5ad4ada1ce63a9aacac4e0" }, + "avante.nvim": { "branch": "main", "commit": "fdf4716ec04cf5d9f8f39a44b7d42ab37cc2bd40" }, "blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" }, "codesnap.nvim": { "branch": "main", "commit": "be6d6b9a3b5e6999edbda76b16dace03d9bfcd3d" }, - "conform.nvim": { "branch": "master", "commit": "a4bb5d6c4ae6f32ab13114e62e70669fa67745b9" }, - "copilot.lua": { "branch": "master", "commit": "0929c92097a49b6ae3565aab157fa2bce398d953" }, - "copilot.vim": { "branch": "release", "commit": "d1e8429bef7f7709586886b0a23a46fbecc685c4" }, + "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, + "copilot.lua": { "branch": "master", "commit": "c1bb86abbed1a52a11ab3944ef00c8410520543d" }, + "copilot.vim": { "branch": "release", "commit": "3955014c503b0cd7b30bc56c86c56c0736ca0951" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "fzf-lua": { "branch": "main", "commit": "66e620a7a724364809e78a1ae4b5bfe73e37df49" }, - "gitsigns.nvim": { "branch": "main", "commit": "39e0d1cd44eafed5f30c372e377ab1cb1781ec9f" }, - "hardtime.nvim": { "branch": "main", "commit": "882e62292ac9fc0ab764253a16d9387ed995ad94" }, - "img-clip.nvim": { "branch": "main", "commit": "08a02e14c8c0d42fa7a92c30a98fd04d6993b35d" }, + "fzf-lua": { "branch": "main", "commit": "d155cc9648ba391f64876888ea0ae09a7aff469d" }, + "gitsigns.nvim": { "branch": "main", "commit": "731b581428ec6c1ccb451b95190ebbc6d7006db7" }, + "hardtime.nvim": { "branch": "main", "commit": "145b930954a3146cfb5b8a73cdcad42eb7d2740c" }, + "img-clip.nvim": { "branch": "main", "commit": "d8b6b030672f9f551a0e3526347699985a779d93" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "bef29b653ba71d442816bf56286c2a686210be04" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" }, - "mason.nvim": { "branch": "main", "commit": "1aceba8bc158b5aaf90649077cad06744bc23ac4" }, - "mini.pick": { "branch": "main", "commit": "fa1e449e1080bf7aa9b2890ee186d23b1b4e1287" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "mini.pick": { "branch": "main", "commit": "fdb920aa92ed624a0447bc13ddac79d9d2653c24" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, - "nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" }, + "nvim-dap": { "branch": "master", "commit": "40a8189b8a57664a1850b0823fdcb3ac95b9f635" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, - "nvim-lint": { "branch": "master", "commit": "fdb04e9285edefbe25a02a31a35e8fbb10fe054d" }, - "nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" }, + "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, + "nvim-lspconfig": { "branch": "master", "commit": "7ad4a11cc5742774877c529fcfb2702f7caf75e4" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, - "nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" }, - "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, - "nvim-treesitter-context": { "branch": "master", "commit": "5c48b8ba1b0b7b25feb6e34e7eb293ea893aedc4" }, + "nvim-surround": { "branch": "main", "commit": "8dd9150ca7eae5683660ea20cec86edcd5ca4046" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "1a1a7c5d6d75cb49bf64049dafab15ebe294a79f" }, "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "render-markdown.nvim": { "branch": "main", "commit": "a1b0988f5ab26698afb56b9c2f0525a4de1195c1" }, + "render-markdown.nvim": { "branch": "main", "commit": "76f7ce56ccb913632745714f160faa53164c5574" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, - "vim-helm": { "branch": "master", "commit": "ae1ebc160d2b9b90108477ab10df7a4fc501e358" }, + "vim-helm": { "branch": "master", "commit": "cc5ac22444332381f38084a6c7f023c25eef6201" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/.config/nvim/lua/custom/plugins/codesnap.lua b/.config/nvim/lua/custom/plugins/codesnap.lua index d14cf15..eb51415 100644 --- a/.config/nvim/lua/custom/plugins/codesnap.lua +++ b/.config/nvim/lua/custom/plugins/codesnap.lua @@ -7,6 +7,7 @@ return { }, opts = { save_path = '~/Screenshots/CodeSnap', + bg_padding = 25, has_breadcrumbs = true, watermark = '@mpriscella', }, diff --git a/.config/nvim/lua/custom/plugins/snacks.lua b/.config/nvim/lua/custom/plugins/snacks.lua index d01eb2c..fed168c 100644 --- a/.config/nvim/lua/custom/plugins/snacks.lua +++ b/.config/nvim/lua/custom/plugins/snacks.lua @@ -89,7 +89,7 @@ return { function() Snacks.lazygit() end, - desc = 'Toggle Lazygit', + desc = 'Toggle [l]azy[g]it', }, { '\\', From 04e1f93726336222435c964791fd9c1371c86d0a Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 14:15:41 -0400 Subject: [PATCH 34/42] Symlink neovim config via home-manager --- .config/home-manager/common.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix index 1bdbf7d..b809c95 100644 --- a/.config/home-manager/common.nix +++ b/.config/home-manager/common.nix @@ -35,6 +35,7 @@ ".config/atuin/config.toml".source = ../atuin/config.toml; ".config/ghostty/config".source = ../ghostty/config; + ".config/nvim".source = ../nvim; }; # Common session variables From 0dcd10307cb26f6648ab015b81b03d830841d441 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 14:26:21 -0400 Subject: [PATCH 35/42] Update macbook air host --- .config/home-manager/hosts/macbook-air.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.config/home-manager/hosts/macbook-air.nix b/.config/home-manager/hosts/macbook-air.nix index 393d673..bf9a987 100644 --- a/.config/home-manager/hosts/macbook-air.nix +++ b/.config/home-manager/hosts/macbook-air.nix @@ -1,15 +1,17 @@ { config, pkgs, ... }: { - imports = [ ../common.nix ]; + imports = [ + ../common.nix + ../modules/machine-config.nix + ]; - # Machine-specific configuration - home.username = "michaelpriscella"; - home.homeDirectory = "/Users/michaelpriscella"; + home.username = "mpriscella"; + home.homeDirectory = "/Users/mpriscella"; home.stateVersion = "25.05"; - # Machine-specific packages or overrides can go here - # home.packages = with pkgs; [ - # # Additional packages for this machine - # ]; + # Custom configuration using our module + myConfig = { + configPath = "${config.home.homeDirectory}/.config/home-manager/hosts/macbook-air.nix"; + }; } From 17598954cca8e13566212d29b53fccabd616a24b Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 14:39:15 -0400 Subject: [PATCH 36/42] Update install script to install nix and home-manager --- .config/home-manager/common.nix | 5 +- dotfiles.sh | 265 ----------------------------- functions.sh | 66 -------- install.sh | 286 +++++++++++++++++++++++++++++++- 4 files changed, 286 insertions(+), 336 deletions(-) delete mode 100755 dotfiles.sh delete mode 100644 functions.sh diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix index b809c95..b0968eb 100644 --- a/.config/home-manager/common.nix +++ b/.config/home-manager/common.nix @@ -33,8 +33,9 @@ ".tmux.conf".source = ../../tmux.conf; - ".config/atuin/config.toml".source = ../atuin/config.toml; - ".config/ghostty/config".source = ../ghostty/config; + ".config/atuin".source = ../atuin; + ".config/ghostty".source = ../ghostty; + ".config/k9s".source = ../k9s; ".config/nvim".source = ../nvim; }; diff --git a/dotfiles.sh b/dotfiles.sh deleted file mode 100755 index 69a3dc4..0000000 --- a/dotfiles.sh +++ /dev/null @@ -1,265 +0,0 @@ -#!/bin/bash - -source functions.sh - -ENABLE_TMUX=FALSE - -####################################### -# Install package dependencies. -# Globals: -# ADJUSTED_ID -# ENABLE_TMUX -# Arguments: -# None -####################################### -install_dependencies() { - # Install atuin. - curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/download/v18.4.0/atuin-installer.sh | sh - - # Install nvm. - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash - NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - - nvm install node - npm install -g @devcontainers/cli - - if [ "${ADJUSTED_ID}" = "debian" ]; then - check_packages ack build-essential ca-certificates curl fd-find fzf gawk \ - git jq locales ripgrep tar vim virt-what zsh - - # Set locale. - sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen - echo 'LANG=en_US.UTF-8' > /etc/default/locale - locale-gen - - install_neovim - - # TODO: Install: - # - fish - # - lazygit - - elif [ "${ADJUSTED_ID}" = "darwin" ]; then - brew install --casks dbeaver-community devtoys - # TODO: This list of packages should be a variable. Then we loop over it, - # check to see if it's installed, and if not, install it. This might be - # applicable to debian as well, perhaps we can create a function to check if - # a package is installed that's package manager agnostic. - check_packages ack act derailed/k9s/k9s direnv fish fd fzf gh gnupg \ - helm jordanbaird-ice jq kind jesseduffield/lazygit/lazygit neovim \ - orbstack ripgrep yq yt-dlp - - nvm install node - - # Hopefully can move the following into nix: - # - dive - # - k6 - # - shellcheck - # - sslscan (?) - # - step - # - terraform-ls - # - tree-sitter - - # Change shell to fishshell. - if ! grep -q '/fish$' /etc/shells; then - which fish | sudo tee -a /etc/shells - chsh -s "$(which fish)" - fi - fi - - if [ "${ENABLE_TMUX}" = "TRUE" ]; then - install_tmux - fi - - # Install fisher. - fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher" - - # Install pure. - fish -c "fisher install pure-fish/pure" - - clean_up -} - -####################################### -# Symlinks the dotfiles to their correct destination in the home directory. -# Globals: -# files -# HOME -# Arguments: -# None -####################################### -install_dotfiles() { - files=".ackrc .config/ghostty .config/nvim .dotfiles.gitconfig .gitattributes .zshrc" - - for i in $files; do - # If it doesn't exist, create it - # loop over files in dotfiles directory and symlink them to directory on host. - - # If the file is a directory - if [ -d "$i" ]; then - # Loop over files in the directory - # Probably needs to be recursive. - for j in "$i"/*; do - mkdir -p "$HOME"/"$i" - ln -s "$PWD"/"$j" "$HOME"/"$i" - done - fi - - mkdir -p "$(dirname "$HOME"/"$i")" - if [ "$(readlink "$HOME"/"$i")" != "$PWD"/"$i" ]; then - rm "$HOME"/"$i" - elif [ ! -L "$HOME"/"$i" ] && [ -f "$HOME"/"$i" ]; then - mv "$HOME"/"$i" "$HOME"/"$i".bkup - fi - - ln -s "$PWD"/"$i" "$HOME"/"$i" - done - - # TODO: Maybe put this in a function later. - # Probaly unnecessary since this is the only configuration needed for git. - git config --global include.path "$HOME"/.dotfiles.gitconfig -} - -####################################### -# Installs Homebrew. -# Globals: -# TMPDIR -# Arguments: -# None -####################################### -install_homebrew() { - if ! type brew >/dev/null 2>&1; then - VERSION=$(curl -s https://api.github.com/repos/Homebrew/brew/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name": "v?([^"]*).*/\1/') - CURL -Lo "${TMPDIR}"/brew.pkg "https://github.com/Homebrew/brew/releases/download/${VERSION}/Homebrew-${VERSION}.pkg" - sudo installer -pkg "${TMPDIR}"/brew.pkg -target / - rm "${TMPDIR}"/brew.pkg - - # Create $HOME/.zprofile if it doesn't exist. - if [ -f "$HOME"/.zprofile ]; then - echo >> "$HOME"/.zprofile - fi - - # shellcheck disable=SC2016 - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME"/.zprofile - eval "$(/opt/homebrew/bin/brew shellenv)" - fi - PATH="/opt/homebrew/bin:$PATH" -} - -####################################### -# Installs neovim. -# Globals: -# ARCHITECTURE -# HOME -# PATH -# Arguments: -# None -####################################### -install_neovim() { - # TODO: Check if neovim is installed already. - NEOVIM_VERSION=$(curl -s "https://api.github.com/repos/neovim/neovim/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') - if ARCHITECTURE="aarch64"; then - NEOVIM_ARCHITECTURE="arm64" - else - NEOVIM_ARCHITECTURE="$ARCHITECTURE" - fi - curl -Lo "${HOME}"/neovim.tar.gz "https://github.com/neovim/neovim/releases/download/v${NEOVIM_VERSION}/nvim-linux-${NEOVIM_ARCHITECTURE}.tar.gz" - mkdir -p "${HOME}"/neovim - tar xf "${HOME}"/neovim.tar.gz -C "${HOME}"/neovim --strip-components=1 - export PATH="${HOME}"/neovim/bin:"${PATH}" - rm "${HOME}"/neovim.tar.gz -} - -####################################### -# Installs and configures tmux. -# Globals: -# HOME -# Arguments: -# None -####################################### -install_tmux() { - check_packages tmux - - # NOTE: I can keep tmux, but I'm going to try and not use it as much. It - # shouldn't be installed by default. Same goes for it's config. Maybe we can - # have an env var that defaults to false and determines whether to install / - # configure tmux. - if [ ! -d "$HOME"/.tmux/plugins/tpm ]; then - TPM_VERSION=v3.1.0 - git clone --depth 1 --branch "${TPM_VERSION}" https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm - fi - "$HOME"/.tmux/plugins/tpm/bin/install_plugins -} - -####################################### -# Print script usage. -# Globals: -# None -# Arguments: -# None -####################################### -usage() { - echo "Manages mpriscella/dotfiles." - echo "" - echo "Usage:" - echo " ./dotfiles.sh [command]" - echo "" - echo "Available Commands:" - echo " clean Removes any backup files generated from the install command." - echo " install Installs dotfiles and predefined packages." - echo "" -} - -# Bring in ID and ID_LIKE, if the file exists. -if [ -f /etc/os-release ]; then - # shellcheck source=/dev/null - source /etc/os-release -fi - -# Normalize the OS ID. -if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then - ADJUSTED_ID="debian" -elif [ "$(uname -s)" = "Darwin" ]; then - ADJUSTED_ID="darwin" -fi - -ARCHITECTURE="$(uname -m)" - -if [ "${ADJUSTED_ID}" = "darwin" ]; then - install_homebrew -fi - -# Determine what the package manager install command for the OS is. -if type apt-get >/dev/null 2>&1; then - export DEBIAN_FRONTEND=noninteractive - INSTALL_CMD=apt-get -elif type brew >/dev/null 2>&1; then - INSTALL_CMD=brew -else - echo "(Error) Unable to find a supported package manager." - exit 1 -fi - -case "$1" in -"install") - install_dependencies - echo "✅ Dependencies installed." - - install_dotfiles - echo "✅ Dotfiles installed." - echo "Opening fish shell..." - - # Open a fish shell and, when the shell exits, kill the shell that the - # script executed in. - fish && kill -9 $PPID - # TODO: Maybe there's a way to restart the current application? - # Maybe an automator script - ;; -*) - usage - ;; -esac - -# TODO: How to run this automatically? -# nix profile install nixpkgs#nix-direnv -# echo "source $HOME/.nix-profile/share/nix-direnv/direnvrc" >> "$HOME"/.config/direnv/direnvrc diff --git a/functions.sh b/functions.sh deleted file mode 100644 index 91930c2..0000000 --- a/functions.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -####################################### -# Ensure packages are installed. -# Globals: -# ID -# INSTALL_CMD -# SUDO -# Arguments: -# List of packages to install. -####################################### -check_packages() { - # TODO: Check if package is installed and if so, skip it. - # Also, we shouldn't update for each package since that will take forever. - if [ "${INSTALL_CMD}" = "apt-get" ]; then - if ! dpkg -s "$@" >/dev/null 2>&1; then - pkg_mgr_update - "${SUDO}""${INSTALL_CMD}" -y install --no-install-recommends "$@" - fi - elif [ "${INSTALL_CMD}" = "brew" ]; then - pkg_mgr_update - "${INSTALL_CMD}" install "$@" - else - echo "Linux distro ${ID} not supported." - exit 1 - fi -} - -####################################### -# Clean up package manager cache files. -# Globals: -# ADJUSTED_ID -# Arguments: -# None -####################################### -clean_up() { - case "${ADJUSTED_ID}" in - debian) - rm -rf /var/lib/apt/lists/* - ;; - darwin) - brew cleanup - ;; - esac -} - -####################################### -# Update package manager. -# Globals: -# INSTALL_CMD -# SUDO -# Arguments: -# None -####################################### -pkg_mgr_update() { - if [ "${INSTALL_CMD}" = "apt-get" ]; then - if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then - echo "Running apt-get update..." - "${SUDO}""${INSTALL_CMD}" update -y - fi - elif [ "${INSTALL_CMD}" = "brew" ]; then - echo "Running brew update ..." - "${INSTALL_CMD}" update - fi -} - diff --git a/install.sh b/install.sh index 31a7e37..e405465 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,285 @@ #!/bin/bash -if [ -z "$DEBUG_DOTFILES" ]; then - ./dotfiles.sh install -fi +set -e # Exit on any error + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Helper functions +log_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# Detect operating system +detect_os() { + case "$(uname -s)" in + Darwin*) + OS="macos" + log_info "Running on macOS" + ;; + Linux*) + OS="linux" + log_info "Running on Linux" + # Detect Linux distribution + if [[ -f /etc/os-release ]]; then + source /etc/os-release + DISTRO="$ID" + log_info "Detected Linux distribution: $PRETTY_NAME" + else + DISTRO="unknown" + log_warning "Could not detect Linux distribution" + fi + ;; + *) + log_error "Unsupported operating system: $(uname -s)" + log_error "This script supports macOS and Linux only" + exit 1 + ;; + esac +} + +# Check prerequisites based on OS +check_prerequisites() { + case "$OS" in + linux) + # Check if curl is available + if ! command -v curl >/dev/null 2>&1; then + log_error "curl is required but not installed" + log_info "Please install curl first:" + case "$DISTRO" in + ubuntu | debian) + log_info " sudo apt update && sudo apt install curl" + ;; + fedora | rhel | centos) + log_info " sudo dnf install curl" + ;; + arch | manjaro) + log_info " sudo pacman -S curl" + ;; + *) + log_info " Please install curl using your distribution's package manager" + ;; + esac + exit 1 + fi + + # Check if systemd is available for multi-user install + if command -v systemctl >/dev/null 2>&1; then + SYSTEMD_AVAILABLE=true + log_info "systemd detected - will use multi-user installation" + else + SYSTEMD_AVAILABLE=false + log_warning "systemd not detected - will use single-user installation" + fi + ;; + macos) + # macOS specific checks + if ! command -v curl >/dev/null 2>&1; then + log_error "curl is required but not installed" + exit 1 + fi + ;; + esac +} + +# Install Nix if not already installed +install_nix() { + if command -v nix >/dev/null 2>&1; then + log_success "Nix is already installed" + nix --version + return 0 + fi + + log_info "Installing Nix..." + + case "$OS" in + macos) + # Use the official Nix installer for macOS with daemon support + install_args="--daemon" + ;; + linux) + # Check if we should use multi-user or single-user install + if command -v systemctl >/dev/null 2>&1 && [[ "$EUID" -ne 0 ]]; then + log_info "Using multi-user installation (recommended)" + install_args="--daemon" + else + log_info "Using single-user installation" + install_args="" + fi + ;; + esac + + # Download and run the installer + if curl -L https://nixos.org/nix/install | sh -s -- $install_args; then + log_success "Nix installation completed" + + # Source nix profile to make nix available in current session + case "$OS" in + macos | linux) + # Try daemon profile first (multi-user install) + if [[ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then + source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' + log_info "Sourced Nix daemon profile" + # Fallback to single-user profile + elif [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then + source "$HOME/.nix-profile/etc/profile.d/nix.sh" + log_info "Sourced Nix single-user profile" + fi + ;; + esac + + # Verify installation + if command -v nix >/dev/null 2>&1; then + log_success "Nix is now available: $(nix --version)" + else + log_warning "Nix installed but not available in current session. Please restart your terminal." + fi + else + log_error "Failed to install Nix" + exit 1 + fi +} + +# Install home-manager +install_home_manager() { + # Check if home-manager is already installed + if command -v home-manager >/dev/null 2>&1; then + log_success "home-manager is already installed" + home-manager --version + return 0 + fi + + log_info "Installing home-manager..." + + # Add home-manager channel + if nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager; then + log_success "Added home-manager channel" + else + log_error "Failed to add home-manager channel" + exit 1 + fi + + # Update channels + log_info "Updating Nix channels..." + if nix-channel --update; then + log_success "Updated Nix channels" + else + log_error "Failed to update Nix channels" + exit 1 + fi + + # Install home-manager + log_info "Installing home-manager package..." + if nix-shell '' -A install; then + log_success "home-manager installation completed" + + # Verify installation + if command -v home-manager >/dev/null 2>&1; then + log_success "home-manager is now available: $(home-manager --version)" + else + log_warning "home-manager installed but not available in current session. Please restart your terminal." + fi + else + log_error "Failed to install home-manager" + exit 1 + fi +} + +# Setup initial home-manager configuration +setup_home_manager() { + local config_dir="$HOME/.config/home-manager" + local dotfiles_config_dir + dotfiles_config_dir="$(pwd)/.config/home-manager" + + if [[ -d "$config_dir" ]]; then + log_info "home-manager config directory already exists" + else + log_info "Creating home-manager config directory..." + mkdir -p "$config_dir" + fi + + # Check if we have a dotfiles home-manager config + if [[ -d "$dotfiles_config_dir" ]]; then + log_info "Dotfiles home-manager configuration found" + + # Suggest appropriate configuration file based on OS + case "$OS" in + macos) + log_info "You can now run: home-manager switch --file .config/home-manager/hosts/work-macbook-pro.nix" + ;; + linux) + log_info "You can now run: home-manager switch --file .config/home-manager/hosts/linux-machine.nix" + log_warning "Note: You may need to create a Linux-specific configuration file" + ;; + esac + else + log_warning "No home-manager configuration found in dotfiles" + log_info "You may need to create a home-manager configuration" + fi +} + +# Main installation process +main() { + log_info "Starting dotfiles installation..." + + # Detect operating system + detect_os + + # Check prerequisites + check_prerequisites + + # Install Nix + install_nix + + # Install home-manager + install_home_manager + + # Setup home-manager + setup_home_manager + + log_success "Installation completed!" + echo + log_info "Next steps:" + + case "$OS" in + macos) + echo " 1. Restart your terminal or run: source ~/.zshrc (or ~/.bashrc)" + echo " 2. Navigate to your dotfiles directory" + echo " 3. Run: home-manager switch --file .config/home-manager/hosts/work-macbook-pro.nix" + ;; + linux) + echo " 1. Restart your terminal or add Nix to your PATH:" + echo " source ~/.nix-profile/etc/profile.d/nix.sh (single-user)" + echo " source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh (multi-user)" + echo " 2. Navigate to your dotfiles directory" + echo " 3. Create a Linux configuration file or adapt existing one" + echo " 4. Run: home-manager switch --file .config/home-manager/hosts/linux-machine.nix" + ;; + esac + + echo + log_info "Useful commands:" + echo " - Update packages: nix-channel --update && home-manager switch" + echo " - List generations: home-manager generations" + echo " - Rollback: home-manager switch --switch-generation " + echo " - Check system: nix-info -m" +} + +# Run main function +main "$@" From ae19ca96db00266cde6878ce4c8d49a35aacb305 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 20:59:26 -0400 Subject: [PATCH 37/42] Add default host --- .config/ghostty/config | 1 - .config/home-manager/hosts/default.nix | 45 +++++ install.sh | 221 ++++++++++++++++++++----- 3 files changed, 225 insertions(+), 42 deletions(-) create mode 100644 .config/home-manager/hosts/default.nix diff --git a/.config/ghostty/config b/.config/ghostty/config index 1acd011..ddfc72c 100644 --- a/.config/ghostty/config +++ b/.config/ghostty/config @@ -4,7 +4,6 @@ # Additionally, each config option is also explained in detail # on Ghostty's website, at https://ghostty.org/docs/config. -command = /opt/homebrew/bin/fish theme = tokyonight working-directory = home quit-after-last-window-closed = true diff --git a/.config/home-manager/hosts/default.nix b/.config/home-manager/hosts/default.nix new file mode 100644 index 0000000..f533feb --- /dev/null +++ b/.config/home-manager/hosts/default.nix @@ -0,0 +1,45 @@ +{ config, pkgs, lib, ... }: + +let + # Automatically detect username from environment + username = builtins.getEnv "USER"; + + # Construct home directory based on detected username and OS + homeDirectory = + if pkgs.stdenv.isDarwin + then "/Users/${username}" + else "/home/${username}"; + + # Detect hostname for configuration path + hostname = + let + envHostname = builtins.getEnv "HOSTNAME"; + in + if envHostname != "" then envHostname + else if builtins.pathExists /etc/hostname then builtins.readFile /etc/hostname + else "unknown"; +in + +{ + imports = [ + ../common.nix + ../modules/machine-config.nix + ]; + + # Automatically inferred values + home.username = username; + home.homeDirectory = homeDirectory; + home.stateVersion = "25.05"; + + # Custom configuration using our module + myConfig = { + configPath = "${homeDirectory}/.config/home-manager/hosts/default.nix"; + }; + + # Optional: Add some debug info to session variables + home.sessionVariables = { + HM_DETECTED_USER = username; + HM_DETECTED_HOME = homeDirectory; + HM_DETECTED_HOST = hostname; + }; +} diff --git a/install.sh b/install.sh index e405465..d7cf5d9 100755 --- a/install.sh +++ b/install.sh @@ -81,10 +81,8 @@ check_prerequisites() { # Check if systemd is available for multi-user install if command -v systemctl >/dev/null 2>&1; then - SYSTEMD_AVAILABLE=true log_info "systemd detected - will use multi-user installation" else - SYSTEMD_AVAILABLE=false log_warning "systemd not detected - will use single-user installation" fi ;; @@ -101,8 +99,24 @@ check_prerequisites() { # Install Nix if not already installed install_nix() { if command -v nix >/dev/null 2>&1; then - log_success "Nix is already installed" - nix --version + log_success "Nix is already installed: $(nix --version)" + + # Even if Nix is installed, ensure it's sourced in current session + if [[ -z "${NIX_PATH:-}" ]]; then + log_info "Sourcing Nix environment for current session..." + # Try to source Nix profile for current session + if [[ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then + source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' + log_info "Sourced Nix daemon profile" + elif [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then + source "$HOME/.nix-profile/etc/profile.d/nix.sh" + log_info "Sourced Nix single-user profile" + fi + else + log_info "Nix environment already sourced (NIX_PATH is set)" + fi + + log_success "Nix is ready to use" return 0 fi @@ -140,6 +154,8 @@ install_nix() { elif [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then source "$HOME/.nix-profile/etc/profile.d/nix.sh" log_info "Sourced Nix single-user profile" + else + log_warning "Could not find Nix profile to source" fi ;; esac @@ -148,10 +164,13 @@ install_nix() { if command -v nix >/dev/null 2>&1; then log_success "Nix is now available: $(nix --version)" else - log_warning "Nix installed but not available in current session. Please restart your terminal." + log_warning "Nix installed but not available in current session." + log_info "You may need to restart your terminal or manually source the Nix profile." + # Don't exit here - continue with the script fi else log_error "Failed to install Nix" + log_info "You can try installing Nix manually from: https://nixos.org/download.html" exit 1 fi } @@ -160,19 +179,31 @@ install_nix() { install_home_manager() { # Check if home-manager is already installed if command -v home-manager >/dev/null 2>&1; then - log_success "home-manager is already installed" - home-manager --version + log_success "home-manager is already installed: $(home-manager --version)" return 0 fi + # Ensure nix commands are available + if ! command -v nix-channel >/dev/null 2>&1; then + log_error "nix-channel command not found. Nix may not be properly installed or sourced." + log_info "Try restarting your terminal or manually sourcing Nix profile." + return 1 + fi + log_info "Installing home-manager..." - # Add home-manager channel - if nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager; then - log_success "Added home-manager channel" + # Check if home-manager channel already exists + if nix-channel --list | grep -q "home-manager"; then + log_info "home-manager channel already exists" else - log_error "Failed to add home-manager channel" - exit 1 + # Add home-manager channel + if nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager; then + log_success "Added home-manager channel" + else + log_error "Failed to add home-manager channel" + log_info "You can try adding it manually: nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager" + return 1 + fi fi # Update channels @@ -180,8 +211,8 @@ install_home_manager() { if nix-channel --update; then log_success "Updated Nix channels" else - log_error "Failed to update Nix channels" - exit 1 + log_warning "Failed to update Nix channels, but continuing..." + log_info "You may need to run 'nix-channel --update' manually later" fi # Install home-manager @@ -193,11 +224,17 @@ install_home_manager() { if command -v home-manager >/dev/null 2>&1; then log_success "home-manager is now available: $(home-manager --version)" else - log_warning "home-manager installed but not available in current session. Please restart your terminal." + log_warning "home-manager installed but not available in current session." + log_info "You may need to restart your terminal or source your shell profile." + # Don't exit here - continue with the script fi else log_error "Failed to install home-manager" - exit 1 + log_info "You can try installing it manually:" + echo " 1. nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager" + echo " 2. nix-channel --update" + echo " 3. nix-shell '' -A install" + return 1 fi } @@ -234,6 +271,73 @@ setup_home_manager() { fi } +# Test and apply home-manager configuration +test_and_apply_config() { + local config_file=".config/home-manager/hosts/default.nix" + local dotfiles_config_dir + dotfiles_config_dir="$(pwd)/.config/home-manager" + + # Check if we're in the dotfiles directory + if [[ ! -d "$dotfiles_config_dir" ]]; then + log_error "Not in dotfiles directory or home-manager config not found" + log_info "Please run this script from your dotfiles directory" + return 1 + fi + + # Check if default.nix exists + if [[ ! -f "$config_file" ]]; then + log_warning "Default configuration file not found: $config_file" + log_info "Skipping automatic configuration application" + return 1 + fi + + log_info "Testing home-manager configuration: $config_file" + + # Test the configuration by building it + if home-manager build --file "$config_file" --no-out-link; then + log_success "Configuration test passed!" + + # Ask user if they want to apply it + echo + read -p "Do you want to apply this configuration now? (y/N): " -n 1 -r + echo + + if [[ $REPLY =~ ^[Yy]$ ]]; then + log_info "Applying home-manager configuration..." + + if home-manager switch --file "$config_file"; then + log_success "Home-manager configuration applied successfully!" + + # Show what was applied + log_info "Configuration details:" + echo " - User: $(whoami)" + echo " - Config: $config_file" + echo " - Home: $HOME" + echo " - Generation: $(home-manager generations | head -1 | awk '{print $5}' || echo 'Unknown')" + + return 0 + else + log_error "Failed to apply home-manager configuration" + log_info "You can try manually with: home-manager switch --file $config_file" + return 1 + fi + else + log_info "Configuration not applied. You can apply it later with:" + echo " home-manager switch --file $config_file" + return 0 + fi + else + log_error "Configuration test failed!" + log_info "Please check your configuration file: $config_file" + log_info "Common issues:" + echo " - Check syntax errors in nix files" + echo " - Verify all imports exist" + echo " - Ensure username/home directory are correct" + echo " - Try: home-manager build --file $config_file --show-trace" + return 1 + fi +} + # Main installation process main() { log_info "Starting dotfiles installation..." @@ -245,40 +349,75 @@ main() { check_prerequisites # Install Nix + log_info "Checking Nix installation..." install_nix + nix_install_result=$? + + if [[ $nix_install_result -ne 0 ]]; then + log_error "Nix installation failed. Cannot continue." + exit 1 + fi # Install home-manager + log_info "Checking home-manager installation..." install_home_manager + hm_install_result=$? + + if [[ $hm_install_result -ne 0 ]]; then + log_warning "home-manager installation had issues, but continuing..." + log_info "You may need to install home-manager manually later." + fi # Setup home-manager setup_home_manager - log_success "Installation completed!" - echo - log_info "Next steps:" - - case "$OS" in - macos) - echo " 1. Restart your terminal or run: source ~/.zshrc (or ~/.bashrc)" - echo " 2. Navigate to your dotfiles directory" - echo " 3. Run: home-manager switch --file .config/home-manager/hosts/work-macbook-pro.nix" - ;; - linux) - echo " 1. Restart your terminal or add Nix to your PATH:" - echo " source ~/.nix-profile/etc/profile.d/nix.sh (single-user)" - echo " source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh (multi-user)" - echo " 2. Navigate to your dotfiles directory" - echo " 3. Create a Linux configuration file or adapt existing one" - echo " 4. Run: home-manager switch --file .config/home-manager/hosts/linux-machine.nix" - ;; - esac + # Test and apply configuration (only if home-manager is available) + if command -v home-manager >/dev/null 2>&1; then + log_info "Testing and applying home-manager configuration..." + if test_and_apply_config; then + log_success "Installation and configuration completed!" + echo + log_info "Your dotfiles are now active!" + echo + log_info "Useful commands:" + echo " - Update packages: nix-channel --update && home-manager switch" + echo " - Rebuild config: home-manager switch --file .config/home-manager/hosts/default.nix" + echo " - List generations: home-manager generations" + echo " - Rollback: home-manager switch --switch-generation " + echo " - Check system: nix-info -m" + else + log_warning "Configuration test/apply step had issues" + log_success "Base installation completed!" + echo + log_info "Manual next steps:" + + case "$OS" in + macos | linux) + echo " 1. Navigate to your dotfiles directory" + echo " 2. Test config: home-manager build --file .config/home-manager/hosts/default.nix --no-out-link" + echo " 3. Apply config: home-manager switch --file .config/home-manager/hosts/default.nix" + ;; + esac - echo - log_info "Useful commands:" - echo " - Update packages: nix-channel --update && home-manager switch" - echo " - List generations: home-manager generations" - echo " - Rollback: home-manager switch --switch-generation " - echo " - Check system: nix-info -m" + echo + log_info "Useful commands:" + echo " - Update packages: nix-channel --update && home-manager switch" + echo " - List generations: home-manager generations" + echo " - Rollback: home-manager switch --switch-generation " + echo " - Check system: nix-info -m" + fi + else + log_warning "home-manager not available. Skipping configuration application." + log_success "Nix installation completed!" + echo + log_info "Next steps:" + echo " 1. Install home-manager manually:" + echo " nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager" + echo " nix-channel --update" + echo " nix-shell '' -A install" + echo " 2. Apply your configuration:" + echo " home-manager switch --file .config/home-manager/hosts/default.nix" + fi } # Run main function From 59cdf5098f15788589e4618ff02fccbdccf1b7b7 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 21:02:45 -0400 Subject: [PATCH 38/42] Add github workflow to test home manager configs --- .github/workflows/test-home-manager.yml | 172 ++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 .github/workflows/test-home-manager.yml diff --git a/.github/workflows/test-home-manager.yml b/.github/workflows/test-home-manager.yml new file mode 100644 index 0000000..ed188e4 --- /dev/null +++ b/.github/workflows/test-home-manager.yml @@ -0,0 +1,172 @@ +name: Test Home Manager Configurations + +on: + push: + branches: + - main + paths: + - '.config/home-manager/**' + pull_request: + branches: + - main + paths: + - '.config/home-manager/**' + workflow_dispatch: + +jobs: + test-configs: + name: Test ${{ matrix.host }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + include: + # Test default.nix on both platforms (auto-detects) + - host: default + os: ubuntu-latest + platform: linux + - host: default + os: macos-latest + platform: darwin + + # Test specific host configs on their target platforms + - host: work-macbook-pro + os: macos-latest + platform: darwin + - host: macbook-air + os: macos-latest + platform: darwin + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v24 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + nix_path: nixpkgs=channel:nixos-unstable + + - name: Setup Cachix (optional - speeds up builds) + uses: cachix/cachix-action@v12 + if: ${{ vars.CACHIX_NAME != '' }} + with: + name: ${{ vars.CACHIX_NAME }} + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + + - name: Install Home Manager + run: | + nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager + nix-channel --update + nix-shell '' -A install + + - name: Set test environment variables + run: | + # Set dummy values for auto-detection in default.nix + echo "USER=testuser" >> $GITHUB_ENV + if [[ "${{ matrix.platform }}" == "darwin" ]]; then + echo "HOME=/Users/testuser" >> $GITHUB_ENV + else + echo "HOME=/home/testuser" >> $GITHUB_ENV + fi + echo "HOSTNAME=github-runner" >> $GITHUB_ENV + + - name: Test configuration build + run: | + cd ${{ github.workspace }} + echo "Testing configuration: ${{ matrix.host }}.nix" + + # Build the configuration without creating result symlink + home-manager build \ + --file .config/home-manager/hosts/${{ matrix.host }}.nix \ + --no-out-link \ + --show-trace + + - name: Test configuration evaluation + run: | + cd ${{ github.workspace }} + echo "Evaluating configuration for detailed analysis..." + + # Test that the configuration evaluates without errors + nix-instantiate \ + --eval \ + --strict \ + --show-trace \ + --expr " + let + pkgs = import {}; + home-manager = import {}; + config = import ./.config/home-manager/hosts/${{ matrix.host }}.nix { + inherit pkgs; + config = {}; + lib = pkgs.lib; + }; + in + config.home.stateVersion or \"unknown\" + " + + - name: Check for common issues + run: | + cd ${{ github.workspace }} + echo "Checking for common configuration issues..." + + # Check if all imported files exist + echo "Checking imports..." + if ! find .config/home-manager -name "*.nix" -exec nix-instantiate --parse {} \; > /dev/null; then + echo "❌ Syntax errors found in nix files" + exit 1 + fi + + # Check for missing files referenced in configs + echo "Checking file references..." + if grep -r "source.*\.\." .config/home-manager/hosts/${{ matrix.host }}.nix; then + echo "Found relative path references - ensuring they exist..." + # This is just informational, actual test is in the build step + fi + + echo "✅ Basic checks passed" + + - name: Generate build artifacts info + if: always() + run: | + cd ${{ github.workspace }} + echo "## Configuration Test Results" >> $GITHUB_STEP_SUMMARY + echo "- **Host**: ${{ matrix.host }}" >> $GITHUB_STEP_SUMMARY + echo "- **Platform**: ${{ matrix.platform }}" >> $GITHUB_STEP_SUMMARY + echo "- **OS**: ${{ matrix.os }}" >> $GITHUB_STEP_SUMMARY + echo "- **Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY + + if [[ "${{ job.status }}" == "success" ]]; then + echo "✅ Configuration builds successfully" >> $GITHUB_STEP_SUMMARY + else + echo "❌ Configuration failed to build" >> $GITHUB_STEP_SUMMARY + fi + + test-matrix-summary: + name: Test Results Summary + runs-on: ubuntu-latest + needs: test-configs + if: always() + + steps: + - name: Generate summary + run: | + echo "## Home Manager Configuration Test Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + if [[ "${{ needs.test-configs.result }}" == "success" ]]; then + echo "🎉 **All configurations passed!**" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "All host configurations build successfully and are ready for deployment." >> $GITHUB_STEP_SUMMARY + else + echo "⚠️ **Some configurations failed**" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "Check the individual job results above for details." >> $GITHUB_STEP_SUMMARY + fi + + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Tested Configurations:" >> $GITHUB_STEP_SUMMARY + echo "- default.nix (Linux & macOS)" >> $GITHUB_STEP_SUMMARY + echo "- work-macbook-pro.nix (macOS)" >> $GITHUB_STEP_SUMMARY + echo "- macbook-air.nix (macOS)" >> $GITHUB_STEP_SUMMARY From 53da7bbb110fd657c27c1eb5587c1fdfe2527fd4 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 21:08:04 -0400 Subject: [PATCH 39/42] Take two --- .github/workflows/test-home-manager.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-home-manager.yml b/.github/workflows/test-home-manager.yml index ed188e4..7d00d69 100644 --- a/.github/workflows/test-home-manager.yml +++ b/.github/workflows/test-home-manager.yml @@ -48,17 +48,23 @@ jobs: github_access_token: ${{ secrets.GITHUB_TOKEN }} nix_path: nixpkgs=channel:nixos-unstable - - name: Setup Cachix (optional - speeds up builds) - uses: cachix/cachix-action@v12 - if: ${{ vars.CACHIX_NAME != '' }} - with: - name: ${{ vars.CACHIX_NAME }} - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + # - name: Setup Cachix (optional - speeds up builds) + # uses: cachix/cachix-action@v12 + # if: ${{ vars.CACHIX_NAME != '' }} + # with: + # name: ${{ vars.CACHIX_NAME }} + # authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Install Home Manager run: | + # Use the standard installation method with proper environment setup nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager nix-channel --update + + # Ensure the channel is in NIX_PATH for this session + export NIX_PATH="nixpkgs=channel:nixos-unstable:home-manager=$HOME/.nix-defexpr/channels/home-manager" + + # Install home-manager using the updated NIX_PATH nix-shell '' -A install - name: Set test environment variables @@ -72,12 +78,15 @@ jobs: fi echo "HOSTNAME=github-runner" >> $GITHUB_ENV + # Set proper NIX_PATH for all subsequent steps + echo "NIX_PATH=nixpkgs=channel:nixos-unstable:home-manager=$HOME/.nix-defexpr/channels/home-manager" >> $GITHUB_ENV + - name: Test configuration build run: | cd ${{ github.workspace }} echo "Testing configuration: ${{ matrix.host }}.nix" - # Build the configuration without creating result symlink + # Build the configuration using home-manager home-manager build \ --file .config/home-manager/hosts/${{ matrix.host }}.nix \ --no-out-link \ From 6f4e3b226bbc7238d5a439d1bb01643e45b40f80 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 21:13:30 -0400 Subject: [PATCH 40/42] Third times a charm --- .github/workflows/test-home-manager.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-home-manager.yml b/.github/workflows/test-home-manager.yml index 7d00d69..b863e3e 100644 --- a/.github/workflows/test-home-manager.yml +++ b/.github/workflows/test-home-manager.yml @@ -69,13 +69,11 @@ jobs: - name: Set test environment variables run: | - # Set dummy values for auto-detection in default.nix + # Set test username but keep the real HOME directory echo "USER=testuser" >> $GITHUB_ENV - if [[ "${{ matrix.platform }}" == "darwin" ]]; then - echo "HOME=/Users/testuser" >> $GITHUB_ENV - else - echo "HOME=/home/testuser" >> $GITHUB_ENV - fi + # Keep the existing HOME directory (GitHub runner's home) + echo "REAL_HOME=$HOME" >> $GITHUB_ENV + # Set hostname for testing echo "HOSTNAME=github-runner" >> $GITHUB_ENV # Set proper NIX_PATH for all subsequent steps From 900d5d9ef64d0f22a5d1e8231e6993329f661649 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 21:59:45 -0400 Subject: [PATCH 41/42] Resolve shellcheck issues --- install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index d7cf5d9..08cc64f 100755 --- a/install.sh +++ b/install.sh @@ -38,6 +38,7 @@ detect_os() { log_info "Running on Linux" # Detect Linux distribution if [[ -f /etc/os-release ]]; then + # shellcheck source=/dev/null source /etc/os-release DISTRO="$ID" log_info "Detected Linux distribution: $PRETTY_NAME" @@ -109,6 +110,7 @@ install_nix() { source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' log_info "Sourced Nix daemon profile" elif [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then + #shellcheck source=/dev/null source "$HOME/.nix-profile/etc/profile.d/nix.sh" log_info "Sourced Nix single-user profile" fi @@ -140,7 +142,7 @@ install_nix() { esac # Download and run the installer - if curl -L https://nixos.org/nix/install | sh -s -- $install_args; then + if curl -L https://nixos.org/nix/install | sh -s -- "$install_args"; then log_success "Nix installation completed" # Source nix profile to make nix available in current session @@ -152,6 +154,7 @@ install_nix() { log_info "Sourced Nix daemon profile" # Fallback to single-user profile elif [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then + #shellcheck source=/dev/null source "$HOME/.nix-profile/etc/profile.d/nix.sh" log_info "Sourced Nix single-user profile" else From b390a75fd885c8eec20202ade42444805571cf51 Mon Sep 17 00:00:00 2001 From: Mike Priscella Date: Sun, 15 Jun 2025 22:02:56 -0400 Subject: [PATCH 42/42] Couple more shellcheck issues --- install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 08cc64f..1181cd5 100755 --- a/install.sh +++ b/install.sh @@ -107,10 +107,11 @@ install_nix() { log_info "Sourcing Nix environment for current session..." # Try to source Nix profile for current session if [[ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then + # shellcheck source=/dev/null source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' log_info "Sourced Nix daemon profile" elif [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then - #shellcheck source=/dev/null + # shellcheck source=/dev/null source "$HOME/.nix-profile/etc/profile.d/nix.sh" log_info "Sourced Nix single-user profile" fi @@ -150,11 +151,12 @@ install_nix() { macos | linux) # Try daemon profile first (multi-user install) if [[ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then + # shellcheck source=/dev/null source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' log_info "Sourced Nix daemon profile" # Fallback to single-user profile elif [[ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then - #shellcheck source=/dev/null + # shellcheck source=/dev/null source "$HOME/.nix-profile/etc/profile.d/nix.sh" log_info "Sourced Nix single-user profile" else