commit 7081958f861a0f2f6ebdba573f9e404f7702ea04 Author: Maddie Holbrook Date: Sat Sep 7 20:51:15 2024 +0100 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/config/basics/colorscheme.nix b/config/basics/colorscheme.nix new file mode 100644 index 0000000..c1ae4af --- /dev/null +++ b/config/basics/colorscheme.nix @@ -0,0 +1,9 @@ +{ + colorschemes.onedark = { + enable = true; + settings = { + style = "darker"; + transparent = false; + }; + }; +} diff --git a/config/basics/keymaps.nix b/config/basics/keymaps.nix new file mode 100644 index 0000000..6a14d40 --- /dev/null +++ b/config/basics/keymaps.nix @@ -0,0 +1,345 @@ +{ + keymaps = [ + # Custom/special keymaps + { + mode = "n"; + key = "c"; + action = "sp term resize 20N i"; + options = { + silent = true; + desc = "Open terminal in split and resize"; + }; + } + { + mode = "n"; + key = "h"; + action = "nohl"; + options = { + silent = true; + desc = "Clear search highlight"; + }; + } + { + mode = "n"; + key = "z"; + action = "ZenModeset wrapset linebreak"; + options = { + silent = true; + desc = "Enable ZenMode with wrap and linebreak"; + }; + } + { + mode = "n"; + key = "Z"; + action = "ZenModeset nowrapset nolinebreak"; + options = { + silent = true; + desc = "Enable ZenMode without wrap and linebreak"; + }; + } + { + mode = "n"; + key = ""; + action = "Telescope colorscheme"; + options = { + silent = true; + desc = "Open Telescope colorscheme picker"; + }; + } + { + mode = "n"; + key = ""; + action = "wqa"; + options = { + silent = true; + desc = "Save all and quit"; + }; + } + { + mode = "n"; + key = ""; + action = "w"; + options = { + silent = true; + desc = "Save file"; + }; + } + { + mode = "n"; + key = "U"; + action = "redo"; + options = { + silent = true; + desc = "Redo last undone change"; + }; + } + + # Window management + { + mode = "n"; + key = "vs"; + action = "vs"; + options = { + silent = true; + desc = "Vertical split"; + }; + } + { + mode = "n"; + key = "hs"; + action = "sp"; + options = { + silent = true; + desc = "Horizontal split"; + }; + } + { + mode = "n"; + key = "tn"; + action = "tabnew"; + options = { + silent = true; + desc = "Open new tab"; + }; + } + { + mode = "n"; + key = "th"; + action = "tabprev"; + options = { + silent = true; + desc = "Go to previous tab"; + }; + } + { + mode = "n"; + key = "tj"; + action = "tabprev"; + options = { + silent = true; + desc = "Go to previous tab"; + }; + } + { + mode = "n"; + key = "tk"; + action = "tabnext"; + options = { + silent = true; + desc = "Go to next tab"; + }; + } + { + mode = "n"; + key = "tl"; + action = "tabnext"; + options = { + silent = true; + desc = "Go to next tab"; + }; + } + { + mode = "n"; + key = "to"; + action = "tabo"; + options = { + silent = true; + desc = "Close all other tabs"; + }; + } + { + mode = "n"; + key = "tc"; + action = "tabc"; + options = { + silent = true; + desc = "Close current tab"; + }; + } + + # Window navigation + { + mode = "n"; + key = ""; + action = "w"; + options = { + silent = true; + desc = "Cycle through windows"; + }; + } + { + mode = "n"; + key = ""; + action = "h"; + options = { + silent = true; + desc = "Move to the left window"; + }; + } + { + mode = "n"; + key = ""; + action = "j"; + options = { + silent = true; + desc = "Move to the bottom window"; + }; + } + { + mode = "n"; + key = ""; + action = "k"; + options = { + silent = true; + desc = "Move to the top window"; + }; + } + { + mode = "n"; + key = ""; + action = "l"; + options = { + silent = true; + desc = "Move to the right window"; + }; + } + + # Buffer navigation + { + mode = "n"; + key = ""; + action = "bnext"; + options = { + silent = true; + desc = "Go to next buffer"; + }; + } + { + mode = "n"; + key = ""; + action = "bprevious"; + options = { + silent = true; + desc = "Go to previous buffer"; + }; + } + + # Stay in visual mode when indenting + { + mode = "v"; + key = "<"; + action = "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = '' + cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + } + ''; + "" = '' + cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- elseif luasnip.expand_or_jumpable() then + -- luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }) + ''; + "" = '' + cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + -- elseif luasnip.jumpable(-1) then + -- luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }) + ''; + }; + + sources = [ + { + name = "luasnip"; + groupIndex = 1; + priority = 5; + max_item_count = 5; + } + { + name = "copilot"; + groupIndex = 1; + priority = 4; + max_item_count = 5; + } + { + name = "nvim_lsp"; + groupIndex = 1; + priority = 3; + max_item_count = 5; + } + { name = "path"; } + { name = "buffer"; } + { name = "dictionary"; } + ]; + }; + }; +} diff --git a/config/lsp/copilot.nix b/config/lsp/copilot.nix new file mode 100644 index 0000000..53874da --- /dev/null +++ b/config/lsp/copilot.nix @@ -0,0 +1,23 @@ +{ + plugins.copilot-lua = { + enable = true; + + panel.enabled = false; + suggestion.enabled = false; + + filetypes = { + yaml = false; + markdown = false; + help = false; + gitcommit = false; + gitrebase = false; + hgcommit = false; + svn = false; + cvs = false; + "." = false; + "*" = true; + }; + }; + + plugins.copilot-cmp.enable = true; +} \ No newline at end of file diff --git a/config/lsp/lsp.nix b/config/lsp/lsp.nix new file mode 100644 index 0000000..4c57dee --- /dev/null +++ b/config/lsp/lsp.nix @@ -0,0 +1,59 @@ +{ + plugins.lsp = { + enable = true; + + servers = { + # TypeScript / JavaScript + tsserver.enable = true; + + # HTML + html.enable = true; + + # CSS + cssls.enable = true; + + # JSON + jsonls.enable = true; + + # Rust + rust-analyzer = { + enable = true; + installRustc = true; + installCargo = true; + }; + + # Python + pyright.enable = true; + + # C/C++ + ccls.enable = true; + + # Yaml + yamlls.enable = true; + + # Lua + lua-ls.enable = true; + + # Nix + nil-ls.enable = true; + }; + }; + + plugins.lsp-format.enable = true; + + autoCmd = [ + { + event = [ + "BufRead" + "BufNewFile" + ]; + pattern = [ + "*.txt" + "*.md" + "*.tex" + "LICENSE" + ]; + command = "setlocal spell"; + } + ]; +} \ No newline at end of file diff --git a/config/lsp/treesitter.nix b/config/lsp/treesitter.nix new file mode 100644 index 0000000..5912d24 --- /dev/null +++ b/config/lsp/treesitter.nix @@ -0,0 +1,3 @@ +{ + plugins.treesitter.enable = true; +} \ No newline at end of file diff --git a/config/lsp/vimtex.nix b/config/lsp/vimtex.nix new file mode 100644 index 0000000..a0ede62 --- /dev/null +++ b/config/lsp/vimtex.nix @@ -0,0 +1,3 @@ +{ + plugins.vimtex.enable = true; +} diff --git a/config/ui/bufferline.nix b/config/ui/bufferline.nix new file mode 100644 index 0000000..2260c89 --- /dev/null +++ b/config/ui/bufferline.nix @@ -0,0 +1,5 @@ +{ + plugins.bufferline = { + enable = false; + }; +} diff --git a/config/ui/dashboard.nix b/config/ui/dashboard.nix new file mode 100644 index 0000000..d69c80d --- /dev/null +++ b/config/ui/dashboard.nix @@ -0,0 +1,61 @@ +{ + plugins.dashboard = { + enable = true; + settings = { + change_to_vcs_root = true; + shortcut_type = "letter"; + + hide = { + statusline = true; + tabline = true; + }; + + config = { + disable_move = true; + header = [ + " _ __ _ ___ " + " / | / /__ ____| | / (_)___ ___ " + " / |/ / _ \\/ __ \\ | / / / __ `__ \\" + " / /| / __/ /_/ / |/ / / / / / / /" + "/_/ |_/\\___/\\____/|___/_/_/ /_/ /_/ " + " " + ]; + footer = [ "NeoVim" ]; + + mru = { + cwd_only = true; + icon = " "; + label = "Recent Files"; + limit = 10; + }; + project = { + enable = true; + action = "e "; + icon = "󰉋 "; + label = "Projects"; + limit = 8; + }; + shortcut = [ + { + icon = " "; + desc = "Open "; + key = "o"; + action = "Telescope find_files"; + } + { + icon = " "; + desc = "Recent "; + key = "r"; + action = "Telescope oldfiles"; + } + { + icon = " "; + desc = "Config "; + key = "c"; + action = "e $HOME/Documents/Code/Personal/NixFiles - Personal"; + } + ]; + }; + }; + }; +} \ No newline at end of file diff --git a/config/ui/lualine.nix b/config/ui/lualine.nix new file mode 100644 index 0000000..8997ad2 --- /dev/null +++ b/config/ui/lualine.nix @@ -0,0 +1,5 @@ +{ + plugins.lualine = { + enable = true; + }; +} \ No newline at end of file diff --git a/config/ui/neoscroll.nix b/config/ui/neoscroll.nix new file mode 100644 index 0000000..96cd5ea --- /dev/null +++ b/config/ui/neoscroll.nix @@ -0,0 +1,3 @@ +{ + plugins.neoscroll.enable = true; +} \ No newline at end of file diff --git a/config/ui/nvim-tree.nix b/config/ui/nvim-tree.nix new file mode 100644 index 0000000..0cb371a --- /dev/null +++ b/config/ui/nvim-tree.nix @@ -0,0 +1,18 @@ +{ + plugins.nvim-tree = { + enable = true; + disableNetrw = true; + hijackCursor = true; + selectPrompts = true; + + renderer = { + fullName = true; + highlightGit = true; + }; + + tab.sync = { + open = true; + close = true; + }; + }; +} \ No newline at end of file diff --git a/config/ui/telescope.nix b/config/ui/telescope.nix new file mode 100644 index 0000000..b244762 --- /dev/null +++ b/config/ui/telescope.nix @@ -0,0 +1,43 @@ +{ + plugins.telescope = { + enable = true; + keymaps = { + "" = { + action = "git_files"; + options = { + desc = "Telescope: Files"; + }; + }; + "ff" = { + action = "git_files"; + options = { + desc = "Telescope: Files"; + }; + }; + "fF" = { + action = "find_files hidden=true"; + options = { + desc = "Telescope: Files (hidden)"; + }; + }; + "fg" = { + action = "live_grep"; + options = { + desc = "Telescope: Grep"; + }; + }; + "fG" = { + action = "live_grep hidden=true"; + options = { + desc = "Telescope: Files"; + }; + }; + }; + + extensions = { + fzf-native.enable = true; + media-files.enable = true; + ui-select.enable = true; + }; + }; +} diff --git a/config/ui/zen-mode.nix b/config/ui/zen-mode.nix new file mode 100644 index 0000000..3f8c824 --- /dev/null +++ b/config/ui/zen-mode.nix @@ -0,0 +1,3 @@ +{ + plugins.zen-mode.enable = true; +} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3402a83 --- /dev/null +++ b/flake.lock @@ -0,0 +1,327 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "owner": "numtide", + "repo": "devshell", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1725234343, + "narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "567b938d64d4b4112ee253b9274472dc3a346eb6", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "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-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "nixvim", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724857454, + "narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724435763, + "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724561770, + "narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1725634671, + "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1724819573, + "narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts_2", + "git-hooks": "git-hooks", + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs_2", + "nuschtosSearch": "nuschtosSearch", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1725671303, + "narHash": "sha256-PVMrJ90B5plMxlhFUKZMYjTmBJScdTDbZ1ofrYyRQQo=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "c4135d720a5a57b7ddbd7ee918544c26b2c6f732", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724584782, + "narHash": "sha256-7FfHv7b1jwMPSu9SPY9hdxStk8E6EeSwzqdvV69U4BM=", + "owner": "NuschtOS", + "repo": "search", + "rev": "5a08d691de30b6fc28d58ce71a5e420f2694e087", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724833132, + "narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "3ffd842a5f50f435d3e603312eefa4790db46af5", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8e80918 --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "A nixvim configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixvim.url = "github:nix-community/nixvim"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = + { nixvim, flake-parts, ... }@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; # import the module directly + # You can use `extraSpecialArgs` to pass additional arguments to your module files + extraSpecialArgs = { + # inherit (inputs) foo; + }; + }; + nvim = nixvim'.makeNixvimWithModule nixvimModule; + in + { + checks = { + # Run `nix flake check .` to verify that your config is not broken + default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule; + }; + + packages = { + # Lets you run `nix run .` to start nixvim + default = nvim; + }; + }; + }; +}