From 359c8534f9e62d0fed1edfea7df5d59d815137fd Mon Sep 17 00:00:00 2001 From: Vivian Date: Fri, 29 Nov 2024 20:52:57 +0100 Subject: [PATCH] update aoife --- common/hm-modules/catppuccin/default.nix | 2 +- common/hm-modules/nvim/default.nix | 519 +++++++---------------- common/hm-modules/nvim/keybinds.nix | 146 +++++++ common/hm-modules/nvim/lsp.nix | 76 ++++ flake.lock | 80 ++-- flake.nix | 2 +- 6 files changed, 418 insertions(+), 407 deletions(-) create mode 100644 common/hm-modules/nvim/keybinds.nix create mode 100644 common/hm-modules/nvim/lsp.nix diff --git a/common/hm-modules/catppuccin/default.nix b/common/hm-modules/catppuccin/default.nix index c1f1bcdd..a17b7433 100644 --- a/common/hm-modules/catppuccin/default.nix +++ b/common/hm-modules/catppuccin/default.nix @@ -38,7 +38,7 @@ in }; programs.kitty = { - theme = "Catppuccin-Frappe"; + themeFile = "Catppuccin-Frappe"; font.name = "DejaVuSansMono Nerd Font"; }; diff --git a/common/hm-modules/nvim/default.nix b/common/hm-modules/nvim/default.nix index 99a23b4e..09a9ddc6 100644 --- a/common/hm-modules/nvim/default.nix +++ b/common/hm-modules/nvim/default.nix @@ -6,15 +6,6 @@ }: let cfg = config.programs.v.nvim; - nvim-nio = pkgs.vimUtils.buildVimPlugin { - name = "nvim-nio"; - src = pkgs.fetchFromGitHub { - owner = "nvim-neotest"; - repo = "nvim-nio"; - rev = "refs/tags/v1.8.0"; - sha256 = "sha256-RFmH+683vrg4BELwtAQqjV8oGkvRgzcd6kd5r1s3Jp8="; - }; - }; in with lib; { @@ -24,384 +15,182 @@ with lib; config = mkIf cfg.enable { home.packages = with pkgs; [ fd ]; home.file.".config/nvim/lua".source = ./lua; - programs.nixvim = {helpers, ...}: { - enable = true; - package = pkgs.neovim-unwrapped; - vimAlias = true; - luaLoader.enable = true; - - globals.mapleader = " "; - - opts = { - number = true; - conceallevel = 2; - expandtab = true; - tabstop = 2; - - shiftwidth = 2; - smartindent = true; - }; - - clipboard.providers.wl-copy.enable = true; - - keymaps = with helpers; [ - # General - { - mode = "n"; - key = ""; - action = ":noh"; - } - # Telescope - { - mode = "n"; - key = "ff"; - action = ":Telescope find_files"; - } - { - mode = "n"; - key = "fs"; - action = ":Telescope file_browser"; - } - { - mode = "n"; - key = "fg"; - action = mkRaw "require('telescope.builtin').live_grep"; - } - { - mode = "n"; - key = "fb"; - action = ":Telescope buffers"; - } - { - mode = "n"; - key = "fo"; - action = ":Telescope oldfiles"; - } - { - mode = "n"; - key = "fr"; - action = ":Telescope frecency"; - } - { - mode = "n"; - key = "ob"; - action = mkRaw "require('obsidian_picker').obsidian_picker"; - } - # Commenting - { - mode = "n"; - key = ""; - action = mkRaw "require('Comment.api').toggle.linewise.current"; - } - { - mode = "x"; - key = ""; - action = mkRaw '' - function() - local esc = vim.api.nvim_replace_termcodes( - '', true, false, true - ) - vim.api.nvim_feedkeys(esc, 'nx', false) - require('Comment.api').toggle.linewise(vim.fn.visualmode()) - end - ''; - } - # Float Term - { - mode = "n"; - key = "t"; - action = ":FloatermToggle myfloat"; - } - { - mode = "t"; - key = ""; - action = mkRaw "function() vim.cmd(':FloatermToggle myfloat') end"; - } - # Switch buffers - { - mode = "n"; - key = "q"; - action = ":bd"; # Delete buffer - } - { - mode = "n"; - key = "s"; - action = ":bn"; # Buffer next - } - { - mode = "n"; - key = "a"; - action = ":bp"; # Buffer previous - } - # Change Indenting - { - mode = "n"; - key = ""; - action = "<<_"; - } - { - mode = "n"; - key = ""; - action = ">>_"; - } - { - mode = "v"; - key = ""; - action = ">gv"; - } - { - mode = "v"; - key = ""; - action = "j" = "goto_next"; - "k" = "goto_prev"; - }; + treesitter = { + enable = true; + nixGrammars = true; + settings.highlight.enable = true; }; - servers = { - cssls.enable = true; - nil_ls.enable = true; #NixOS - dockerls.enable = true; - rust_analyzer = { + + fugitive.enable = true; + committia.enable = true; + + lualine = { + enable = true; + settings.options.theme = "catppuccin"; + }; + + telescope = { + enable = true; + settings.defaults.preview.ls_short = true; + extensions.file-browser = { enable = true; - installCargo = false; - installRustc = false; - }; - pyright.enable = true; - pylsp = { - enable = true; - settings.plugins = { - black = { - enabled = true; - cache_config = true; - }; - pycodestyle = { - maxLineLength = 100; - }; + settings = { + hijack_netrw = true; + dir_icon = ""; }; }; - elixirls.enable = true; - clangd.enable = true; - yamlls.enable = true; - lua_ls.enable = true; + extensions.fzf-native.enable = true; + extensions.fzf-native.settings.fuzzy = true; + extensions.frecency.enable = true; }; - }; - trouble.enable = true; - lspkind.enable = true; - lspsaga = { - enable = true; - lightbulb.enable = false; - }; - nvim-lightbulb = { - enable = true; - settings = { - autocmd.enabled = true; - number.enabled = true; - }; - }; - vimtex.enable = true; - floaterm.enable = true; - cmp = { - enable = true; - autoEnableSources = true; - settings = { - cmdline.":".sources = [ { name = "path"; } ]; - snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; - mapping = { - "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; - "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; - "" = "cmp.mapping.confirm({ select = true })"; - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.close()"; + comment.enable = true; + vimtex.enable = true; + floaterm.enable = true; + cmp = { + enable = true; + autoEnableSources = true; + settings = { + cmdline.":".sources = [ { name = "path"; } ]; + snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + mapping = { + "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.close()"; + }; + sources = [ + { name = "nvim_lsp_signature_help"; } + { name = "path"; } + { name = "nvim_lsp"; } + { name = "luasnip"; } + { + name = "buffer"; + # Words from other open buffers can also be suggested. + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + } + ]; }; - sources = [ - { name = "nvim_lsp_signature_help"; } - { name = "path"; } - { name = "nvim_lsp"; } - { name = "luasnip"; } - { - name = "buffer"; - # Words from other open buffers can also be suggested. - option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; - } - ]; }; }; }; - }; }; } diff --git a/common/hm-modules/nvim/keybinds.nix b/common/hm-modules/nvim/keybinds.nix new file mode 100644 index 00000000..a4df557d --- /dev/null +++ b/common/hm-modules/nvim/keybinds.nix @@ -0,0 +1,146 @@ +{ helpers, ... }: +{ + keymaps = with helpers; [ + # General + { + mode = "n"; + key = ""; + action = ":noh"; + } + # Telescope + { + mode = "n"; + key = "ff"; + action = ":Telescope find_files"; + } + { + mode = "n"; + key = "fs"; + action = ":Telescope file_browser"; + } + { + mode = "n"; + key = "fg"; + action = mkRaw "require('telescope.builtin').live_grep"; + } + { + mode = "n"; + key = "fb"; + action = ":Telescope buffers"; + } + { + mode = "n"; + key = "fo"; + action = ":Telescope oldfiles"; + } + { + mode = "n"; + key = "fr"; + action = ":Telescope frecency"; + } + { + mode = "n"; + key = "ob"; + action = mkRaw "require('obsidian_picker').obsidian_picker"; + } + # Commenting + { + mode = "n"; + key = ""; + action = mkRaw "require('Comment.api').toggle.linewise.current"; + } + { + mode = "x"; + key = ""; + action = mkRaw '' + function() + local esc = vim.api.nvim_replace_termcodes( + '', true, false, true + ) + vim.api.nvim_feedkeys(esc, 'nx', false) + require('Comment.api').toggle.linewise(vim.fn.visualmode()) + end + ''; + } + # Float Term + { + mode = "n"; + key = "t"; + action = ":FloatermToggle myfloat"; + } + { + mode = "t"; + key = ""; + action = mkRaw "function() vim.cmd(':FloatermToggle myfloat') end"; + } + # Switch buffers + { + mode = "n"; + key = "q"; + action = ":bd"; # Delete buffer + } + { + mode = "n"; + key = "s"; + action = ":bn"; # Buffer next + } + { + mode = "n"; + key = "a"; + action = ":bp"; # Buffer previous + } + # Change Indenting + { + mode = "i"; + key = ""; + action = "<<"; + } + { + mode = "n"; + key = ""; + action = "<<_"; + } + { + mode = "n"; + key = ""; + action = ">>_"; + } + { + mode = "v"; + key = ""; + action = ">gv"; + } + { + mode = "v"; + key = ""; + action = "rn" = "rename"; + "g=" = "format"; + }; + diagnostic = { + "j" = "goto_next"; + "k" = "goto_prev"; + }; + }; + servers = { + cssls.enable = true; + nil_ls.enable = true; # NixOS + dockerls.enable = true; + rust_analyzer = { + enable = true; + installCargo = false; + installRustc = false; + }; + pyright.enable = true; + pylsp = { + enable = true; + settings.plugins = { + black = { + enabled = true; + cache_config = true; + }; + pycodestyle = { + maxLineLength = 100; + }; + }; + }; + elixirls.enable = true; + clangd.enable = true; + yamlls.enable = true; + lua_ls.enable = true; + }; + }; + + trouble.enable = true; + lspkind.enable = true; + lspsaga = { + enable = true; + lightbulb.enable = false; + }; + nvim-lightbulb = { + enable = true; + settings = { + autocmd.enabled = true; + number.enabled = true; + }; + }; + + none-ls = { + enable = true; + sources = { + formatting = { + nixfmt = { + enable = true; + package = pkgs.nixfmt-rfc-style; + }; + }; + }; + }; + }; +} diff --git a/flake.lock b/flake.lock index a3531691..ff51efed 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ }, "catppuccin": { "locked": { - "lastModified": 1731232837, - "narHash": "sha256-0aIwr/RC/oe7rYkfJb47xjdEQDSNcqpFGsEa+EPlDEs=", + "lastModified": 1732838231, + "narHash": "sha256-KJTRqfEcGpONBK/6BkMdWmbGth0r/nYWY3k/rvZl4es=", "owner": "catppuccin", "repo": "nix", - "rev": "32359bf226fe874d3b7a0a5753d291a4da9616fe", + "rev": "becc64812c8d6af24dedc2f75c5c63ebf778a115", "type": "github" }, "original": { @@ -625,11 +625,11 @@ ] }, "locked": { - "lastModified": 1732420764, - "narHash": "sha256-u6JOOVlnGe8fMekW0BgaHuuZwbJp4ixQaMA5BEvRoDA=", + "lastModified": 1732884235, + "narHash": "sha256-r8j6R3nrvwbT1aUp4EPQ1KC7gm0pu9VcV1aNaB+XG6Q=", "owner": "nix-community", "repo": "home-manager", - "rev": "67cd4814a247fd0fe97171acb90659f7e304bcb8", + "rev": "819f682269f4e002884702b87e445c82840c68f2", "type": "github" }, "original": { @@ -646,11 +646,11 @@ ] }, "locked": { - "lastModified": 1732303962, - "narHash": "sha256-5Umjb5AdtxV5jSJd5jxoCckh5mlg+FBQDsyAilu637g=", + "lastModified": 1732482255, + "narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=", "owner": "nix-community", "repo": "home-manager", - "rev": "8cf9cb2ee78aa129e5b8220135a511a2be254c0c", + "rev": "a9953635d7f34e7358d5189751110f87e3ac17da", "type": "github" }, "original": { @@ -742,11 +742,11 @@ "spectrum": "spectrum" }, "locked": { - "lastModified": 1732122592, - "narHash": "sha256-lF54irx92m8ddNDQDtOUjKsZAnsGyPL3QTO7byjlxNg=", + "lastModified": 1732633513, + "narHash": "sha256-6LmtOmeDpv9iHS8l0GNcppP11dKIJFMZLdFyxQ+qQBM=", "owner": "astro", "repo": "microvm.nix", - "rev": "19650774c23df84d0b8f315d2527274563497cad", + "rev": "093ef734d3c37669860043a87dbf1c09fc6f5b38", "type": "github" }, "original": { @@ -763,11 +763,11 @@ ] }, "locked": { - "lastModified": 1732324260, - "narHash": "sha256-0xzQvoId/P008QkTSAdFVv465P9rL9nYkIOWXL5pdsY=", + "lastModified": 1732603785, + "narHash": "sha256-AEjWTJwOmSnVYsSJCojKgoguGfFfwel6z/6ud6UFMU8=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "698a62c628c2ec423aa770d8ec0e1d0bcf4fca1a", + "rev": "6ab87b7c84d4ee873e937108c4ff80c015a40c7a", "type": "github" }, "original": { @@ -820,11 +820,11 @@ }, "nixlib": { "locked": { - "lastModified": 1731805462, - "narHash": "sha256-yhEMW4MBi+IAyEJyiKbnFvY1uARyMKJpLUhkczI49wk=", + "lastModified": 1732410305, + "narHash": "sha256-/hxIKRTBsdrnudJWDGaBN8wIjHovqVAVxXdi8ByVtck=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "b9f04e3cf71c23bea21d2768051e6b3068d44734", + "rev": "87b6978992e2eb605732fba842cad0a7e14b2047", "type": "github" }, "original": { @@ -841,11 +841,11 @@ ] }, "locked": { - "lastModified": 1732151224, - "narHash": "sha256-5IgpueM8SGLOadzUJK6Gk37zEBXGd56BkNOtoWmnZos=", + "lastModified": 1732496924, + "narHash": "sha256-/MNhZLR0eh9z/d3l+ammq+F5XxHln0RHgO4Bhtjr0IM=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "3280fdde8c8f0276c9f5286ad5c0f433dfa5d56c", + "rev": "098e8b6ff72c86944a8d54b64ddd7b7e6635830a", "type": "github" }, "original": { @@ -856,11 +856,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1731797098, - "narHash": "sha256-UhWmEZhwJZmVZ1jfHZFzCg+ZLO9Tb/v3Y6LC0UNyeTo=", + "lastModified": 1732483221, + "narHash": "sha256-kF6rDeCshoCgmQz+7uiuPdREVFuzhIorGOoPXMalL2U=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "672ac2ac86f7dff2f6f3406405bddecf960e0db6", + "rev": "45348ad6fb8ac0e8415f6e5e96efe47dd7f39405", "type": "github" }, "original": { @@ -966,26 +966,26 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1731755305, - "narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=", + "lastModified": 1732521221, + "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4", + "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-24.11", + "ref": "nixos-unstable", "type": "indirect" } }, "nixpkgs_5": { "locked": { - "lastModified": 1732014248, - "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", + "lastModified": 1732521221, + "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", + "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d", "type": "github" }, "original": { @@ -1024,11 +1024,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1732365274, - "narHash": "sha256-78n1Z3+i686w1FHCWEiEimxvwJF/sgtG7Px0RyI9bLE=", + "lastModified": 1732838896, + "narHash": "sha256-9YfEyCU2wB/aSbtpZ+OHb++xS2Km970Ja33H13oEaWM=", "owner": "pta2002", "repo": "nixvim", - "rev": "85759f2360faa0464da008b040217183d99fd9d9", + "rev": "05331006a42846d6e55129b642485f45f90c9efc", "type": "github" }, "original": { @@ -1039,11 +1039,11 @@ }, "nur": { "locked": { - "lastModified": 1732438268, - "narHash": "sha256-5bhAbn8h2jv3HzlyaZ6nSypOlBLkfbbjXVsYueGSmvE=", + "lastModified": 1732877422, + "narHash": "sha256-ZDOlikQLTOnKek5J2bHItv0tWS6c1kdcLzVMseGd2rI=", "owner": "nix-community", "repo": "NUR", - "rev": "5347bd2ceaa9e1698d6efc2cf0fdcc0b1fb16213", + "rev": "c5bfbd142cb0d4aee8e8222934cf4c305548d4ac", "type": "github" }, "original": { @@ -1328,11 +1328,11 @@ ] }, "locked": { - "lastModified": 1732292307, - "narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=", + "lastModified": 1732643199, + "narHash": "sha256-uI7TXEb231o8dkwB5AUCecx3AQtosRmL6hKgnckvjps=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "705df92694af7093dfbb27109ce16d828a79155f", + "rev": "84637a7ab04179bdc42aa8fd0af1909fba76ad0c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f724c972..aa50e451 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ # * https://github.com/Infinidoge/nix-minecraft inputs = { - nixpkgs.url = "nixpkgs/nixos-24.11"; + nixpkgs.url = "nixpkgs/nixos-unstable"; flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus"; nur.url = "github:nix-community/NUR"; colmena.url = "github:zhaofengli/colmena";