From 308bdbebf9ae43301301a65c49526dbe00b454c3 Mon Sep 17 00:00:00 2001 From: gwg313 Date: Thu, 5 Dec 2024 11:56:06 -0500 Subject: [PATCH] neovim updates --- common/nixos/sysctl/kernel.nix | 4 +- common/virtualization/kubernetes.nix | 3 +- home-manager/modules/common.nix | 1 + .../modules/neovim/plugins/default.nix | 3 + .../modules/neovim/plugins/mini-bufremove.nix | 26 ------- .../modules/neovim/plugins/mini-surround.nix | 3 +- .../modules/neovim/plugins/neoscroll.nix | 8 ++ .../modules/neovim/plugins/snacks.nix | 73 +++++++++++++++++++ .../modules/neovim/plugins/toggleterm.nix | 20 +---- .../modules/neovim/plugins/zenmode.nix | 8 ++ 10 files changed, 102 insertions(+), 47 deletions(-) create mode 100644 home-manager/modules/neovim/plugins/neoscroll.nix create mode 100644 home-manager/modules/neovim/plugins/snacks.nix create mode 100644 home-manager/modules/neovim/plugins/zenmode.nix diff --git a/common/nixos/sysctl/kernel.nix b/common/nixos/sysctl/kernel.nix index a5d6535..f26ebc4 100644 --- a/common/nixos/sysctl/kernel.nix +++ b/common/nixos/sysctl/kernel.nix @@ -2,7 +2,8 @@ config, pkgs, ... -}: { +}: +{ boot.kernel.sysctl = { # enable ExecShield protection # 2 enables ExecShield by default unless applications bits are set to disabled @@ -29,6 +30,7 @@ # - 1: only a parent process can be debugged # - 2: only admins can use ptrace (CAP_SYS_PTRACE capability required) # - 3: disables ptrace completely, reboot is required to re-enable ptrace + # If you need ptrace to work, then avoid non-ancestor ptrace access to running processes and their credentials, and use value "1". "kernel.yama.ptrace_scope" = 3; # restrict kernel logs to root only diff --git a/common/virtualization/kubernetes.nix b/common/virtualization/kubernetes.nix index 549e921..e0025f7 100644 --- a/common/virtualization/kubernetes.nix +++ b/common/virtualization/kubernetes.nix @@ -3,7 +3,8 @@ pkgs, lib, ... -}: { +}: +{ options = { kubernetes.enable = lib.mkEnableOption "Enables Kubernetes and tooling"; }; diff --git a/home-manager/modules/common.nix b/home-manager/modules/common.nix index e4a8144..8239320 100644 --- a/home-manager/modules/common.nix +++ b/home-manager/modules/common.nix @@ -59,6 +59,7 @@ portal atac dblab + gobang # TUI Apps #ncdu_2 diff --git a/home-manager/modules/neovim/plugins/default.nix b/home-manager/modules/neovim/plugins/default.nix index 4b17a5f..ac05116 100644 --- a/home-manager/modules/neovim/plugins/default.nix +++ b/home-manager/modules/neovim/plugins/default.nix @@ -31,11 +31,13 @@ _: { ./mini-indentscope.nix ./glow.nix ./navic.nix + ./neoscroll.nix ./nix.nix ./noice.nix ./notify.nix ./precognition.nix ./spectre.nix + ./snacks.nix ./refactoring.nix ./render-markdown.nix ./telescope.nix @@ -48,5 +50,6 @@ _: { ./yazi.nix ./yanky.nix ./vimtex.nix + ./zenmode.nix ]; } diff --git a/home-manager/modules/neovim/plugins/mini-bufremove.nix b/home-manager/modules/neovim/plugins/mini-bufremove.nix index 83469ef..91b5158 100644 --- a/home-manager/modules/neovim/plugins/mini-bufremove.nix +++ b/home-manager/modules/neovim/plugins/mini-bufremove.nix @@ -34,32 +34,6 @@ silent = true; }; } - { - mode = "n"; - key = "bc"; - action.__raw = - # lua - '' - function () - local current = vim.api.nvim_get_current_buf() - - local get_listed_bufs = function() - return vim.tbl_filter(function(bufnr) - return vim.api.nvim_buf_get_option(bufnr, "buflisted") - end, vim.api.nvim_list_bufs()) - end - - for _, bufnr in ipairs(get_listed_bufs()) do - if bufnr ~= current - then require("mini.bufremove").delete(bufnr) - end - end - end - ''; - options = { - desc = "Close all buffers but current"; - }; - } ]; }; } diff --git a/home-manager/modules/neovim/plugins/mini-surround.nix b/home-manager/modules/neovim/plugins/mini-surround.nix index 68e9ad0..55eb723 100644 --- a/home-manager/modules/neovim/plugins/mini-surround.nix +++ b/home-manager/modules/neovim/plugins/mini-surround.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.nixvim = { plugins = { mini = { diff --git a/home-manager/modules/neovim/plugins/neoscroll.nix b/home-manager/modules/neovim/plugins/neoscroll.nix new file mode 100644 index 0000000..cb1d686 --- /dev/null +++ b/home-manager/modules/neovim/plugins/neoscroll.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + programs.nixvim = { + plugins.neoscroll = { + enable = true; + }; + }; +} diff --git a/home-manager/modules/neovim/plugins/snacks.nix b/home-manager/modules/neovim/plugins/snacks.nix new file mode 100644 index 0000000..628ca4c --- /dev/null +++ b/home-manager/modules/neovim/plugins/snacks.nix @@ -0,0 +1,73 @@ +{ ... }: +{ + programs.nixvim = { + plugins.snacks = { + enable = true; + settings = { + bigfile.enabled = true; + bufdelete.enabled = true; + gitbrowse.enabled = true; + lazygit.enabled = true; + statuscolumn = { + enabled = true; + + folds = { + open = true; + git_hl = true; + }; + }; + }; + }; + keymaps = [ + { + mode = "n"; + key = "gg"; + action = "lua Snacks.lazygit()"; + options = { + desc = "Open Lazygit"; + silent = true; + }; + } + { + mode = "n"; + key = "go"; + action = "lua Snacks.gitbrowse()"; + options = { + desc = "Open file in browser"; + }; + } + { + mode = "n"; + key = "gl"; + action = "lua Snacks.lazygit.log()"; + options = { + desc = "Open Lazygit Log (cwd)"; + }; + } + { + mode = "n"; + key = "c"; + action = ''lua Snacks.bufdelete.delete()''; + options = { + desc = "Close buffer"; + }; + } + { + mode = "n"; + key = "bc"; + action = ''lua Snacks.bufdelete.other()''; + options = { + desc = "Close all buffers but current"; + }; + } + { + mode = "n"; + key = "bC"; + action = ''lua Snacks.bufdelete.all()''; + options = { + desc = "Close all buffers"; + }; + } + ]; + }; +} diff --git a/home-manager/modules/neovim/plugins/toggleterm.nix b/home-manager/modules/neovim/plugins/toggleterm.nix index e45efaa..27c0172 100644 --- a/home-manager/modules/neovim/plugins/toggleterm.nix +++ b/home-manager/modules/neovim/plugins/toggleterm.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.nixvim = { plugins.toggleterm = { enable = true; @@ -35,23 +36,6 @@ silent = true; }; } - { - mode = "n"; - key = "gg"; - action.__raw = - # lua - '' - function() - local toggleterm = require('toggleterm.terminal') - - toggleterm.Terminal:new({cmd = 'lazygit',hidden = true}):toggle() - end - ''; - options = { - desc = "Open Lazygit"; - silent = true; - }; - } ]; }; } diff --git a/home-manager/modules/neovim/plugins/zenmode.nix b/home-manager/modules/neovim/plugins/zenmode.nix new file mode 100644 index 0000000..f1e5b8a --- /dev/null +++ b/home-manager/modules/neovim/plugins/zenmode.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + programs.nixvim = { + plugins.zen-mode = { + enable = true; + }; + }; +}