diff --git a/home/common/default.nix b/home/common/default.nix index 72d4649..b205619 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -11,12 +11,12 @@ ./systemd-services ## Import program configs - #./nixvim - ./neofetch.nix + ./fetch.nix ./kitty.nix ./fish.nix ./btop.nix ./git.nix + ./nvim ]; diff --git a/home/common/neofetch.nix b/home/common/fetch.nix similarity index 100% rename from home/common/neofetch.nix rename to home/common/fetch.nix diff --git a/home/common/nixvim/default.nix b/home/common/nixvim/default.nix deleted file mode 100644 index 9b61a04..0000000 --- a/home/common/nixvim/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - programs.nixvim = { - enable = true; - - colorschemes = { - catppuccin.enable = true; - }; - - plugins = { - lualine.enable = true; - }; - - }; -} diff --git a/home/common/nvim/default.nix b/home/common/nvim/default.nix new file mode 100644 index 0000000..66f12ee --- /dev/null +++ b/home/common/nvim/default.nix @@ -0,0 +1,21 @@ +# Nixvim is a NixOS module that installs and configures Neovim +{ inputs, ... }: { + imports = [ + inputs.nixvim.homeManagerModules.nixvim + ./plugins/cmp.nix + ./plugins/dashboard.nix + ./plugins/lsp.nix + ./plugins/markdown.nix + ./plugins/tree.nix + ./plugins/ui.nix + ./plugins/utils.nix + ./plugins/dap.nix + ./plugins/telescope.nix + ./plugins/zenmode.nix + + ./options.nix + ./keymaps.nix + ]; + + programs.nixvim.enable = true; +} diff --git a/home/common/nvim/keymaps.nix b/home/common/nvim/keymaps.nix new file mode 100644 index 0000000..e4deb24 --- /dev/null +++ b/home/common/nvim/keymaps.nix @@ -0,0 +1,310 @@ +{ + programs.nixvim = { + plugins.which-key = { + enable = true; + settings = { + delay = 600; + icons = { + breadcrumb = "»"; + group = "+"; + separator = ""; # ➜ + mappings = false; + }; + spec = [ + # General Mappings + { + __unkeyed-1 = "c"; + mode = [ "n" "v" ]; + group = "+code"; + } + { + __unkeyed-1 = "d"; + mode = [ "n" "v" ]; + group = "+debug"; + } + { + __unkeyed-1 = "s"; + mode = "n"; + group = "+search"; + } + { + __unkeyed-1 = "m"; + mode = "n"; + group = "+markdown"; + } + { + __unkeyed-1 = "t"; + mode = "n"; + group = "+trouble"; + } + { + __unkeyed-1 = "u"; + mode = "n"; + group = "+ui"; + } + { + __unkeyed-1 = "w"; + mode = "n"; + group = "+windows"; + } + { + __unkeyed-1 = "h"; + mode = "n"; + group = "+harpoon"; + } + ]; + win = { + border = "rounded"; + wo.winblend = 0; + }; + }; + }; + + keymaps = [ + # General Mappings + { + key = "e"; + action = "Oil --float"; + options.desc = "Oil"; + } + { + key = "-"; + action = "Oil"; + options.desc = "Oil"; + } + { + key = "E"; + action = "Neotree toggle"; + options.desc = "Neotree"; + } + + { + key = "s"; + action = "lua require('flash').jump()"; + options.desc = "Flash"; + } + { + key = "K"; + action = "lua vim.lsp.buf.hover()"; + options.desc = "LSP Hover"; + } + + { + key = ""; + action = "TmuxNavigateLeft"; + } + { + key = ""; + action = "TmuxNavigateDown"; + } + { + key = ""; + action = "TmuxNavigateUp"; + } + { + key = ""; + action = "TmuxNavigateRight"; + } + + # UI + { + key = "uz"; + action = "ZenMode"; + options.desc = "Toggle ZenMode"; + } + { + key = "uw"; + action = "set wrap!"; + options.desc = "Toggle word wrapping"; + } + { + key = "ul"; + action = "set linebreak!"; + options.desc = "Toggle linebreak"; + } + { + key = "us"; + action = "set spell!"; + options.desc = "Toggle spellcheck"; + } + { + key = "uc"; + action = "set cursorline!"; + options.desc = "Toggle cursorline"; + } + { + key = "un"; + action = "set number!"; + options.desc = "Toggle line numbers"; + } + { + key = "ur"; + action = "set relativenumber!"; + options.desc = "Toggle relative line numbers"; + } + { + key = "ut"; + action = "set showtabline=2"; + options.desc = "Show tabline"; + } + { + key = "uT"; + action = "set showtabline=0"; + options.desc = "Hide tabline"; + } + + # Search + { + key = " "; + action = "lua require('telescope.builtin').find_files()"; + options.desc = "Telescope"; + } + { + key = "sg"; + action = "lua require('telescope.builtin').live_grep()"; + options.desc = "Livegrep"; + } + { + key = "sf"; + action = "lua require('telescope.builtin').find_files()"; + options.desc = "Find Files"; + } + { + key = "sb"; + action = "lua require('telescope.builtin').buffers()"; + options.desc = "Buffers"; + } + { + key = "sh"; + action = "lua require('telescope.builtin').help_tags()"; + options.desc = "Help Tags"; + } + { + key = "sc"; + action = "lua require('telescope.builtin').commands()"; + options.desc = "Commands"; + } + { + key = "sm"; + action = "lua require('telescope.builtin').marks()"; + options.desc = "Marks"; + } + { + key = "so"; + action = "lua require('telescope.builtin').oldfiles()"; + options.desc = "Oldfiles"; + } + { + key = "ss"; + action = "lua require('telescope.builtin').spell_suggest()"; + options.desc = "Spell Suggest"; + } + { + key = "sr"; + action = ":noh"; + options.desc = "Reset search"; + } + { + key = "st"; + action = "TodoTelescope"; + options.desc = "Todos"; + } + + # Trouble + { + key = "tx"; + action = "Trouble diagnostics toggle"; + options.desc = "Diagnostics (Trouble)"; + } + { + key = "tX"; + action = "Trouble diagnostics toggle filter.buf=0"; + options.desc = "Buffer Diagnostics (Trouble)"; + } + { + key = "ts"; + action = "Trouble symbols toggle focus=false"; + options.desc = "Symbols (Trouble)"; + } + { + key = "tl"; + action = "Trouble lsp toggle focus=false win.position=right"; + options.desc = "LSP Definitions / references / ... (Trouble)"; + } + { + key = "tL"; + action = "Trouble loclist toggle"; + options.desc = "Location List (Trouble)"; + } + { + key = "tQ"; + action = "Trouble qflist toggle"; + options.desc = "Quickfix List (Trouble)"; + } + + # Windows + { + key = "ws"; + action = "split"; + options.desc = "Split"; + } + { + key = "wv"; + action = "vsplit"; + options.desc = "VSplit"; + } + { + key = "wd"; + action = "close"; + options.desc = "Close"; + } + + # Code + { + key = "cd"; + action = "lua vim.lsp.buf.definition()"; + options.desc = "LSP Definition"; + } + { + key = "cr"; + action = "lua vim.lsp.buf.references()"; + options.desc = "LSP References"; + } + { + key = "ct"; + action = "lua vim.lsp.buf.type_definition()"; + options.desc = "LSP Type Definition"; + } + { + key = "ca"; + action = "lua vim.lsp.buf.code_action()"; + options.desc = "LSP Code Action"; + } + { + key = "cf"; + action = "lua vim.lsp.buf.formatting()"; + options.desc = "LSP Formatting"; + } + { + key = "cn"; + action = "lua vim.lsp.diagnostic.goto_next()"; + options.desc = "LSP Next Diagnostic"; + } + { + key = "cp"; + action = "lua vim.lsp.diagnostic.goto_prev()"; + options.desc = "LSP Previous Diagnostic"; + } + { + key = "cu"; + action = "lua require('dapui').toggle()"; + options.desc = "Toggle Dapui"; + } + { + key = "cb"; + action = "lua require('dap').toggle_breakpoint()"; + options.desc = "Toggle breakpoint"; + } + ]; + }; +} diff --git a/home/common/nvim/options.nix b/home/common/nvim/options.nix new file mode 100644 index 0000000..8cb51c7 --- /dev/null +++ b/home/common/nvim/options.nix @@ -0,0 +1,38 @@ +{ + programs.nixvim.globals.mapleader = " "; + programs.nixvim.opts = { + updatetime = 50; # Faster completion + + number = true; + relativenumber = true; + + autoindent = true; + clipboard = "unnamed,unnamedplus"; + + expandtab = true; + tabstop = 2; + softtabstop = 2; + shiftwidth = 2; + smartindent = true; + breakindent = true; + + ignorecase = true; + incsearch = true; + hlsearch = true; + smartcase = true; + wildmode = "list:longest"; + completeopt = [ "menuone" "noselect" "noinsert" ]; + signcolumn = "yes"; + cursorline = false; + scrolloff = 8; + mouse = "a"; + termguicolors = true; + showmode = false; + + wrap = false; + + swapfile = false; + undofile = true; + conceallevel = 3; + }; +} diff --git a/home/common/nixvim/plugins/bufferline.nix b/home/common/nvim/plugins/bufferline.nix similarity index 100% rename from home/common/nixvim/plugins/bufferline.nix rename to home/common/nvim/plugins/bufferline.nix diff --git a/home/common/nvim/plugins/cmp.nix b/home/common/nvim/plugins/cmp.nix new file mode 100644 index 0000000..e53726a --- /dev/null +++ b/home/common/nvim/plugins/cmp.nix @@ -0,0 +1,117 @@ +{ + programs.nixvim.plugins = { + luasnip.enable = true; + cmp-buffer = { enable = true; }; + cmp-emoji = { enable = true; }; + cmp-nvim-lsp = { enable = true; }; + cmp-path = { enable = true; }; + cmp_luasnip = { enable = true; }; + + cmp = { + enable = true; + settings = { + snippet.expand = + "function(args) require('luasnip').lsp_expand(args.body) end"; + sources = [ + { name = "nvim_lsp"; } + { name = "luasnip"; } + { + name = "buffer"; + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + } + { name = "nvim_lua"; } + { name = "mkdnflow"; } + { name = "path"; } + ]; + + formatting = { + fields = [ "abbr" "kind" "menu" ]; + format = + # lua + '' + function(_, item) + local icons = { + Namespace = "󰌗", + Text = "󰉿", + Method = "󰆧", + Function = "󰆧", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈚", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "󰊄", + Table = "", + Object = "󰅩", + Tag = "", + Array = "[]", + Boolean = "", + Number = "", + Null = "󰟢", + String = "󰉿", + Calendar = "", + Watch = "󰥔", + Package = "", + Copilot = "", + Codeium = "", + TabNine = "", + } + + local icon = icons[item.kind] or "" + item.kind = string.format("%s %s", icon, item.kind or "") + return item + end + ''; + }; + + window = { + completion = { + winhighlight = + "FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel"; + scrollbar = false; + sidePadding = 0; + border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ]; + }; + + documentation = { + border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ]; + winhighlight = + "FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel"; + }; + }; + + mapping = { + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.close()"; + "" = + "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })"; + }; + }; + }; + + }; +} diff --git a/home/common/nvim/plugins/dap.nix b/home/common/nvim/plugins/dap.nix new file mode 100644 index 0000000..1de9291 --- /dev/null +++ b/home/common/nvim/plugins/dap.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: { + programs.nixvim.plugins.dap = { + enable = true; + adapters = { }; + signs = { + dapBreakpoint = { + text = "●"; + texthl = "DapBreakpoint"; + }; + dapBreakpointCondition = { + text = "●"; + texthl = "DapBreakpointCondition"; + }; + dapLogPoint = { + text = "◆"; + texthl = "DapLogPoint"; + }; + }; + extensions = { + dap-go = { + enable = true; + delve.path = "${pkgs.delve}/bin/dlv"; + }; + dap-ui = { enable = true; }; + dap-virtual-text = { enable = true; }; + }; + }; +} diff --git a/home/common/nvim/plugins/dashboard.nix b/home/common/nvim/plugins/dashboard.nix new file mode 100644 index 0000000..bbaca79 --- /dev/null +++ b/home/common/nvim/plugins/dashboard.nix @@ -0,0 +1,153 @@ +{ config, ... }: +let + accent = "#${config.lib.stylix.colors.base0D}"; + muted = "#${config.lib.stylix.colors.base03}"; + foreground = "#${config.lib.stylix.colors.base05}"; + configDir = config.var.configDirectory; +in { + + programs.nixvim.highlight = { + AlphaHeaderColor.fg = accent; + AlphaTextColor.fg = foreground; + AlphaShortcutColor.fg = muted; + }; + + programs.nixvim.plugins.alpha = { + enable = true; + layout = [ + { + type = "padding"; + val = 4; + } + { + type = "text"; + opts = { + position = "center"; + hl = "AlphaHeaderColor"; + }; + val = [ + "  " + " ████ ██████ █████ ██ " + " ███████████ █████  " + " █████████ ███████████████████ ███ ███████████ " + " █████████ ███ █████████████ █████ ██████████████ " + " █████████ ██████████ █████████ █████ █████ ████ █████ " + " ███████████ ███ ███ █████████ █████ █████ ████ █████ " + " ██████ █████████████████████ ████ █████ █████ ████ ██████ " + " " + ]; + } + { + type = "padding"; + val = 4; + } + { + type = "group"; + + val = [ + { + type = "button"; + val = "󰭎 Find file"; + on_press.__raw = "function() vim.cmd[[Telescope find_files]] end"; + opts = { + shortcut = "nf"; + position = "center"; + cursor = 3; + width = 50; + align_shortcut = "right"; + hl_shortcut = "AlphaShortcutColor"; + hl = "AlphaTextColor"; + }; + } + { + type = "button"; + val = " New file"; + on_press.__raw = "function() vim.cmd[[ene]] end"; + opts = { + shortcut = "nn"; + position = "center"; + cursor = 3; + width = 50; + align_shortcut = "right"; + hl_shortcut = "AlphaShortcutColor"; + hl = "AlphaTextColor"; + }; + } + { + type = "button"; + val = " NixOs Config"; + on_press.__raw = "function() vim.cmd[[Neotree ${configDir}]] end"; + opts = { + shortcut = "nc"; + position = "center"; + cursor = 3; + width = 50; + align_shortcut = "right"; + hl_shortcut = "AlphaShortcutColor"; + hl = "AlphaTextColor"; + }; + } + { + type = "button"; + val = " Keybindings"; + on_press.__raw = + "function() vim.cmd[[e ${configDir}/docs/KEYBINDINGS.md]] end"; + opts = { + shortcut = "nc"; + position = "center"; + cursor = 3; + width = 50; + align_shortcut = "right"; + hl_shortcut = "AlphaShortcutColor"; + hl = "AlphaTextColor"; + }; + } + { + type = "button"; + val = " Recently used"; + on_press.__raw = "function() vim.cmd[[Telescope oldfiles]] end"; + opts = { + shortcut = "no"; + position = "center"; + cursor = 3; + width = 50; + align_shortcut = "right"; + hl_shortcut = "AlphaShortcutColor"; + hl = "AlphaTextColor"; + }; + } + { + type = "button"; + val = "󰱽 Find text"; + on_press.__raw = "function() vim.cmd[[Telescope live_grep]] end"; + opts = { + shortcut = "nt"; + position = "center"; + cursor = 3; + width = 50; + align_shortcut = "right"; + hl_shortcut = "AlphaShortcutColor"; + hl = "AlphaTextColor"; + }; + } + { + type = "button"; + val = "󰩈 Quit Neovim"; + on_press.__raw = "function() vim.cmd[[qa]] end"; + opts = { + shortcut = "nq"; + position = "center"; + cursor = 3; + width = 50; + align_shortcut = "right"; + hl_shortcut = "AlphaShortcutColor"; + hl = "AlphaTextColor"; + }; + } + ]; + + } + ]; + }; + +} diff --git a/home/common/nvim/plugins/lsp.nix b/home/common/nvim/plugins/lsp.nix new file mode 100644 index 0000000..802435f --- /dev/null +++ b/home/common/nvim/plugins/lsp.nix @@ -0,0 +1,48 @@ +{ + programs.nixvim.plugins = { + lsp-format.enable = true; + lsp = { + enable = true; + servers = { + bashls.enable = true; + clangd.enable = true; + gopls.enable = true; + nixd = { + enable = true; + extraOptions = { expr = "import {}"; }; + }; + tailwindcss.enable = true; + html.enable = true; + svelte.enable = true; + marksman.enable = true; + }; + keymaps.lspBuf = { + "gd" = "definition"; + "gD" = "references"; + "gt" = "type_definition"; + "gi" = "implementation"; + "K" = "hover"; + }; + }; + none-ls = { + enable = true; + sources = { + diagnostics = { + golangci_lint.enable = true; + statix.enable = true; + }; + formatting = { + gofmt.enable = true; + goimports.enable = true; + nixfmt.enable = true; + markdownlint.enable = true; + tidy.enable = true; + shellharden.enable = true; + shfmt.enable = true; + golines.enable = true; + gofumpt.enable = true; + }; + }; + }; + }; +} diff --git a/home/common/nvim/plugins/markdown.nix b/home/common/nvim/plugins/markdown.nix new file mode 100644 index 0000000..b50b2da --- /dev/null +++ b/home/common/nvim/plugins/markdown.nix @@ -0,0 +1,189 @@ +# The render-markdown.nvim plugin is a plugin that renders markdown files in a neovim in a more readable way. +{ config, ... }: +let + accent = "#${config.lib.stylix.colors.base0D}"; + accent-alt = "#${config.lib.stylix.colors.base08}"; + muted = "#${config.lib.stylix.colors.base03}"; + background = "#${config.lib.stylix.colors.base00}"; +in { + + programs.nixvim = { + plugins.mkdnflow = { + enable = true; + modules = { conceal = false; }; + + toDo.symbols = [ " " "-" "x" "!" "/" ]; + mappings = { + MkdnCreateLink = false; + MkdnCreateLinkFromClipboard = { + key = "ml"; + modes = [ "n" "v" ]; + }; + MkdnDecreaseHeading = { + key = "m-"; + modes = "n"; + }; + MkdnDestroyLink = false; + MkdnEnter = { + key = ""; + modes = [ "v" ]; + }; + MkdnExtendList = false; + MkdnFoldSection = { + key = "mf"; + modes = "n"; + }; + MkdnUnfoldSection = { + key = "mF"; + modes = "n"; + }; + MkdnFollowLink = { + key = "gd"; + modes = "n"; + }; + MkdnGoBack = false; + MkdnGoForward = false; + MkdnIncreaseHeading = { + key = "m+"; + modes = "n"; + }; + MkdnMoveSource = false; + MkdnNewListItem = false; + MkdnNewListItemAboveInsert = { + key = "O"; + modes = "n"; + }; + MkdnNewListItemBelowInsert = { + key = "o"; + modes = "n"; + }; + MkdnNextHeading = { + key = "m#"; + modes = "n"; + }; + MkdnNextLink = false; + MkdnPrevLink = false; + MkdnPrevHeading = { + key = "m*"; + modes = "n"; + }; + MkdnSTab = false; + MkdnTab = false; + MkdnTableNewColAfter = { + key = "mc"; + modes = "n"; + }; + MkdnTableNewColBefore = { + key = "mC"; + modes = "n"; + }; + MkdnTableNewRowAbove = { + key = "mR"; + modes = "n"; + }; + MkdnTableNewRowBelow = { + key = "mr"; + modes = "n"; + }; + MkdnTableNextCell = { + key = ""; + modes = "n"; + }; + MkdnTableNextRow = false; + MkdnTablePrevCell = { + key = ""; + modes = "n"; + }; + MkdnTablePrevRow = false; + MkdnToggleToDo = { + key = ""; + modes = [ "n" "v" ]; + }; + MkdnUpdateNumbering = { + key = "mn"; + modes = "n"; + }; + MkdnYankAnchorLink = { + key = "ya"; + modes = "n"; + }; + MkdnYankFileAnchorLink = { + key = "yfa"; + modes = "n"; + }; + }; + }; + extraFiles = { + "after/ftplugin/markdown.lua".text = '' + vim.bo.tabstop = 2 + vim.bo.shiftwidth = 2 + vim.bo.expandtab = true + ''; + }; + highlight = { + RenderMarkdownBg.bg = background; + RenderMarkdownH1.fg = accent; + RenderMarkdownH2.fg = accent; + RenderMarkdownH3.fg = accent-alt; + RenderMarkdownH4.fg = accent-alt; + RenderMarkdownH5.fg = accent-alt; + RenderMarkdownH6.fg = accent-alt; + RenderMarkdownTodo.fg = muted; + RenderMarkdownWarning.fg = accent; + }; + plugins.headlines = { + enable = true; + settings = { + markdown = { + headline_highlights = [ + "RenderMarkdownH1" + "RenderMarkdownH2" + "RenderMarkdownH3" + "RenderMarkdownH4" + "RenderMarkdownH5" + "RenderMarkdownH6" + ]; + fat_headlines = false; + }; + }; + }; + plugins.render-markdown = { + enable = true; + settings = { + heading = { + icons = [ "# " "󰲣 " "󰲥 " "󰲧 " "󰲩 " "󰲫 " ]; + backgrounds = [ "RenderMarkdownBg" ]; + foregrounds = [ + "RenderMarkdownH1" + "RenderMarkdownH2" + "RenderMarkdownH3" + "RenderMarkdownH4" + "RenderMarkdownH5" + "RenderMarkdownH6" + ]; + }; + checkbox = { + unchecked = { highlight = "RenderMarkdownTodo"; }; + checked = { highlight = "RenderMarkdownTodo"; }; + custom = { + pending = { + raw = "[-]"; + rendered = "󰥔 "; + highlight = "RenderMarkdownTodo"; + }; + important = { + raw = "[!]"; + rendered = " "; + highlight = "RenderMarkdownWarning"; + }; + cancel = { + raw = "[/]"; + rendered = "󱋬 "; + highlight = "RenderMarkdownTodo"; + }; + }; + }; + }; + }; + }; +} diff --git a/home/common/nvim/plugins/telescope.nix b/home/common/nvim/plugins/telescope.nix new file mode 100644 index 0000000..64c9528 --- /dev/null +++ b/home/common/nvim/plugins/telescope.nix @@ -0,0 +1,31 @@ +{ config, ... }: +let + accent = "#${config.lib.stylix.colors.base0D}"; + background = "#${config.lib.stylix.colors.base00}"; + background-alt = "#${config.lib.stylix.colors.base01}"; +in { + programs.nixvim = { + highlight = { + TelescopePromptPrefix.fg = accent; + TelescopeSelectionCaret = { + fg = accent; + bg = background-alt; + }; + TelescopeSelection.bg = background-alt; + TelescopePromptTitle = { + bg = background; + fg = accent; + }; + TelescopePromptNormal.bg = background; + TelescopePromptBorder = { + bg = background; + fg = accent; + }; + }; + plugins.telescope = { + enable = true; + extensions.fzf-native = { enable = true; }; + settings.defaults = { selection_caret = "❚ "; }; + }; + }; +} diff --git a/home/common/nvim/plugins/tree.nix b/home/common/nvim/plugins/tree.nix new file mode 100644 index 0000000..d0eb537 --- /dev/null +++ b/home/common/nvim/plugins/tree.nix @@ -0,0 +1,44 @@ +{ + programs.nixvim = { + plugins = { + neo-tree.enable = true; + oil = { + enable = true; + settings = { + default_file_explorer = false; + skip_confirm_for_simple_edits = true; + win_options = { + concealcursor = "ncv"; + conceallevel = 3; + cursorcolumn = false; + foldcolumn = "0"; + list = false; + signcolumn = "no"; + spell = false; + wrap = false; + }; + float = { padding = 5; }; + keymaps = { + "-" = "actions.parent"; + "b" = "actions.parent"; + "" = "actions.close"; + "" = "actions.select_split"; + "" = "actions.refresh"; + "" = "actions.preview"; + "" = "actions.select_vsplit"; + "" = "actions.select_tab"; + "" = "actions.select"; + _ = "actions.open_cwd"; + "`" = "actions.cd"; + "g." = "actions.toggle_hidden"; + "g?" = "actions.show_help"; + "g\\" = "actions.toggle_trash"; + gs = "actions.change_sort"; + gx = "actions.open_external"; + "~" = "actions.tcd"; + }; + }; + }; + }; + }; +} diff --git a/home/common/nvim/plugins/ui.nix b/home/common/nvim/plugins/ui.nix new file mode 100644 index 0000000..39cffcc --- /dev/null +++ b/home/common/nvim/plugins/ui.nix @@ -0,0 +1,54 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ ctags ]; + + programs.nixvim = { + plugins = { + lualine = { + enable = true; + settings = { + options.disabled_filetypes.statusline = + [ "dashboard" "alpha" "neo-tree" ]; + + alwaysDivideMiddle = true; + globalstatus = true; + ignoreFocus = [ "neo-tree" ]; + extensions = [ "fzf" ]; + theme = "auto"; + componentSeparators = { + left = "|"; + right = "|"; + }; + sectionSeparators = { + left = "█"; #  + right = "█"; #  + }; + sections = { + lualine_a = [ "mode" ]; + lualine_b = [ "branch" "diff" "diagnostics" ]; + lualine_c = [ "filename" ]; + lualine_x = [ "filetype" ]; + lualine_y = [ "progress" ]; + lualine_z = [ ''" " .. os.date("%R")'' ]; + }; + }; + }; + web-devicons.enable = true; + noice.enable = true; + notify = { + enable = true; + level = "warn"; + }; + gitsigns = { + enable = true; + settings.current_line_blame = false; + }; + trouble.enable = true; + indent-blankline.enable = true; + nvim-colorizer.enable = true; + tagbar = { + enable = true; + tagsPackage = pkgs.universal-ctags; + }; + }; + }; +} diff --git a/home/common/nvim/plugins/utils.nix b/home/common/nvim/plugins/utils.nix new file mode 100644 index 0000000..833926c --- /dev/null +++ b/home/common/nvim/plugins/utils.nix @@ -0,0 +1,49 @@ +{ config, ... }: { + programs.nixvim = { + highlightOverride = { + FloatBorder.fg = "#${config.lib.stylix.colors.base0D}"; + }; + plugins = { + copilot-vim.enable = true; + flash.enable = true; + image = { + enable = true; + integrations.markdown = { + clearInInsertMode = true; + onlyRenderImageAtCursor = true; + }; + }; + tmux-navigator.enable = true; + comment.enable = true; + nvim-autopairs.enable = true; + friendly-snippets.enable = true; + todo-comments.enable = true; + treesitter = { + enable = true; + nixGrammars = true; + settings = { + indent.enable = true; + highlight.enable = true; + }; + }; + harpoon = { + enable = true; + enableTelescope = true; + keymapsSilent = true; + keymaps = { + addFile = "ha"; + toggleQuickMenu = "hu"; + navNext = "hl"; + navPrev = "hh"; + navFile = { + "1" = "h1"; + "2" = "h2"; + "3" = "h3"; + "4" = "h4"; + }; + }; + }; + # treesitter-context.enable = true; + }; + }; +} diff --git a/home/common/nvim/plugins/zenmode.nix b/home/common/nvim/plugins/zenmode.nix new file mode 100644 index 0000000..3ec69ae --- /dev/null +++ b/home/common/nvim/plugins/zenmode.nix @@ -0,0 +1,46 @@ +{ + programs.nixvim.plugins = { + zen-mode = { + enable = true; + settings = { + on_close = '' + function() + require("gitsigns.actions").toggle_current_line_blame() + vim.cmd('IBLEnable') + vim.opt.signcolumn = "yes:2" + vim.wo.wrap = false + vim.wo.linebreak = false + require("gitsigns.actions").refresh() + end + ''; + on_open = '' + function() + require("gitsigns.actions").toggle_current_line_blame() + vim.cmd('IBLDisable') + vim.opt.relativenumber = false + vim.opt.signcolumn = "no" + vim.wo.wrap = true + vim.wo.linebreak = true + require("gitsigns.actions").refresh() + end + ''; + window = { + backdrop = 1; + height = 1; + options = { + signcolumn = "no"; + number = false; + relativenumber = false; + cursorline = false; + cursorcolumn = false; + foldcolumn = "0"; + list = false; + }; + width = 0.8; + + }; + }; + }; + + }; +}