diff --git a/README.md b/README.md index 1f40966..6dc13fd 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,4 @@ nix run git+https://git.4o1x5.dev/4o1x5/neo2005 - [Awgxorg's structure](https://github.com/Ahwxorg/nixvim-config) - [Nixvim, making this project possible](https://github.com/nix-community/nixvim) +- [Akari nixvim](https://github.com/spector700/Akari/) diff --git a/config/default.nix b/config/default.nix index 6e66436..a198dcf 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,8 +1,8 @@ { - # Import all your configuration modules here imports = [ - ./plugins.nix ./options.nix ./keymaps.nix + + ./plugins ]; } diff --git a/config/options.nix b/config/options.nix index cd5df99..92460d2 100644 --- a/config/options.nix +++ b/config/options.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { - #colorschemes.cyberdream.enable = true; + colorschemes.oxocarbon.enable = true; colorscheme = "shades_of_purple"; opts = { @@ -11,13 +11,5 @@ # Set as leader globals.mapleader = " "; - autoCmd = [ - # Start aw-watcher-vim on startup - { - command = ":AWStart'"; - event = [ - "VimEnter" - ]; - } - ]; + } diff --git a/config/plugins.nix b/config/plugins.nix deleted file mode 100644 index d73702a..0000000 --- a/config/plugins.nix +++ /dev/null @@ -1,375 +0,0 @@ -{ pkgs, ... }: { - - - plugins.none-ls = { - enable = true; - sources = { - code_actions = { - statix.enable = true; - gitsigns.enable = true; - }; - diagnostics = { - statix.enable = true; - deadnix.enable = true; - pylint.enable = true; - checkstyle.enable = true; - }; - formatting = { - alejandra.enable = true; - stylua.enable = true; - shfmt.enable = true; - nixpkgs_fmt.enable = true; - google_java_format.enable = false; - prettier = { - enable = true; - disableTsServerFormatter = true; - }; - }; - completion = { - luasnip.enable = true; - spell.enable = true; - }; - }; - }; - # Persistence - plugins.persistence.enable = true; - - - # Language server - plugins.lsp = - { - enable = true; - servers = { - ts-ls.enable = true; # TS/JS - cssls.enable = true; # CSS - tailwindcss.enable = true; # TailwindCSS - html.enable = true; # HTML - astro.enable = true; # AstroJS - phpactor.enable = true; # PHP - svelte.enable = false; # Svelte - vuels.enable = false; # Vue - pyright.enable = true; # Python - marksman.enable = true; # Markdown - nil_ls.enable = true; # Nix - dockerls.enable = true; # Docker - bashls.enable = true; # Bash - clangd.enable = true; # C/C++ - csharp_ls.enable = true; # C# - yamlls.enable = true; # YAML - lua-ls = { - # Lua - enable = true; - settings.telemetry.enable = false; - }; - - #Rust - rust-analyzer = { - enable = true; - # Flip these in case rust is installed systemvise - installRustc = false; - installCargo = false; - settings.completion.callable.snippets = "add_parentheses"; - }; - - }; - - }; - - # Highlight word under cursor - plugins.illuminate = { - enable = true; - underCursor = false; - filetypesDenylist = [ - "Outline" - "TelescopePrompt" - "alpha" - "harpoon" - "reason" - ]; - }; - - # Startup dashboard - plugins.alpha = { - enable = true; - theme = "dashboard"; - }; - - # Auto-tagging - plugins.ts-autotag = { - enable = true; - }; - # Needed for autotagging - plugins.treesitter = { - enable = true; - }; - - # "Smooth" scrolling - plugins.neoscroll = { - enable = true; - }; - # A better command window - plugins.noice.enable = true; - - # Terminal - plugins.toggleterm = { - enable = true; - settings = { - hide_numbers = false; - autochdir = true; - close_on_exit = true; - direction = "horizontal"; - open_mapping = "[[]]"; - }; - }; - - - # Autocomplete - plugins.cmp = { - enable = true; - settings = { - autoEnableSources = true; - experimental = { ghost_text = true; }; - performance = { - debounce = 60; - fetchingTimeout = 200; - maxViewEntries = 30; - }; - - formatting = { fields = [ "kind" "abbr" "menu" ]; }; - sources = [ - { name = "nvim_lsp"; } - { - name = "buffer"; # text within current buffer - option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; - keywordLength = 3; - } - { - name = "path"; # file system paths - keywordLength = 3; - } - ]; - - window = { - completion = { border = "solid"; }; - documentation = { border = "solid"; }; - }; - - mapping = { - "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; - "" = "cmp.mapping.select_next_item()"; - "" = "cmp.mapping.select_prev_item()"; - "" = "cmp.mapping.abort()"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.confirm({ select = true })"; - "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; - }; - }; - }; - - plugins.cmp-nvim-lsp = { - enable = true; # LSP - }; - plugins.cmp-buffer = { - enable = true; - }; - plugins.cmp-path = { - enable = true; # file system paths - }; - plugins.cmp_luasnip = { - enable = true; # snippets - }; - - - - - # highlites colors (like #FFF) - plugins.colorizer = { - enable = true; - }; - - # Highlight TODO FIXME comments - plugins.todo-comments.enable = true; - - - # Inline git blame - plugins.gitsigns = { - enable = true; - settings = { - current_line_blame = true; - trouble = true; - }; - }; - - # Inline error display - plugins.trouble = { - enable = true; - settings = { }; - }; - - - # when adding " or any letter the selected word gets wrapped in it - plugins.vim-surround.enable = true; - - # File tree - plugins.chadtree = { - enable = true; - }; - - # Status bar - plugins.lualine = { - enable = true; - }; - - # a cool summary searcher - plugins.navbuddy.enable = true; - - - # languages - plugins.nix.enable = true; - - plugins.fidget = { - enable = true; - logger = { - level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace” - floatPrecision = 0.01; # Limit the number of decimals displayed for floats - }; - progress = { - pollRate = 0; # How and when to poll for progress messages - suppressOnInsert = true; # Suppress new messages while in insert mode - ignoreDoneAlready = false; # Ignore new tasks that are already complete - ignoreEmptyMessage = false; # Ignore new tasks that don't contain a message - clearOnDetach = - # Clear notification group when LSP server detaches - '' - function(client_id) - local client = vim.lsp.get_client_by_id(client_id) - return client and client.name or nil - end - ''; - notificationGroup = - # How to get a progress message's notification group key - '' - function(msg) return msg.lsp_client.name end - ''; - ignore = [ ]; # List of LSP servers to ignore - lsp = { - progressRingbufSize = 0; # Configure the nvim's LSP progress ring buffer size - }; - display = { - renderLimit = 16; # How many LSP messages to show at once - doneTtl = 3; # How long a message should persist after completion - doneIcon = "✔"; # Icon shown when all LSP progress tasks are complete - doneStyle = "Constant"; # Highlight group for completed LSP tasks - progressTtl = "math.huge"; # How long a message should persist when in progress - progressIcon = { - pattern = "dots"; - period = 1; - }; # Icon shown when LSP progress tasks are in progress - progressStyle = "WarningMsg"; # Highlight group for in-progress LSP tasks - groupStyle = "Title"; # Highlight group for group name (LSP server name) - iconStyle = "Question"; # Highlight group for group icons - priority = 30; # Ordering priority for LSP notification group - skipHistory = true; # Whether progress notifications should be omitted from history - formatMessage = '' - require ("fidget.progress.display").default_format_message - ''; # How to format a progress message - formatAnnote = '' - function (msg) return msg.title end - ''; # How to format a progress annotation - formatGroupName = '' - function (group) return tostring (group) end - ''; # How to format a progress notification group's name - overrides = { - rust_analyzer = { - name = "rust-analyzer"; - }; - }; # Override options from the default notification config - }; - }; - notification = { - pollRate = 10; # How frequently to update and render notifications - filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace” - historySize = 128; # Number of removed messages to retain in history - overrideVimNotify = true; - redirect = '' - function(msg, level, opts) - if opts and opts.on_open then - return require("fidget.integration.nvim-notify").delegate(msg, level, opts) - end - end - ''; - configs = { - default = "require('fidget.notification').default_config"; - }; - - window = { - normalHl = "Comment"; - winblend = 0; - border = "none"; # none, single, double, rounded, solid, shadow - zindex = 45; - maxWidth = 0; - maxHeight = 0; - xPadding = 1; - yPadding = 0; - align = "bottom"; - relative = "editor"; - }; - view = { - stackUpwards = true; # Display notification items from bottom to top - iconSeparator = " "; # Separator between group name and icon - groupSeparator = "---"; # Separator between notification groups - groupSeparatorHl = - # Highlight group used for group separator - "Comment"; - }; - }; - }; - - extraPlugins = with pkgs; [ - # TODO add gen.nvim - { - plugin = pkgs.vimUtils.buildVimPlugin { - pname = "aw-watcher-vim"; - version = "1.0.0"; # dummy version - src = pkgs.fetchFromGitHub { - owner = "ActivityWatch"; - repo = "aw-watcher-vim"; - rev = "4ba86d05a940574000c33f280fd7f6eccc284331"; - hash = "sha256-I7YYvQupeQxWr2HEpvba5n91+jYvJrcWZhQg+5rI908="; - }; - }; - } - # Shades of purple - # TODO self implement this color scheme as this one doesn't really represent the original one. - { - plugin = pkgs.vimUtils.buildVimPlugin { - pname = "shades-of-purple"; - version = "1.0.0"; # dummy version - src = pkgs.fetchFromGitHub { - owner = "Rigellute"; - repo = "shades-of-purple.vim"; - rev = "e806d38190a6a2e8b9244824c2953d6567f141f3"; - hash = "sha256-iiGASgVlIXnnUNBlp9viKgDBfHiOP5P/yJx9XyELT9g="; - }; - }; - } - # Gen for local ollama ai, and autocomplete - { - plugin = pkgs.vimUtils.buildVimPlugin { - pname = "gen.nvim"; - version = "1.0.0"; # dummy version - src = pkgs.fetchFromGitHub { - owner = "David-Kunz"; - repo = "gen.nvim"; - rev = "b9721662daedd880ca0a0358cf6ffbff60617ab3"; - hash = "sha256-Cyx0QBQjp+ilEEMqs4OWuuJ0x5t4bRalJ2NuemvxDKo="; - }; - }; - # TODO config for gen - #config =''''; - } - ]; - -} diff --git a/config/plugins/aw/default.nix b/config/plugins/aw/default.nix new file mode 100644 index 0000000..61da519 --- /dev/null +++ b/config/plugins/aw/default.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: { + + extraPlugins = with pkgs; [ + { + plugin = pkgs.vimUtils.buildVimPlugin { + pname = "aw-watcher-vim"; + version = "1.0.0"; # dummy version + src = pkgs.fetchFromGitHub { + owner = "ActivityWatch"; + repo = "aw-watcher-vim"; + rev = "4ba86d05a940574000c33f280fd7f6eccc284331"; + hash = "sha256-I7YYvQupeQxWr2HEpvba5n91+jYvJrcWZhQg+5rI908="; + }; + }; + } + ]; + + autoCmd = [ + # Start aw-watcher-vim on startup + { + command = ":AWStart'"; + event = [ + "VimEnter" + ]; + } + ]; +} diff --git a/config/plugins/default.nix b/config/plugins/default.nix new file mode 100644 index 0000000..eeb8590 --- /dev/null +++ b/config/plugins/default.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: { + imports = [ + ./lsp + ./telescope + ./ui + ./aw + ]; + + # Persistence + plugins.persistence.enable = true; +} diff --git a/config/plugins/lsp/default.nix b/config/plugins/lsp/default.nix new file mode 100644 index 0000000..e473361 --- /dev/null +++ b/config/plugins/lsp/default.nix @@ -0,0 +1,162 @@ +{ pkgs, lib, ... }: { + + imports = [ + ./trouble.nix + ]; + + # Autocomplete + plugins.cmp = { + enable = true; + settings = { + autoEnableSources = true; + experimental = { ghost_text = true; }; + performance = { + debounce = 60; + fetchingTimeout = 200; + maxViewEntries = 30; + }; + + formatting = { fields = [ "kind" "abbr" "menu" ]; }; + sources = [ + { name = "nvim_lsp"; } + { + name = "buffer"; # text within current buffer + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + keywordLength = 3; + } + { + name = "path"; # file system paths + keywordLength = 3; + } + ]; + + window = { + completion = { border = "solid"; }; + documentation = { border = "solid"; }; + }; + + mapping = { + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.abort()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; + }; + }; + }; + + plugins.cmp-nvim-lsp = { + enable = true; # LSP + }; + plugins.cmp-buffer = { + enable = true; + }; + plugins.cmp-path = { + enable = true; # file system paths + }; + plugins.cmp_luasnip = { + enable = true; # snippets + }; + + # Language server + plugins.lsp = + { + enable = true; + servers = { + ts_ls.enable = true; # TS/JS + cssls.enable = true; # CSS + tailwindcss.enable = true; # TailwindCSS + html.enable = true; # HTML + astro.enable = true; # AstroJS + phpactor.enable = true; # PHP + svelte.enable = false; # Svelte + vuels.enable = false; # Vue + pyright.enable = true; # Python + marksman.enable = true; # Markdown + nil_ls.enable = true; # Nix + dockerls.enable = true; # Docker + bashls.enable = true; # Bash + clangd.enable = true; # C/C++ + csharp_ls.enable = true; # C# + yamlls.enable = true; # YAML + lua_ls = { + enable = true; + settings.telemetry.enable = false; + }; + + #Rust + rust-analyzer = { + enable = true; + # Flip these in case rust is installed systemvise + installRustc = false; + installCargo = false; + settings.completion.callable.snippets = "add_parentheses"; + }; + }; + }; + + plugins.none-ls = { + enable = true; + sources = { + code_actions = { + statix.enable = true; + gitsigns.enable = true; + }; + diagnostics = { + statix.enable = true; + deadnix.enable = true; + pylint.enable = true; + checkstyle.enable = true; + }; + formatting = { + alejandra.enable = true; + stylua.enable = true; + shfmt.enable = true; + nixpkgs_fmt.enable = true; + google_java_format.enable = false; + prettier = { + enable = true; + disableTsServerFormatter = true; + }; + }; + completion = { + luasnip.enable = true; + spell.enable = true; + }; + }; + }; + + plugins.nix.enable = true; + + # Auto formatter + plugins.conform-nvim = { + enable = true; + settings = { + format_on_save = { + lspFallback = true; + timeoutMs = 500; + }; + formatters_by_ft = { + # Use the "_" filetype to run formatters on filetypes that don't have other formatters configured. + "_" = [ + "squeeze_blanks" + "trim_whitespace" + "trim_newlines" + ]; + }; + }; + }; + + # Auto-tagging + plugins.ts-autotag = { + enable = true; + }; + # Needed for autotagging + plugins.treesitter = { + enable = true; + }; +} diff --git a/config/plugins/lsp/trouble.nix b/config/plugins/lsp/trouble.nix new file mode 100644 index 0000000..319f0cc --- /dev/null +++ b/config/plugins/lsp/trouble.nix @@ -0,0 +1,50 @@ +{ pkgs, ... }: { + plugins.trouble = { + enable = true; + settings.auto_close = true; + }; + + keymaps = [ + { + mode = "n"; + key = "x"; + action = "+diagnostics/quickfix"; + } + { + mode = "n"; + key = "xx"; + action = "TroubleToggle"; + options = { + silent = true; + desc = "Document Diagnostics (Trouble)"; + }; + } + { + mode = "n"; + key = "xX"; + action = "TroubleToggle workspace_diagnostics"; + options = { + silent = true; + desc = "Workspace Diagnostics (Trouble)"; + }; + } + { + mode = "n"; + key = "xt"; + action = "TroubleToggle todo"; + options = { + silent = true; + desc = "Todo (Trouble)"; + }; + } + { + mode = "n"; + key = "xq"; + action = "TodoQuickFix"; + options = { + silent = true; + desc = "Quickfix List (Trouble)"; + }; + } + ]; +} diff --git a/config/plugins/telescope/default.nix b/config/plugins/telescope/default.nix new file mode 100644 index 0000000..f038d2b --- /dev/null +++ b/config/plugins/telescope/default.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: { + plugins.telescope = { + enable = true; + extensions = { + fzf-native.enable = true; + undo.enable = true; + ui-select = { + settings = { + specific_opts = { + codeactions = true; + }; + }; + }; + }; + keymaps = { + "" = { + action = "find_files"; + options.desc = "Find project files"; + }; + }; + }; +} diff --git a/config/plugins/ui/default.nix b/config/plugins/ui/default.nix new file mode 100644 index 0000000..a5538a5 --- /dev/null +++ b/config/plugins/ui/default.nix @@ -0,0 +1,181 @@ +{ pkgs, ... }: { + # "Smooth" scrolling + plugins.neoscroll = { + enable = true; + }; + # A better command window + plugins.noice.enable = true; + + # Terminal + plugins.toggleterm = { + enable = true; + settings = { + hide_numbers = false; + autochdir = true; + close_on_exit = true; + direction = "horizontal"; + open_mapping = "[[]]"; + }; + }; + + # Cool indent lines, inspired straight from rainbow-indent on vscode + plugins.indent-blankline = { + enable = true; + settings = { + scope = { + show_end = false; + show_exact_scope = true; + show_start = false; + }; + }; + }; + + # highlites colors (like #FFF) + plugins.colorizer = { + enable = true; + }; + + # Highlight TODO FIXME comments + plugins.todo-comments.enable = true; + + + # Inline git blame + plugins.gitsigns = { + enable = true; + settings = { + current_line_blame = true; + trouble = true; + }; + }; + + + plugins.trouble = { + enable = true; + settings = { }; + }; + + # Clean notifications + plugins.fidget = { + enable = true; + logger = { + level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace” + floatPrecision = 0.01; # Limit the number of decimals displayed for floats + }; + progress = { + pollRate = 0; # How and when to poll for progress messages + suppressOnInsert = true; # Suppress new messages while in insert mode + ignoreDoneAlready = false; # Ignore new tasks that are already complete + ignoreEmptyMessage = false; # Ignore new tasks that don't contain a message + clearOnDetach = + # Clear notification group when LSP server detaches + '' + function(client_id) + local client = vim.lsp.get_client_by_id(client_id) + return client and client.name or nil + end + ''; + notificationGroup = + # How to get a progress message's notification group key + '' + function(msg) return msg.lsp_client.name end + ''; + ignore = [ ]; # List of LSP servers to ignore + lsp = { + progressRingbufSize = 0; # Configure the nvim's LSP progress ring buffer size + }; + display = { + renderLimit = 16; # How many LSP messages to show at once + doneTtl = 3; # How long a message should persist after completion + doneIcon = "✔"; # Icon shown when all LSP progress tasks are complete + doneStyle = "Constant"; # Highlight group for completed LSP tasks + progressTtl = "math.huge"; # How long a message should persist when in progress + progressIcon = { + pattern = "dots"; + period = 1; + }; # Icon shown when LSP progress tasks are in progress + progressStyle = "WarningMsg"; # Highlight group for in-progress LSP tasks + groupStyle = "Title"; # Highlight group for group name (LSP server name) + iconStyle = "Question"; # Highlight group for group icons + priority = 30; # Ordering priority for LSP notification group + skipHistory = true; # Whether progress notifications should be omitted from history + formatMessage = '' + require ("fidget.progress.display").default_format_message + ''; # How to format a progress message + formatAnnote = '' + function (msg) return msg.title end + ''; # How to format a progress annotation + formatGroupName = '' + function (group) return tostring (group) end + ''; # How to format a progress notification group's name + overrides = { + rust_analyzer = { + name = "rust-analyzer"; + }; + }; # Override options from the default notification config + }; + }; + notification = { + pollRate = 10; # How frequently to update and render notifications + filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace” + historySize = 128; # Number of removed messages to retain in history + overrideVimNotify = true; + redirect = '' + function(msg, level, opts) + if opts and opts.on_open then + return require("fidget.integration.nvim-notify").delegate(msg, level, opts) + end + end + ''; + configs = { + default = "require('fidget.notification').default_config"; + }; + + window = { + normalHl = "Comment"; + winblend = 0; + border = "none"; # none, single, double, rounded, solid, shadow + zindex = 45; + maxWidth = 0; + maxHeight = 0; + xPadding = 1; + yPadding = 0; + align = "bottom"; + relative = "editor"; + }; + view = { + stackUpwards = true; # Display notification items from bottom to top + iconSeparator = " "; # Separator between group name and icon + groupSeparator = "---"; # Separator between notification groups + groupSeparatorHl = + # Highlight group used for group separator + "Comment"; + }; + }; + }; + # File tree + plugins.chadtree = { + enable = true; + }; + # Status bar + plugins.lualine = { + enable = true; + }; + # Startup dashboard + plugins.alpha = { + enable = true; + theme = "dashboard"; + }; + + # Highlight word under cursor + plugins.illuminate = { + enable = true; + underCursor = false; + filetypesDenylist = [ + "Outline" + "TelescopePrompt" + "alpha" + "harpoon" + "reason" + ]; + }; +}