diff --git a/home/programs/nvim/default.nix b/home/programs/nvim/default.nix index 1fae26d..c288d7f 100644 --- a/home/programs/nvim/default.nix +++ b/home/programs/nvim/default.nix @@ -2,14 +2,15 @@ { inputs, ... }: { imports = [ inputs.nixvim.homeManagerModules.nixvim - ./plugins/lsp.nix - ./plugins/tree.nix - ./plugins/telescope.nix ./plugins/cmp.nix - ./plugins/ui.nix - ./plugins/utils.nix + ./plugins/git.nix + ./plugins/lsp.nix ./plugins/markdown.nix ./plugins/mini.nix + ./plugins/picker.nix + ./plugins/snacks.nix + ./plugins/trouble.nix + ./plugins/utils.nix ./options.nix ./keymaps.nix diff --git a/home/programs/nvim/keymaps.nix b/home/programs/nvim/keymaps.nix index 6b5684e..7101a95 100644 --- a/home/programs/nvim/keymaps.nix +++ b/home/programs/nvim/keymaps.nix @@ -12,31 +12,6 @@ }; 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"; @@ -47,11 +22,6 @@ mode = "n"; group = "+windows"; } - { - __unkeyed-1 = "h"; - mode = "n"; - group = "+harpoon"; - } ]; win = { border = "rounded"; @@ -62,27 +32,6 @@ 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 = "g"; - action = "LazyGit"; - options.desc = "LazyGit"; - } - { key = "s"; action = "lua require('flash').jump()"; @@ -111,6 +60,28 @@ action = "TmuxNavigateRight"; } + # Disable Arrow Keys in Normal Mode + { + key = ""; + action = ""; + options.desc = "Disable Up Arrow"; + } + { + key = ""; + action = ""; + options.desc = "Disable Down Arrow"; + } + { + key = ""; + action = ""; + options.desc = "Disable Left Arrow"; + } + { + key = ""; + action = ""; + options.desc = "Disable Right Arrow"; + } + # UI { key = "uw"; @@ -125,7 +96,7 @@ { key = "us"; action = "set spell!"; - options.desc = "Toggle spellcheck"; + options.desc = "Toggle spellLazyGitcheck"; } { key = "uc"; @@ -153,95 +124,6 @@ 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"; @@ -258,53 +140,6 @@ 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/programs/nvim/plugins/git.nix b/home/programs/nvim/plugins/git.nix new file mode 100644 index 0000000..2c01317 --- /dev/null +++ b/home/programs/nvim/plugins/git.nix @@ -0,0 +1,13 @@ +{ + programs.nixvim = { + plugins = { + gitsigns.enable = true; + snacks.settings = { lazygit.enable = true; }; + }; + keymaps = [{ + key = "gl"; + action = "lua Snacks.lazygit()"; + options.desc = "LazyGit"; + }]; + }; +} diff --git a/home/programs/nvim/plugins/lsp.nix b/home/programs/nvim/plugins/lsp.nix index 3930c60..2990a27 100644 --- a/home/programs/nvim/plugins/lsp.nix +++ b/home/programs/nvim/plugins/lsp.nix @@ -12,13 +12,6 @@ html.enable = true; svelte.enable = true; }; - keymaps.lspBuf = { - "gd" = "definition"; - "gD" = "references"; - "gt" = "type_definition"; - "gi" = "implementation"; - "K" = "hover"; - }; }; none-ls = { enable = true; diff --git a/home/programs/nvim/plugins/markdown.nix b/home/programs/nvim/plugins/markdown.nix index 533c430..8d46d2e 100644 --- a/home/programs/nvim/plugins/markdown.nix +++ b/home/programs/nvim/plugins/markdown.nix @@ -21,9 +21,12 @@ in { mkdnflow = { enable = true; mappings = { - + MkdnNextLink = { + key = ""; + modes = "n"; + }; + MkdnPrevLink = false; }; - }; }; }; diff --git a/home/programs/nvim/plugins/markdown2.nix b/home/programs/nvim/plugins/markdown2.nix deleted file mode 100644 index 77d49a2..0000000 --- a/home/programs/nvim/plugins/markdown2.nix +++ /dev/null @@ -1,190 +0,0 @@ -{ config, ... }: -let - accent = "#${config.lib.stylix.colors.base0D}"; - muted = "#${config.lib.stylix.colors.base03}"; -in { - programs.nixvim = { - # Markdown settings - extraFiles."after/ftplugin/markdown.lua".text = '' - vim.bo.tabstop = 2 - vim.bo.shiftwidth = 2 - vim.bo.expandtab = true - ''; - - # Highlight colors - highlight = { - Headline1 = { - bg = "#4B4266"; - fg = accent; - }; - Headline2 = { - bg = "#3B575E"; - fg = "#9FFEFE"; - }; - Headline3 = { - bg = "#3B5742"; - fg = "#9FFE9F"; - }; - Headline4 = { - bg = "#574842"; - fg = "#FECB9F"; - }; - - RenderMarkdownTodo.fg = "#f78c6c"; - RenderMarkdownWarning.fg = "#ff5370"; - RenderMarkdownDone.fg = muted; - }; - - # Plugins - plugins = { - # This one takes care of the markdown titles - headlines = { - enable = true; - settings = { - markdown = { - headline_highlights = - [ "Headline1" "Headline2" "Headline3" "Headline4" ]; - }; - }; - }; - - # MkdnFlow is a plugin that helps you navigate markdown files - 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"; - }; - }; - }; - - # Render UI elements - render-markdown = { - enable = true; - settings = { - heading = { enabled = false; }; - checkbox = { - unchecked = { highlight = "RenderMarkdownTodo"; }; - checked = { highlight = "RenderMarkdownDone"; }; - custom = { - pending = { - raw = "[-]"; - rendered = " "; - highlight = "RenderMarkdownTodo"; - }; - important = { - raw = "[!]"; - rendered = "󰰱 "; - highlight = "RenderMarkdownWarning"; - }; - cancel = { - raw = "[/]"; - rendered = "󱋬 "; - highlight = "RenderMarkdownWarning"; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/home/programs/nvim/plugins/mini.nix b/home/programs/nvim/plugins/mini.nix index 71fc581..2a67834 100644 --- a/home/programs/nvim/plugins/mini.nix +++ b/home/programs/nvim/plugins/mini.nix @@ -15,14 +15,7 @@ indentscope = { }; git = { }; cursorword = { }; - comment = { - mappings = { - comment = "/"; - comment_line = "/"; - comment_visual = "/"; - textobject = "/"; - }; - }; + comment = { }; starter = { }; }; }; diff --git a/home/programs/nvim/plugins/picker.nix b/home/programs/nvim/plugins/picker.nix new file mode 100644 index 0000000..9651d66 --- /dev/null +++ b/home/programs/nvim/plugins/picker.nix @@ -0,0 +1,191 @@ +{ + programs.nixvim = { + plugins = { + snacks.settings = { + picker.enable = true; + explorer.enable = true; + }; + oil.enable = true; + which-key.settings.spec = [ + { + __unkeyed-1 = "f"; + mode = "n"; + group = "+find"; + } + { + __unkeyed-1 = "g"; + mode = "n"; + group = "+git"; + } + { + __unkeyed-1 = "s"; + mode = "n"; + group = "+search"; + } + ]; + }; + keymaps = [ + # Top Pickers & Explorer + { + key = " "; + action = "lua Snacks.picker.smart()"; + options.desc = "Smart Find Files"; + } + { + key = ","; + action = "lua Snacks.picker.buffers()"; + options.desc = "Buffers"; + } + { + key = "/"; + action = "lua Snacks.picker.grep()"; + options.desc = "Grep"; + } + { + key = ":"; + action = "lua Snacks.picker.command_history()"; + options.desc = "Command History"; + } + { + key = "e"; + action = "lua Snacks.explorer()"; + options.desc = "File Explorer"; + } + { + key = "-"; + action = "Oil"; + options.desc = "Oil"; + } + + # Find + { + key = "fb"; + action = "lua Snacks.picker.buffers()"; + options.desc = "Buffers"; + } + { + key = "fc"; + action = '' + lua Snacks.picker.files({ cwd = vim.fn.stdpath("config") })''; + options.desc = "Find Config File"; + } + { + key = "ff"; + action = "lua Snacks.picker.files()"; + options.desc = "Find Files"; + } + { + key = "fg"; + action = "lua Snacks.picker.git_files()"; + options.desc = "Find Git Files"; + } + { + key = "fp"; + action = "lua Snacks.picker.projects()"; + options.desc = "Projects"; + } + { + key = "fr"; + action = "lua Snacks.picker.recent()"; + options.desc = "Recent"; + } + { + key = "fn"; + action = "lua Snacks.picker.notifications()"; + options.desc = "Notification History"; + } + + # Git + { + key = "gb"; + action = "lua Snacks.picker.git_branches()"; + options.desc = "Git Branches"; + } + { + key = "gL"; + action = "lua Snacks.picker.git_log()"; + options.desc = "Git Log Line"; + } + { + key = "gs"; + action = "lua Snacks.picker.git_status()"; + options.desc = "Git Status"; + } + { + key = "gS"; + action = "lua Snacks.picker.git_stash()"; + options.desc = "Git Stash"; + } + { + key = "gd"; + action = "lua Snacks.picker.git_diff()"; + options.desc = "Git Diff (Hunks)"; + } + { + key = "gf"; + action = "lua Snacks.picker.git_log_file()"; + options.desc = "Git Log File"; + } + + # Grep + { + key = "sb"; + action = "lua Snacks.picker.lines()"; + options.desc = "Buffer Lines"; + } + { + key = "sB"; + action = "lua Snacks.picker.grep_buffers()"; + options.desc = "Grep Open Buffers"; + } + { + key = "sg"; + action = "lua Snacks.picker.grep()"; + options.desc = "Grep"; + } + { + key = "sw"; + action = "lua Snacks.picker.grep_word()"; + options.desc = "Visual selection or word"; + } + + # LSP + { + key = "gd"; + action = "lua Snacks.picker.lsp_definitions()"; + options.desc = "Goto Definition"; + } + { + key = "gD"; + action = "lua Snacks.picker.lsp_declarations()"; + options.desc = "Goto Declaration"; + } + { + key = "gr"; + action = "lua Snacks.picker.lsp_references()"; + options.desc = "References"; + options.nowait = true; + } + { + key = "gI"; + action = "lua Snacks.picker.lsp_implementations()"; + options.desc = "Goto Implementation"; + } + { + key = "gy"; + action = "lua Snacks.picker.lsp_type_definitions()"; + options.desc = "Goto Type Definition"; + } + { + key = "ss"; + action = "lua Snacks.picker.lsp_symbols()"; + options.desc = "LSP Symbols"; + } + { + key = "sS"; + action = "lua Snacks.picker.lsp_workspace_symbols()"; + options.desc = "LSP Workspace Symbols"; + } + ]; + }; +} diff --git a/home/programs/nvim/plugins/snacks.nix b/home/programs/nvim/plugins/snacks.nix new file mode 100644 index 0000000..37a4791 --- /dev/null +++ b/home/programs/nvim/plugins/snacks.nix @@ -0,0 +1,34 @@ +{ + programs.nixvim = { + plugins.snacks = { + enable = true; + settings = { + image = { + enable = true; + doc = { inline = false; }; + }; + quickfile.enable = true; + statuscolumn.enable = true; + zen.enable = true; + }; + }; + + keymaps = [ + { + key = "uz"; + action = "lua Snacks.zen()"; + options.desc = "Zen"; + } + { + key = "ud"; + action = "lua Snacks.dim.enable()"; + options.desc = "Dim"; + } + { + key = "uD"; + action = "lua Snacks.dim.disable()"; + options.desc = "Undim"; + } + ]; + }; +} diff --git a/home/programs/nvim/plugins/telescope.nix b/home/programs/nvim/plugins/telescope.nix deleted file mode 100644 index 64c9528..0000000 --- a/home/programs/nvim/plugins/telescope.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ 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/programs/nvim/plugins/tree.nix b/home/programs/nvim/plugins/tree.nix deleted file mode 100644 index f3f6ce9..0000000 --- a/home/programs/nvim/plugins/tree.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - programs.nixvim = { - plugins = { - neo-tree.enable = true; - oil = { - enable = true; - settings = { - default_file_explorer = false; - skip_confirm_for_simple_edits = true; - view_options.is_hidden_file = '' - function(name, bufnr) - return vim.startswith(name, ".") or name == "img" - end - ''; - 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/programs/nvim/plugins/trouble.nix b/home/programs/nvim/plugins/trouble.nix new file mode 100644 index 0000000..2613274 --- /dev/null +++ b/home/programs/nvim/plugins/trouble.nix @@ -0,0 +1,46 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ ctags ]; + + programs.nixvim = { + plugins = { + trouble.enable = true; + which-key.settings.spec = [{ + __unkeyed-1 = "t"; + mode = "n"; + group = "+trouble"; + }]; + }; + keymaps = [ + { + 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)"; + } + ]; + }; +} diff --git a/home/programs/nvim/plugins/ui.nix b/home/programs/nvim/plugins/ui.nix deleted file mode 100644 index 7b23162..0000000 --- a/home/programs/nvim/plugins/ui.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: { - home.packages = with pkgs; [ ctags ]; - - programs.nixvim.plugins = { - trouble.enable = true; - lazygit.enable = true; - }; -}