From 476364697b831ac61887b56f05e964cb467bafff Mon Sep 17 00:00:00 2001 From: Ray Andrew Date: Mon, 18 Nov 2024 23:33:15 -0600 Subject: [PATCH] change nvim config and others --- src/home/default.nix | 2 +- src/home/gui/spotify.nix | 3 + src/home/shell/custom.sh | 6 +- src/home/shell/neovim/config/init.lua | 149 +++++++++--- src/home/shell/neovim/config/lazy-lock.json | 18 +- src/home/shell/shell.nix | 10 +- src/home/ssh/config | 241 ++++++++++++++++++++ src/home/{ssh.nix => ssh/default.nix} | 3 + src/home/wm/i3.nix | 5 +- 9 files changed, 392 insertions(+), 45 deletions(-) create mode 100644 src/home/ssh/config rename src/home/{ssh.nix => ssh/default.nix} (64%) diff --git a/src/home/default.nix b/src/home/default.nix index 9813248..86ecaa8 100644 --- a/src/home/default.nix +++ b/src/home/default.nix @@ -12,7 +12,7 @@ ./impermanence.nix ./gui ./shell - ./ssh.nix + ./ssh ./wm ]; diff --git a/src/home/gui/spotify.nix b/src/home/gui/spotify.nix index a32a468..4fa8d01 100644 --- a/src/home/gui/spotify.nix +++ b/src/home/gui/spotify.nix @@ -12,5 +12,8 @@ home.directories = [ ".config/spotify" ]; + home.cache.directories = [ + ".cache/spotify" + ]; }; } diff --git a/src/home/shell/custom.sh b/src/home/shell/custom.sh index c7e3d39..4204d3d 100644 --- a/src/home/shell/custom.sh +++ b/src/home/shell/custom.sh @@ -1,10 +1,14 @@ +if [ -n "$__SH_CUSTOM_SOURCED" ]; then return; fi +export __SH_CUSTOM_SOURCED=1 + # Paths export PATH="$HOME/.bin:$PATH" export PATH="$HOME/bin:$PATH" export PATH="$HOME/.local/bin:$PATH" -export EDITOR="vim" +export EDITOR="nvim" +alias v="nvim" # export EDITOR="emacs -nw" export ZINIT_INSTALL_BINARY=0 diff --git a/src/home/shell/neovim/config/init.lua b/src/home/shell/neovim/config/init.lua index 773f705..0e02437 100644 --- a/src/home/shell/neovim/config/init.lua +++ b/src/home/shell/neovim/config/init.lua @@ -35,6 +35,8 @@ vim.opt.inccommand = "split" vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- Global status +vim.opt.laststatus = 3 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -89,6 +91,17 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) +local lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" } +local function lazy_file() + -- Add support for the LazyFile event + local Event = require("lazy.core.handler.event") + + Event.mappings.LazyFile = { id = "LazyFile", event = lazy_file_events } + Event.mappings["User LazyFile"] = Event.mappings.LazyFile +end + +lazy_file() + -- [[ Configure and install plugins ]] require("lazy").setup({ "tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically @@ -160,7 +173,7 @@ require("lazy").setup({ { -- Fuzzy Finder (files, lsp, etc) "nvim-telescope/telescope.nvim", - event = "VimEnter", + lazy = true, branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim", @@ -172,7 +185,7 @@ require("lazy").setup({ end, }, { "nvim-telescope/telescope-ui-select.nvim" }, - { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, + { "echasnovski/mini.icons", enabled = vim.g.have_nerd_font }, }, config = function() require("telescope").setup({ @@ -233,6 +246,22 @@ require("lazy").setup({ builtin.find_files({ cwd = vim.fn.stdpath("config") }) end, { desc = "[S]earch [N]eovim files" }) end, + keys = { + "sh", + "sk", + "sf", + "sf", + "ss", + "sw", + "sg", + "sd", + "sr", + "s.", + "", + "/", + "s/", + "sn", + }, }, -- LSP Plugins @@ -252,11 +281,12 @@ require("lazy").setup({ { -- Main LSP Configuration "neovim/nvim-lspconfig", + event = "LazyFile", dependencies = { { "williamboman/mason.nvim", config = true }, "williamboman/mason-lspconfig.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", - { "j-hui/fidget.nvim", opts = {} }, + -- { "j-hui/fidget.nvim", opts = {} }, "hrsh7th/cmp-nvim-lsp", }, config = function() @@ -431,6 +461,7 @@ require("lazy").setup({ dependencies = { { "L3MON4D3/LuaSnip", + lazy = true, build = (function() if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then return @@ -561,38 +592,56 @@ require("lazy").setup({ { -- Highlight todo, notes, etc in comments "folke/todo-comments.nvim", - event = "VimEnter", + cmd = { "TodoTrouble", "TodoTelescope" }, + event = "LazyFile", dependencies = { "nvim-lua/plenary.nvim" }, opts = { signs = false }, + -- stylua: ignore start + keys = { + { "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" }, + { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" }, + { "xt", "Trouble todo toggle", desc = "Todo (Trouble)" }, + { "xT", "Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}", desc = "Todo/Fix/Fixme (Trouble)" }, + { "st", "TodoTelescope", desc = "Todo" }, + { "sT", "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, + }, + -- stylua: ignore end }, - { -- Collection of various small independent plugins/modules - "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 }) + { -- Better Around/Inside textobjects + "echasnovski/mini.ai", + event = "VeryLazy", + version = false, + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + opts = { + n_lines = 500, + }, + config = true, + }, - -- 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() + { -- Add/delete/replace surroundings (brackets, quotes, etc.) + "echasnovski/mini.surround", + event = "VeryLazy", + -- Examples: + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + config = true, + }, - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin + { -- Simple and easy statusline. + "echasnovski/mini.statusline", + event = "VimEnter", + version = false, + opts = { + use_icons = vim.g.have_nerd_font, + }, + config = function(_, opts) 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 + statusline.setup(opts) -- cursor location to LINE:COLUMN ---@diagnostic disable-next-line: duplicate-set-field statusline.section_location = function() @@ -600,8 +649,22 @@ require("lazy").setup({ end end, }, + + { + "echasnovski/mini.icons", + lazy = true, + version = false, + opts = {}, + config = function(_, opts) + local icons = require("mini.icons") + icons.setup(opts) + icons.mock_nvim_web_devicons() + end, + }, + { -- Highlight, edit, and navigate code "nvim-treesitter/nvim-treesitter", + event = "LazyFile", build = ":TSUpdate", main = "nvim-treesitter.configs", opts = { @@ -647,7 +710,7 @@ require("lazy").setup({ }, }, }, - -- stylua: ignore start + -- stylua: ignore start keys = { { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" }, { "bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" }, @@ -699,6 +762,10 @@ require("lazy").setup({ ---@type oil.SetupOpts opts = { keymaps = { + [""] = false, + [""] = false, + [""] = "actions.refresh", + ["q"] = "actions.close", [""] = { callback = function() require("oil.actions").yank_entry.callback() @@ -740,7 +807,7 @@ require("lazy").setup({ }, }, }, - dependencies = { "nvim-tree/nvim-web-devicons" }, + dependencies = { { "echasnovski/mini.icons", enabled = vim.g.have_nerd_font } }, keys = { -- stylua: ignore start { "-", "Oil", desc = "Open parent directory" }, @@ -754,6 +821,7 @@ require("lazy").setup({ }, { "christoomey/vim-tmux-navigator", + event = "VimEnter", cmd = { "TmuxNavigateLeft", "TmuxNavigateDown", @@ -776,7 +844,7 @@ require("lazy").setup({ { "jake-stewart/multicursor.nvim", - event = "VimEnter", + event = "LazyFile", branch = "1.0", config = function() local mc = require("multicursor-nvim") @@ -976,6 +1044,25 @@ require("lazy").setup({ lazy = "💤 ", }, }, + performance = { + cache = { + enabled = true, + }, + reset_packpath = true, + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, }) -- Keymaps diff --git a/src/home/shell/neovim/config/lazy-lock.json b/src/home/shell/neovim/config/lazy-lock.json index 85e6daa..7fb46eb 100644 --- a/src/home/shell/neovim/config/lazy-lock.json +++ b/src/home/shell/neovim/config/lazy-lock.json @@ -1,10 +1,9 @@ { - "LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" }, + "LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" }, - "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" }, "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, "gruber-darker.nvim": { "branch": "main", "commit": "a2dda61d9c1225e16951a51d6b89795b0ac35cd6" }, @@ -12,19 +11,22 @@ "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, "lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" }, "luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "cab00668464d2914d0752b86168b4a431cc93eb2" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.nvim": { "branch": "main", "commit": "c520765241541e0c7d4bc6fd4a716f706b0d5de7" }, + "mini.ai": { "branch": "main", "commit": "31c149067d38b97720d2a179619f7745a0006ecc" }, + "mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" }, + "mini.statusline": { "branch": "main", "commit": "813854243156472c9d0bc9c64ea0af159b9b37ca" }, + "mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" }, "multicursor.nvim": { "branch": "1.0", "commit": "b715cc5bf69cf6e338899510eb2b60b1dd7ccce0" }, "nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" }, - "nvim-lspconfig": { "branch": "master", "commit": "87c7c83ce62971e0bdb29bb32b8ad2b19c8f95d0" }, + "nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" }, "nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" }, - "nvim-treesitter": { "branch": "master", "commit": "20e10ca6914f65cf1410232433fb58de70ab6b39" }, - "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, + "nvim-treesitter": { "branch": "master", "commit": "37427012d1c77c544356bfff0c9acc88fd3256bc" }, + "nvim-web-devicons": { "branch": "master", "commit": "e87554285f581047b1bf236794b0eb812b444b87" }, "oil.nvim": { "branch": "master", "commit": "8ea40b5506115b6d355e304dd9ee5089f7d78601" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "snacks.nvim": { "branch": "main", "commit": "3f24e0a477c98b319f3d59051c12cc38c1dae21f" }, + "snacks.nvim": { "branch": "main", "commit": "be8feef4ab584f50aaa96b69d50b3f86a35aacff" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, diff --git a/src/home/shell/shell.nix b/src/home/shell/shell.nix index 54a3179..921362a 100644 --- a/src/home/shell/shell.nix +++ b/src/home/shell/shell.nix @@ -2,6 +2,7 @@ config, lib, pkgs, + dots, ... }: { @@ -32,8 +33,13 @@ ''; }; additionalSourceFile = mkOption { - type = types.nullOr types.path; - default = ./custom.sh; + type = + with types; + nullOr (oneOf [ + path + str + ]); + default = "${dots}/src/home/shell/custom.sh"; }; }; }; diff --git a/src/home/ssh/config b/src/home/ssh/config new file mode 100644 index 0000000..ea2e64c --- /dev/null +++ b/src/home/ssh/config @@ -0,0 +1,241 @@ +# Argonne + +Host login-gce + User rayandrew + HostName logins.cels.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host *.cels.anl.gov !logins.cels.anl.gov + ForwardX11Trusted yes + User rayandrew + ProxyJump login-gce + +Host bebop + ForwardX11Trusted yes + User rayandrew + HostName bebop.lcrc.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host swing + ForwardX11Trusted yes + User rayandrew + HostName swing.lcrc.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host *.lcrc.anl.gov + ForwardX11Trusted yes + User rayandrew + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host homes-gce + ForwardX11Trusted yes + User rayandrew + HostName homes.cels.anl.gov + ProxyJump login-gce + +Host theta + ForwardX11Trusted yes + User rayandrew + HostName thetalogin5.alcf.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +Host polaris + ForwardX11Trusted yes + User rayandrew + HostName polaris.alcf.anl.gov + ControlMaster auto + ControlPersist yes + LogLevel FATAL + +# Box + +Host box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host personal-box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179-sub2 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host clio-box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179-sub3 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host cl-data + ForwardAgent yes + ForwardX11 yes + User rayandrew + HostName 192.5.87.68 + RequestTTY yes + +Host clperf-box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179-sub1 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host flashnet-box + Port 23 + ForwardAgent yes + ForwardX11 yes + User u369179-sub4 + HostName box.rs.ht + ControlMaster auto + ControlPersist yes + LogLevel FATAL + RequestTTY yes + +# UChicago + +Host cs-uc + User rayandrew + HostName linux.cs.uchicago.edu + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + ForwardAgent yes + ForwardX11 yes + +Host cs-uc-06 + User rayandrew + HostName linux6.cs.uchicago.edu + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + ForwardAgent yes + ForwardX11 yes + +Host cs-uc-07 + User rayandrew + HostName linux7.cs.uchicago.edu + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + ForwardAgent yes + ForwardX11 yes + +Host ucare-gpu-1.cs.uchicago.edu + ForwardAgent yes + ForwardX11 yes + ForwardX11Trusted yes + User rayandrew + HostName ucare-gpu-1.cs.uchicago.edu + ProxyJump cs-uc-06 + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host ucare-gpu-1 + ForwardAgent yes + ForwardX11 yes + ForwardX11Trusted yes + User rayandrew + HostName ucare-gpu-1.cs.uchicago.edu + ProxyJump cs-uc-06 + # ControlMaster auto + # ControlPersist yes + LogLevel FATAL + RequestTTY yes + +Host ucare-07 + ForwardAgent yes + ForwardX11 yes + User rayandrew + HostName ucare-07.cs.uchicago.edu + RequestTTY yes + ProxyJump cs-uc + +Host ucare-10 + ForwardAgent yes + ForwardX11 yes + ForwardX11Trusted yes + User rayandrew + HostName ucare-10.cs.uchicago.edu + RequestTTY yes + ProxyJump cs-uc + LogLevel FATAL + +Host ucare-mini + ForwardAgent yes + ForwardX11 yes + User ucare + HostName ucare-mini.cs.uchicago.edu + RequestTTY yes + +# General + +Host *.amazonaws.com + ControlMaster no + ControlPath none + LogLevel FATAL + RequestTTY yes + +Host *.github.com + AddKeysToAgent yes + +# CC + +Host ray-stor + HostName 192.5.87.101 + User cc + ForwardAgent yes + ForwardX11 yes + RequestTTY yes + LogLevel FATAL + +Host ray-st + HostName 192.5.87.59 + User cc + ForwardAgent yes + ForwardX11 yes + RequestTTY yes + LogLevel FATAL + +Host * + ForwardAgent no + AddKeysToAgent no + Compression no + ServerAliveInterval 10 + ServerAliveCountMax 120 + HashKnownHosts no + UserKnownHostsFile ~/.ssh/known_hosts + ControlMaster no + ControlPath ~/.ssh/.control_channels/%h:%p:%r + ControlPersist no diff --git a/src/home/ssh.nix b/src/home/ssh/default.nix similarity index 64% rename from src/home/ssh.nix rename to src/home/ssh/default.nix index d1bb2c0..73abd28 100644 --- a/src/home/ssh.nix +++ b/src/home/ssh/default.nix @@ -1,6 +1,7 @@ { config, pkgs, + dots, ... }: { @@ -12,6 +13,8 @@ openssh ]; + home.file.".ssh/config".source = config.lib.file.mkOutOfStoreSymlink "${dots}/src/home/ssh/config"; + custom.persist = { home.directories = [ ".ssh" diff --git a/src/home/wm/i3.nix b/src/home/wm/i3.nix index 6956c1c..8c3240d 100644 --- a/src/home/wm/i3.nix +++ b/src/home/wm/i3.nix @@ -44,8 +44,8 @@ in enable = true; }; xsession.initExtra = '' - export GDK_SCALE=2 - export GDK_DPI_SCALE=0.5 + # export GDK_SCALE=2 + # export GDK_DPI_SCALE=0.5 export _JAVA_OPTIONS="-Dsun.java2d.uiScale=2" export QT_AUTO_SCREEN_SCALE_FACTOR=1 export QT_DEVICE_PIXEL_RATIO=2 @@ -92,6 +92,7 @@ in } ]; }; + stylix.targets.i3.enable = true; stylix.targets.dunst.enable = true; };