diff --git a/README.md b/README.md index b740d79..4cdfd98 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,26 @@ # Neovim Configuration Flake -This is the Neovim configuration I use as a [home-manager](https://nix-community.github.io/home-manager/) module -for all my NixOS and home-manager enabled systems (such as with nix-darwin on macOS). +This is the Neovim configuration for all my NixOS and Nix enabled systems (such as with nix-darwin on macOS). +It aims to be minimal and utilitarian; it forgoes blingful features like status lines, sidebars, or fancy UI enhancements +in favor of native (neo)Vim, while still having everything useful you'd expect, like LSPs, file explorer (`yazi`), completions, +advanced language tools, and QoL enhancements. It uses the [Nixvim](https://nix-community.github.io/nixvim/) project under the hood to declaratively configure Neovim and its plugins, and installs some LSPs and other tools needed by it (like `yazi`, `fd`, etc). -It can be consumed directly in your configuration but as it contains many heavily opinionated and -personalized configuration options, you should probably just use it as inspiration or as an example -for your own config. +It simply outputs a package, called `nvim`. It can be called just like the regular `nvim` package, except it bundles +all of my custom configuration and their dependencies with the power of Nix. + +You can try it, remotely, in one line: +```sh +nix run 'github:youwen5/neovim-flake' +``` Feel free to fork or copy the config to use yourself. It's free in the [public domain](./LICENSE). +Thanks to [this gist](https://gist.github.com/siph/288b7c6b5f68a1902d28aebc95fde4c5) for showing me how to +build a Nixvim configuration as a standalone Nix package. + ## Usage Add it to your flake inputs, and import `homeManagerModules.default` as a home-manager module: diff --git a/config/default.nix b/config/default.nix new file mode 100644 index 0000000..76dd2bd --- /dev/null +++ b/config/default.nix @@ -0,0 +1,13 @@ +{pkgs, ...}: { + imports = [./plugins ./keymaps.nix ./init.nix]; + viAlias = true; + vimAlias = true; + withNodeJs = true; + withRuby = true; + + luaLoader.enable = true; + performance = { + combinePlugins.enable = true; + byteCompileLua.enable = true; + }; +} diff --git a/config/init.nix b/config/init.nix new file mode 100644 index 0000000..c5b2493 --- /dev/null +++ b/config/init.nix @@ -0,0 +1,10 @@ +# Basic housekeeping stuff that might run in a typical `init.lua` file. +{ + colorschemes.rose-pine.enable = true; + + opts = { + laststatus = 3; + relativenumber = true; + number = true; + }; +} diff --git a/config/keymaps.nix b/config/keymaps.nix new file mode 100644 index 0000000..44fcae1 --- /dev/null +++ b/config/keymaps.nix @@ -0,0 +1,358 @@ +{ + globals = { + mapleader = " "; + }; + + keymaps = [ + { + # Unmap space (leader) + action = ""; + key = ""; + options = { + noremap = true; + silent = true; + }; + mode = "n"; + } + { + action = "spj"; + key = "-"; + options.silent = true; + options.desc = "Split window horizontally"; + } + { + action = "vspl"; + key = "\\"; + options.silent = true; + options.desc = "Split window vertically"; + } + { + action = "ZenMode"; + key = "wz"; + options = { + silent = true; + noremap = true; + desc = "Zen mode"; + }; + } + { + action = "h"; + key = ""; + options = { + silent = true; + noremap = true; + desc = "Move to left window"; + }; + } + { + action = "j"; + key = ""; + options = { + silent = true; + noremap = true; + desc = "Move to lower window"; + }; + } + { + action = "k"; + key = ""; + options = { + silent = true; + noremap = true; + desc = "Move to upper window"; + }; + } + { + action = "l"; + key = ""; + options = { + silent = true; + noremap = true; + desc = "Move to right window"; + }; + } + { + action = "close"; + key = "wd"; + options = { + silent = true; + noremap = true; + desc = "Close current window"; + }; + } + { + action = "Telescope find_files"; + key = "ff"; + options = { + silent = true; + noremap = true; + desc = "Find files"; + }; + } + { + action = "Telescope live_grep"; + key = "/"; + options = { + silent = true; + noremap = true; + desc = "Live grep"; + }; + } + { + action = "Telescope buffers"; + key = "fb"; + options = { + silent = true; + noremap = true; + desc = "List buffers"; + }; + } + { + action = "Telescope help_tags"; + key = "fh"; + options = { + silent = true; + noremap = true; + desc = "Help tags"; + }; + } + { + action = "lua require'telescope.builtin'.lsp_definitions{}"; + key = "gd"; + options = { + silent = true; + noremap = true; + desc = "Go to definition"; + }; + } + { + action = "lua require'telescope.builtin'.git_files{}"; + key = " "; + options = { + silent = true; + noremap = true; + desc = "List Git files"; + }; + } + { + action = "lua require'telescope.builtin'.find_files{}"; + key = "ff"; + options = { + silent = true; + noremap = true; + desc = "List all files"; + }; + } + { + action = ""; + key = ""; + options = { + silent = true; + noremap = true; + desc = "Go to normal mode in built-in terminal."; + }; + mode = "t"; + } + { + action = ":resize +4"; + key = "w="; + options = { + silent = true; + noremap = true; + desc = "Increase window height."; + }; + } + { + action = ":resize -4"; + key = "w-"; + options = { + silent = true; + noremap = true; + desc = "Decrease window height."; + }; + } + { + action = ":vertical resize +4"; + key = "w]"; + options = { + silent = true; + noremap = true; + desc = "Increase window width."; + }; + } + { + action = ":vertical resize -4"; + key = "w["; + options = { + silent = true; + noremap = true; + desc = "Decrease window width."; + }; + } + { + action = ":Bdelete!"; + key = "bd"; + options = { + silent = true; + noremap = true; + desc = "Close buffer"; + }; + } + { + action = ":bprev"; + key = "H"; + options = { + silent = true; + noremap = true; + desc = "Move to the previous buffer."; + }; + } + { + action = ":bnext"; + key = "L"; + options = { + silent = true; + noremap = true; + desc = "Move to the next buffer."; + }; + } + { + action = ":LazyGit"; + key = "gg"; + options = { + silent = true; + noremap = true; + desc = "Open LazyGit"; + }; + } + { + action = ":split | wincmd j | resize 15 | term"; + key = "tt"; + options = { + silent = true; + noremap = true; + desc = "Open a half-size horizontal terminal split"; + }; + mode = "n"; + } + { + action = ":split | wincmd j | term"; + key = "te"; + options = { + silent = true; + noremap = true; + desc = "Open a horizontal terminal split"; + }; + mode = "n"; + } + { + action = ":vsplit | wincmd l | term"; + key = "tv"; + options = { + silent = true; + noremap = true; + desc = "Open a vertical terminal split"; + }; + mode = "n"; + } + { + action = ":Trouble diagnostics"; + key = "xx"; + options = { + silent = true; + noremap = true; + desc = "View trouble diagnostics"; + }; + mode = "n"; + } + { + action = ":Trouble symbols"; + key = "xs"; + options = { + silent = true; + noremap = true; + desc = "View symbols"; + }; + mode = "n"; + } + { + action = "(YankyPutAfter)"; + key = "p"; + mode = ["n" "x"]; + } + { + action = "(YankyPutBefore)"; + key = "P"; + mode = ["n" "x"]; + } + { + action = "(YankyGPutAfter)"; + key = "gp"; + mode = ["n" "x"]; + } + { + action = "(YankyGPutBefore)"; + key = "gP"; + mode = ["n" "x"]; + } + { + action = ":Telescope yank_history"; + key = "p"; + mode = "n"; + } + { + action = '':lua require("yazi").yazi()''; + key = "mm"; + options = { + desc = "Open Yazi current nvim working directory"; + noremap = true; + silent = true; + }; + } + { + action = '':lua vim.lsp.buf.code_action()''; + key = "ca"; + options = { + desc = "View available code actions"; + noremap = true; + silent = true; + }; + } + { + action = '':lua vim.lsp.buf.rename()''; + key = "cr"; + options = { + desc = "Rename symbol"; + noremap = true; + silent = true; + }; + } + { + action = '':lua require("lsp_lines").toggle()''; + key = "cd"; + options = { + desc = "Toggle lsp lines"; + noremap = true; + silent = true; + }; + } + # { + # action = ":Yazi"; + # key = "mf"; + # options = { + # desc = "Open Yazi at current file"; + # noremap = true; + # silent = true; + # }; + # } + # { + # action = "lua require'conform'.format({ bufnr = args.bf })"; + # key = "cf"; + # options = { + # silent = true; + # noremap = true; + # desc = "Format buffer"; + # }; + # } + ]; +} diff --git a/homeManagerModule/plugins/cmp.nix b/config/plugins/cmp.nix similarity index 98% rename from homeManagerModule/plugins/cmp.nix rename to config/plugins/cmp.nix index 1474253..4ccbde1 100644 --- a/homeManagerModule/plugins/cmp.nix +++ b/config/plugins/cmp.nix @@ -1,5 +1,5 @@ { - programs.nixvim.plugins = { + plugins = { cmp-async-path.enable = true; cmp = { enable = true; diff --git a/homeManagerModule/plugins/default.nix b/config/plugins/default.nix similarity index 100% rename from homeManagerModule/plugins/default.nix rename to config/plugins/default.nix diff --git a/config/plugins/formatters.nix b/config/plugins/formatters.nix new file mode 100644 index 0000000..2100848 --- /dev/null +++ b/config/plugins/formatters.nix @@ -0,0 +1,45 @@ +# Code formatters +{pkgs, ...}: { + extraPackages = with pkgs; [ + # TS/JS + nodePackages.prettier + + # Rust + rustfmt + + # Nix + alejandra + + # Python + black + + # Lua + stylua + + # Haskell + haskellPackages.fourmolu + + # Misc + codespell + ]; + + plugins.conform-nvim = { + enable = true; + settings = { + format_on_save = { + timeoutMs = 500; + lspFallback = true; + }; + formatters_by_ft = { + lua = ["stylua"]; + python = ["black"]; + nix = ["alejandra"]; + svelte = ["prettier"]; + rust = ["rustfmt"]; + haskell = ["fourmolu"]; + "*" = ["codespell"]; + "_" = ["trim_whitespace"]; + }; + }; + }; +} diff --git a/config/plugins/lsps.nix b/config/plugins/lsps.nix new file mode 100644 index 0000000..61be804 --- /dev/null +++ b/config/plugins/lsps.nix @@ -0,0 +1,47 @@ +# LSP setup +{pkgs, ...}: { + extraPackages = with pkgs; [ + rust-analyzer + lua-language-server + ]; + + plugins.lsp = { + enable = true; + inlayHints = true; + servers = { + bashls.enable = true; + clangd.enable = true; + pyright.enable = true; + nixd.enable = true; + nushell.enable = true; + svelte.enable = true; + tailwindcss.enable = true; + # typst-lsp.enable = true; + marksman.enable = true; + }; + }; + plugins = { + typescript-tools.enable = true; + }; + plugins.lsp-lines.enable = true; + extraPlugins = [ + (pkgs.vimUtils.buildVimPlugin { + name = "haskell-tools-nvim"; + src = pkgs.fetchFromGitHub { + owner = "mrcjkb"; + repo = "haskell-tools.nvim"; + rev = "959eac0fadbdd27442904a8cb363f39afb528027"; + hash = "sha256-5CS5kvUSqQJe7iFFpicinBjCQXgFPL0ElGgnrZHTT+Y="; + }; + }) + (pkgs.vimUtils.buildVimPlugin { + name = "rustaceanvim"; + src = pkgs.fetchFromGitHub { + owner = "mrcjkb"; + repo = "rustaceanvim"; + rev = "7cba8e599deca98d4b44cac1bcbd720c62937d90"; + hash = "sha256-OYfeJuo4FZUBdW9wGGCT0lZGYr/ur1uy8frcyUJMF3k="; + }; + }) + ]; +} diff --git a/homeManagerModule/plugins/mini.nix b/config/plugins/mini.nix similarity index 88% rename from homeManagerModule/plugins/mini.nix rename to config/plugins/mini.nix index 5ef2303..7ac2321 100644 --- a/homeManagerModule/plugins/mini.nix +++ b/config/plugins/mini.nix @@ -1,6 +1,6 @@ # All the mini.nvim stuff { - programs.nixvim.plugins.mini = { + plugins.mini = { enable = true; modules = { surround = {}; diff --git a/homeManagerModule/plugins/misc.nix b/config/plugins/misc.nix similarity index 93% rename from homeManagerModule/plugins/misc.nix rename to config/plugins/misc.nix index 7f97c9c..822ffec 100644 --- a/homeManagerModule/plugins/misc.nix +++ b/config/plugins/misc.nix @@ -1,6 +1,6 @@ # Misc stuff { - programs.nixvim.plugins = { + plugins = { # Extra (stuff that doesn't affect editing) wakatime.enable = true; presence-nvim = { diff --git a/homeManagerModule/plugins/navigation.nix b/config/plugins/navigation.nix similarity index 97% rename from homeManagerModule/plugins/navigation.nix rename to config/plugins/navigation.nix index 117d1f0..cbf994d 100644 --- a/homeManagerModule/plugins/navigation.nix +++ b/config/plugins/navigation.nix @@ -1,6 +1,6 @@ # Getting around REALLY FAST { - programs.nixvim.plugins = { + plugins = { telescope = { enable = true; extensions = { diff --git a/config/plugins/qol.nix b/config/plugins/qol.nix new file mode 100644 index 0000000..ceaee02 --- /dev/null +++ b/config/plugins/qol.nix @@ -0,0 +1,50 @@ +# Quality of life plugins +{pkgs, ...}: { + extraPackages = with pkgs; [ + ripgrep + yazi + fd + ]; + + plugins = { + zen-mode.enable = true; + direnv.enable = true; + intellitab.enable = true; + guess-indent.enable = true; + vim-bbye.enable = true; + indent-blankline.enable = true; + which-key.enable = true; + nvim-autopairs.enable = true; + yanky = { + enable = true; + enableTelescope = true; + }; + trouble.enable = true; + crates-nvim.enable = true; + # git stuff + lazygit.enable = true; + gitsigns.enable = true; + # Language specific tools + markdown-preview.enable = true; + }; + extraPlugins = [ + (pkgs.vimUtils.buildVimPlugin { + name = "satellite.nvim"; + src = pkgs.fetchFromGitHub { + owner = "lewis6991"; + repo = "satellite.nvim"; + rev = "777ed56e1ef45ec808df701730b6597fc4fb0fbc"; + hash = "sha256-04Js+9SB4VuCq/ACbNh5BZcolu8i8vlGU72qo5xxfpk="; + }; + }) + (pkgs.vimUtils.buildVimPlugin { + name = "render-markdown.nvim"; + src = pkgs.fetchFromGitHub { + owner = "MeanderingProgrammer"; + repo = "render-markdown.nvim"; + rev = "7986be47531d652e950776536987e01dd5b55b94"; + hash = "sha256-lc++IrXzEA3M2iUFZACAZOcH2EwVqX4p0fhET+en37o="; + }; + }) + ]; +} diff --git a/config/plugins/setup.nix b/config/plugins/setup.nix new file mode 100644 index 0000000..45ac422 --- /dev/null +++ b/config/plugins/setup.nix @@ -0,0 +1,7 @@ +# Manual setup for some plugins +{ + extraConfigLua = '' + require("telescope").load_extension("yank_history") + vim.diagnostic.config({ virtual_lines = false }); + ''; +} diff --git a/config/plugins/treesitter.nix b/config/plugins/treesitter.nix new file mode 100644 index 0000000..ffbc373 --- /dev/null +++ b/config/plugins/treesitter.nix @@ -0,0 +1,13 @@ +{ + plugins = { + treesitter = { + enable = true; + settings = { + highlight.enable = true; + indent.enable = true; + folding.enable = true; + }; + }; + treesitter-context.enable = true; + }; +} diff --git a/flake.lock b/flake.lock index e89a167..80023b2 100644 --- a/flake.lock +++ b/flake.lock @@ -36,6 +36,24 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -170,24 +188,37 @@ }, "nixpkgs": { "locked": { - "lastModified": 1724558323, - "narHash": "sha256-uPXidysk1BXSayGzpxDW8JUgGvLWS+L1CTlBV3xcQB4=", - "owner": "NixOS", + "lastModified": 1724224976, + "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "ba0c72cea47a45556ccd5bc566433bd1242a0f93", + "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", "type": "github" }, "original": { - "owner": "NixOS", + "owner": "nixos", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1722555339, + "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + } + }, "nixvim": { "inputs": { "devshell": "devshell", "flake-compat": "flake-compat", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "git-hooks": "git-hooks", "home-manager": "home-manager", "nix-darwin": "nix-darwin", @@ -235,6 +266,7 @@ }, "root": { "inputs": { + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", "nixvim": "nixvim" } diff --git a/flake.nix b/flake.nix index fe8747a..5fbdcb1 100644 --- a/flake.nix +++ b/flake.nix @@ -2,20 +2,46 @@ description = "Personal Neovim configuration."; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs"; - nixvim = { - url = "github:nix-community/nixvim"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixvim.url = "github:nix-community/nixvim"; + nixvim.inputs.nixpkgs.follows = "nixpkgs"; + flake-parts.url = "github:hercules-ci/flake-parts"; }; outputs = { nixvim, - nixpkgs, + flake-parts, ... - }: { - homeManagerModules.default = { - imports = [nixvim.homeManagerModules.nixvim ./homeManagerModule]; + } @ inputs: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + perSystem = { + pkgs, + system, + ... + }: let + nixvimLib = nixvim.lib.${system}; + nixvim' = nixvim.legacyPackages.${system}; + nixvimModule = { + inherit pkgs; + module = import ./config; + }; + nvim = nixvim'.makeNixvimWithModule nixvimModule; + in { + formatter = pkgs.alejandra; + checks = { + default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule; + }; + + packages = { + default = nvim; + }; + }; }; - }; } diff --git a/homeManagerModule/default.nix b/homeManagerModule/default.nix deleted file mode 100644 index 2c6fc83..0000000 --- a/homeManagerModule/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{pkgs, ...}: { - imports = [./plugins ./keymaps.nix ./init.nix]; - programs.nixvim = { - enable = true; - viAlias = true; - vimAlias = true; - withNodeJs = true; - withRuby = true; - - luaLoader.enable = true; - performance = { - combinePlugins.enable = true; - byteCompileLua.enable = true; - }; - }; -} diff --git a/homeManagerModule/init.nix b/homeManagerModule/init.nix deleted file mode 100644 index 3826d5a..0000000 --- a/homeManagerModule/init.nix +++ /dev/null @@ -1,12 +0,0 @@ -# Basic housekeeping stuff that might run in a typical `init.lua` file. -{ - programs.nixvim = { - colorschemes.rose-pine.enable = true; - - opts = { - laststatus = 3; - relativenumber = true; - number = true; - }; - }; -} diff --git a/homeManagerModule/keymaps.nix b/homeManagerModule/keymaps.nix deleted file mode 100644 index 9c1ad28..0000000 --- a/homeManagerModule/keymaps.nix +++ /dev/null @@ -1,360 +0,0 @@ -{ - programs.nixvim = { - globals = { - mapleader = " "; - }; - - keymaps = [ - { - # Unmap space (leader) - action = ""; - key = ""; - options = { - noremap = true; - silent = true; - }; - mode = "n"; - } - { - action = "spj"; - key = "-"; - options.silent = true; - options.desc = "Split window horizontally"; - } - { - action = "vspl"; - key = "\\"; - options.silent = true; - options.desc = "Split window vertically"; - } - { - action = "ZenMode"; - key = "wz"; - options = { - silent = true; - noremap = true; - desc = "Zen mode"; - }; - } - { - action = "h"; - key = ""; - options = { - silent = true; - noremap = true; - desc = "Move to left window"; - }; - } - { - action = "j"; - key = ""; - options = { - silent = true; - noremap = true; - desc = "Move to lower window"; - }; - } - { - action = "k"; - key = ""; - options = { - silent = true; - noremap = true; - desc = "Move to upper window"; - }; - } - { - action = "l"; - key = ""; - options = { - silent = true; - noremap = true; - desc = "Move to right window"; - }; - } - { - action = "close"; - key = "wd"; - options = { - silent = true; - noremap = true; - desc = "Close current window"; - }; - } - { - action = "Telescope find_files"; - key = "ff"; - options = { - silent = true; - noremap = true; - desc = "Find files"; - }; - } - { - action = "Telescope live_grep"; - key = "/"; - options = { - silent = true; - noremap = true; - desc = "Live grep"; - }; - } - { - action = "Telescope buffers"; - key = "fb"; - options = { - silent = true; - noremap = true; - desc = "List buffers"; - }; - } - { - action = "Telescope help_tags"; - key = "fh"; - options = { - silent = true; - noremap = true; - desc = "Help tags"; - }; - } - { - action = "lua require'telescope.builtin'.lsp_definitions{}"; - key = "gd"; - options = { - silent = true; - noremap = true; - desc = "Go to definition"; - }; - } - { - action = "lua require'telescope.builtin'.git_files{}"; - key = " "; - options = { - silent = true; - noremap = true; - desc = "List Git files"; - }; - } - { - action = "lua require'telescope.builtin'.find_files{}"; - key = "ff"; - options = { - silent = true; - noremap = true; - desc = "List all files"; - }; - } - { - action = ""; - key = ""; - options = { - silent = true; - noremap = true; - desc = "Go to normal mode in built-in terminal."; - }; - mode = "t"; - } - { - action = ":resize +4"; - key = "w="; - options = { - silent = true; - noremap = true; - desc = "Increase window height."; - }; - } - { - action = ":resize -4"; - key = "w-"; - options = { - silent = true; - noremap = true; - desc = "Decrease window height."; - }; - } - { - action = ":vertical resize +4"; - key = "w]"; - options = { - silent = true; - noremap = true; - desc = "Increase window width."; - }; - } - { - action = ":vertical resize -4"; - key = "w["; - options = { - silent = true; - noremap = true; - desc = "Decrease window width."; - }; - } - { - action = ":Bdelete!"; - key = "bd"; - options = { - silent = true; - noremap = true; - desc = "Close buffer"; - }; - } - { - action = ":bprev"; - key = "H"; - options = { - silent = true; - noremap = true; - desc = "Move to the previous buffer."; - }; - } - { - action = ":bnext"; - key = "L"; - options = { - silent = true; - noremap = true; - desc = "Move to the next buffer."; - }; - } - { - action = ":LazyGit"; - key = "gg"; - options = { - silent = true; - noremap = true; - desc = "Open LazyGit"; - }; - } - { - action = ":split | wincmd j | resize 15 | term"; - key = "tt"; - options = { - silent = true; - noremap = true; - desc = "Open a half-size horizontal terminal split"; - }; - mode = "n"; - } - { - action = ":split | wincmd j | term"; - key = "te"; - options = { - silent = true; - noremap = true; - desc = "Open a horizontal terminal split"; - }; - mode = "n"; - } - { - action = ":vsplit | wincmd l | term"; - key = "tv"; - options = { - silent = true; - noremap = true; - desc = "Open a vertical terminal split"; - }; - mode = "n"; - } - { - action = ":Trouble diagnostics"; - key = "xx"; - options = { - silent = true; - noremap = true; - desc = "View trouble diagnostics"; - }; - mode = "n"; - } - { - action = ":Trouble symbols"; - key = "xs"; - options = { - silent = true; - noremap = true; - desc = "View symbols"; - }; - mode = "n"; - } - { - action = "(YankyPutAfter)"; - key = "p"; - mode = ["n" "x"]; - } - { - action = "(YankyPutBefore)"; - key = "P"; - mode = ["n" "x"]; - } - { - action = "(YankyGPutAfter)"; - key = "gp"; - mode = ["n" "x"]; - } - { - action = "(YankyGPutBefore)"; - key = "gP"; - mode = ["n" "x"]; - } - { - action = ":Telescope yank_history"; - key = "p"; - mode = "n"; - } - { - action = '':lua require("yazi").yazi()''; - key = "mm"; - options = { - desc = "Open Yazi current nvim working directory"; - noremap = true; - silent = true; - }; - } - { - action = '':lua vim.lsp.buf.code_action()''; - key = "ca"; - options = { - desc = "View available code actions"; - noremap = true; - silent = true; - }; - } - { - action = '':lua vim.lsp.buf.rename()''; - key = "cr"; - options = { - desc = "Rename symbol"; - noremap = true; - silent = true; - }; - } - { - action = '':lua require("lsp_lines").toggle()''; - key = "cd"; - options = { - desc = "Toggle lsp lines"; - noremap = true; - silent = true; - }; - } - # { - # action = ":Yazi"; - # key = "mf"; - # options = { - # desc = "Open Yazi at current file"; - # noremap = true; - # silent = true; - # }; - # } - # { - # action = "lua require'conform'.format({ bufnr = args.bf })"; - # key = "cf"; - # options = { - # silent = true; - # noremap = true; - # desc = "Format buffer"; - # }; - # } - ]; - }; -} diff --git a/homeManagerModule/plugins/formatters.nix b/homeManagerModule/plugins/formatters.nix deleted file mode 100644 index 12f9335..0000000 --- a/homeManagerModule/plugins/formatters.nix +++ /dev/null @@ -1,47 +0,0 @@ -# Code formatters -{pkgs, ...}: { - programs.nixvim = { - extraPackages = with pkgs; [ - # TS/JS - nodePackages.prettier - - # Rust - rustfmt - - # Nix - alejandra - - # Python - black - - # Lua - stylua - - # Haskell - haskellPackages.fourmolu - - # Misc - codespell - ]; - - plugins.conform-nvim = { - enable = true; - settings = { - format_on_save = { - timeoutMs = 500; - lspFallback = true; - }; - formatters_by_ft = { - lua = ["stylua"]; - python = ["black"]; - nix = ["alejandra"]; - svelte = ["prettier"]; - rust = ["rustfmt"]; - haskell = ["fourmolu"]; - "*" = ["codespell"]; - "_" = ["trim_whitespace"]; - }; - }; - }; - }; -} diff --git a/homeManagerModule/plugins/lsps.nix b/homeManagerModule/plugins/lsps.nix deleted file mode 100644 index 61a1d91..0000000 --- a/homeManagerModule/plugins/lsps.nix +++ /dev/null @@ -1,49 +0,0 @@ -# LSP setup -{pkgs, ...}: { - programs.nixvim = { - extraPackages = with pkgs; [ - rust-analyzer - lua-language-server - ]; - - plugins.lsp = { - enable = true; - inlayHints = true; - servers = { - bashls.enable = true; - clangd.enable = true; - pyright.enable = true; - nixd.enable = true; - nushell.enable = true; - svelte.enable = true; - tailwindcss.enable = true; - typst-lsp.enable = true; - marksman.enable = true; - }; - }; - plugins = { - typescript-tools.enable = true; - }; - plugins.lsp-lines.enable = true; - extraPlugins = [ - (pkgs.vimUtils.buildVimPlugin { - name = "haskell-tools-nvim"; - src = pkgs.fetchFromGitHub { - owner = "mrcjkb"; - repo = "haskell-tools.nvim"; - rev = "959eac0fadbdd27442904a8cb363f39afb528027"; - hash = "sha256-5CS5kvUSqQJe7iFFpicinBjCQXgFPL0ElGgnrZHTT+Y="; - }; - }) - (pkgs.vimUtils.buildVimPlugin { - name = "rustaceanvim"; - src = pkgs.fetchFromGitHub { - owner = "mrcjkb"; - repo = "rustaceanvim"; - rev = "7cba8e599deca98d4b44cac1bcbd720c62937d90"; - hash = "sha256-OYfeJuo4FZUBdW9wGGCT0lZGYr/ur1uy8frcyUJMF3k="; - }; - }) - ]; - }; -} diff --git a/homeManagerModule/plugins/qol.nix b/homeManagerModule/plugins/qol.nix deleted file mode 100644 index 09c3795..0000000 --- a/homeManagerModule/plugins/qol.nix +++ /dev/null @@ -1,52 +0,0 @@ -# Quality of life plugins -{pkgs, ...}: { - programs.nixvim = { - extraPackages = with pkgs; [ - ripgrep - yazi - fd - ]; - - plugins = { - zen-mode.enable = true; - direnv.enable = true; - intellitab.enable = true; - guess-indent.enable = true; - vim-bbye.enable = true; - indent-blankline.enable = true; - which-key.enable = true; - nvim-autopairs.enable = true; - yanky = { - enable = true; - enableTelescope = true; - }; - trouble.enable = true; - crates-nvim.enable = true; - # git stuff - lazygit.enable = true; - gitsigns.enable = true; - # Language specific tools - markdown-preview.enable = true; - }; - extraPlugins = [ - (pkgs.vimUtils.buildVimPlugin { - name = "satellite.nvim"; - src = pkgs.fetchFromGitHub { - owner = "lewis6991"; - repo = "satellite.nvim"; - rev = "777ed56e1ef45ec808df701730b6597fc4fb0fbc"; - hash = "sha256-04Js+9SB4VuCq/ACbNh5BZcolu8i8vlGU72qo5xxfpk="; - }; - }) - (pkgs.vimUtils.buildVimPlugin { - name = "render-markdown.nvim"; - src = pkgs.fetchFromGitHub { - owner = "MeanderingProgrammer"; - repo = "render-markdown.nvim"; - rev = "7986be47531d652e950776536987e01dd5b55b94"; - hash = "sha256-lc++IrXzEA3M2iUFZACAZOcH2EwVqX4p0fhET+en37o="; - }; - }) - ]; - }; -} diff --git a/homeManagerModule/plugins/setup.nix b/homeManagerModule/plugins/setup.nix deleted file mode 100644 index 0fa840f..0000000 --- a/homeManagerModule/plugins/setup.nix +++ /dev/null @@ -1,9 +0,0 @@ -# Manual setup for some plugins -{ - programs.nixvim = { - extraConfigLua = '' - require("telescope").load_extension("yank_history") - vim.diagnostic.config({ virtual_lines = false }); - ''; - }; -} diff --git a/homeManagerModule/plugins/treesitter.nix b/homeManagerModule/plugins/treesitter.nix deleted file mode 100644 index 2e0766e..0000000 --- a/homeManagerModule/plugins/treesitter.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - programs.nixvim = { - plugins = { - treesitter = { - enable = true; - settings = { - highlight.enable = true; - indent.enable = true; - folding.enable = true; - }; - }; - treesitter-context.enable = true; - }; - }; -}