From 1489d5e9767748cd1c6cc60a209d749265e45bf7 Mon Sep 17 00:00:00 2001 From: Roel de Cort Date: Sat, 13 Apr 2024 01:27:37 +0200 Subject: [PATCH 1/2] add lazyvim keymaps --- config/default.nix | 3 + config/keymaps.nix | 467 ++++++++++++++++++++++++++++++ config/plugins/themes/default.nix | 45 +++ 3 files changed, 515 insertions(+) create mode 100644 config/keymaps.nix create mode 100644 config/plugins/themes/default.nix diff --git a/config/default.nix b/config/default.nix index 505d12f..d7ffff7 100644 --- a/config/default.nix +++ b/config/default.nix @@ -2,5 +2,8 @@ imports = [ ./settings.nix + ./keymaps.nix + + ./plugins/themes/default.nix ]; } diff --git a/config/keymaps.nix b/config/keymaps.nix new file mode 100644 index 0000000..ed5d65b --- /dev/null +++ b/config/keymaps.nix @@ -0,0 +1,467 @@ +{ + globals.mapleader = " "; + + keymaps = [ + + { + mode = ["n" "x"]; + key = "j"; + action = "v:count == 0 ? 'gj' : 'j'"; + options = {expr = true; silent = true;}; + } + { + mode = ["n" "x"]; + key = ""; + action = "v:count == 0 ? 'gj' : 'j'"; + options = {expr = true; silent = true;}; + } + { + mode = ["n" "x"]; + key = "k"; + action = "v:count == 0 ? 'gk' : 'k'"; + options = {expr = true; silent = true;}; + } + { + mode = ["n" "x"]; + key = ""; + action = "v:count == 0 ? 'gk' : 'k'"; + options = {expr = true; silent = true;}; + } + { + mode = "n"; + key = ""; + action = "h"; + options = {desc = "Go to Left Window"; remap = true;}; + } + { + mode = "n"; + key = ""; + action = "j"; + options = {desc = "Go to Lower Window"; remap = true;}; + } + { + mode = "n"; + key = ""; + action = "k"; + options = {desc = "Go to Upper Window"; remap = true;}; + } + { + mode = "n"; + key = ""; + action = "l"; + options = {desc = "Go to Right Window"; remap = true;}; + } + { + mode = "n"; + key = ""; + action = "resize +2"; + options = {desc = "Increase Window Height";}; + } + { + mode = "n"; + key = ""; + action = "resize -2"; + options = {desc = "Decrease Window Height";}; + } + { + mode = "n"; + key = ""; + action = "vertical resize -2"; + options = {desc = "Decrease Window Width";}; + } + { + mode = "n"; + key = ""; + action = "vertical resize +2"; + options = {desc = "Increase Window Width";}; + } + { + mode = "n"; + key = ""; + action = "m .+1=="; + options = {desc = "Move Down";}; + } + { + mode = "n"; + key = ""; + action = "m .-2=="; + options = {desc = "Move Up";}; + } + { + mode = "i"; + key = ""; + action = "m .+1==gi"; + options = {desc = "Move Down";}; + } + { + mode = "i"; + key = ""; + action = "m .-2==gi"; + options = {desc = "Move Up";}; + } + { + mode = "v"; + key = ""; + action = ":m '>+1gv=gv"; + options = {desc = "Move Down";}; + } + { + mode = "v"; + key = ""; + action = ":m '<-2gv=gv"; + options = {desc = "Move Up";}; + } + { + mode = "i"; + key = ";"; + action = ";u"; + } + { + mode = "i"; + key = "."; + action = ".u"; + } + { + mode = "i"; + key = ";"; + action = ";u"; + } + { + mode = ["i" "x" "n" "s"]; + key = ""; + action = "w"; + options = {desc = "Save File";}; + } + { + mode = ["i" "n"]; + key = ""; + action = "noh"; + options = {desc = "Escape and Clear hlsearch";}; + } + { + mode = "n"; + key = "ur"; + action = "nohlsearchdiffupdatenormal! "; + options = {desc = "Redraw / Clear hlsearch / Diff Update";}; + } + { + mode = "n"; + key = "n"; + action = "'Nn'[v:searchforward].'zv'"; + options = {expr = true; desc = "Next Search Result";}; + } + { + mode = "x"; + key = "n"; + action = "'Nn'[v:searchforward]"; + options = {expr = true; desc = "Next Search Result";}; + } + { + mode = "o"; + key = "n"; + action = "'Nn'[v:searchforward]"; + options = {expr = true; desc = "Next Search Result";}; + } + { + mode = "n"; + key = "N"; + action = "'nN'[v:searchforward].'zv'"; + options = {expr = true; desc = "Prev Search Result";}; + } + { + mode = "x"; + key = "N"; + action = "'nN'[v:searchforward]"; + options = {expr = true; desc = "Prev Search Result";}; + } + { + mode = "o"; + key = "N"; + action = "'nN'[v:searchforward]"; + options = {expr = true; desc = "Prev Search Result";}; + } + { + mode = ["n" "v"]; + key = "cf"; + action = "function()\n LazyVim.format({ force = true })\nend"; + options = {desc = "Format";}; + } + { + mode = "n"; + key = "cd"; + action = "vim.diagnostic.open_float"; + options = {desc = "Line Diagnostics";}; + } + { + mode = "n"; + key = "]d"; + action = "diagnostic_goto(true)"; + options = {desc = "Next Diagnostic";}; + } + { + mode = "n"; + key = "[d"; + action = "diagnostic_goto(false)"; + options = {desc = "Prev Diagnostic";}; + } + { + mode = "n"; + key = "]e"; + action = "diagnostic_goto(true 'ERROR')"; + options = {desc = "Next Error";}; + } + { + mode = "n"; + key = "[e"; + action = "diagnostic_goto(false 'ERROR')"; + options = {desc = "Prev Error";}; + } + { + mode = "n"; + key = "]w"; + action = "diagnostic_goto(true 'WARN')"; + options = {desc = "Next Warning";}; + } + { + mode = "n"; + key = "[w"; + action = "diagnostic_goto(false 'WARN')"; + options = {desc = "Prev Warning";}; + } + { + mode = "n"; + key = "uf"; + action = "function() LazyVim.format.toggle() end"; + options = {desc = "Toggle Auto Format (Global)";}; + } + { + mode = "n"; + key = "uF"; + action = "function() LazyVim.format.toggle(true) end"; + options = {desc = "Toggle Auto Format (Buffer)";}; + } + { + mode = "n"; + key = "us"; + action = "function() LazyVim.toggle('spell') end"; + options = {desc = "Toggle Spelling";}; + } + { + mode = "n"; + key = "uw"; + action = "function() LazyVim.toggle('wrap') end"; + options = {desc = "Toggle Word Wrap";}; + } + { + mode = "n"; + key = "uL"; + action = "function() LazyVim.toggle('relativenumber') end"; + options = {desc = "Toggle Relative Line Numbers";}; + } + { + mode = "n"; + key = "ul"; + action = "function() LazyVim.toggle.number() end"; + options = {desc = "Toggle Line Numbers";}; + } + { + mode = "n"; + key = "ud"; + action = "function() LazyVim.toggle.diagnostics() end"; + options = {desc = "Toggle Diagnostics";}; + } + { + mode = "n"; + key = "uc"; + action = "function() LazyVim.toggle('conceallevel'; false; {0; conceallevel}) end"; + options = {desc = "Toggle Conceal";}; + } + { + mode = "n"; + key = "uh"; + action = "function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end"; + options = {desc = "Toggle Treesitter Highlight";}; + } + { + mode = "n"; + key = "ub"; + action = "function() LazyVim.toggle('background'; false; {'light'; 'dark'}) end"; + options = {desc = "Toggle Background";}; + } + { + mode = "n"; + key = "gg"; + action = "function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end"; + options = {desc = "Lazygit (Root Dir)";}; + } + { + mode = "n"; + key = "gG"; + action = "function() LazyVim.lazygit() end"; + options = {desc = "Lazygit (cwd)";}; + } + { + mode = "n"; + key = "gb"; + action = "LazyVim.lazygit.blame_line"; + options = {desc = "Git Blame Line";}; + } + { + mode = "n"; + key = "gf"; + action = "function()\n local git_path = vim.api.nvim_buf_get_name(0)\n LazyVim.lazygit({args = { \"-f\"; vim.trim(git_path) }})\nend"; + options = {desc = "Lazygit Current File History";}; + } + { + mode = "n"; + key = "qq"; + action = "qa"; + options = {desc = "Quit All";}; + } + { + mode = "n"; + key = "ui"; + action = "vim.show_pos"; + options = {desc = "Inspect Pos";}; + } + { + mode = "n"; + key = "ft"; + action = "lazyterm"; + options = {desc = "Terminal (Root Dir)";}; + } + { + mode = "n"; + key = "fT"; + action = "function() LazyVim.terminal() end"; + options = {desc = "Terminal (cwd)";}; + } + { + mode = "n"; + key = ""; + action = "lazyterm"; + options = {desc = "Terminal (Root Dir)";}; + } + { + mode = "n"; + key = ""; + action = "lazyterm"; + options = {desc = "which_key_ignore";}; + } + { + mode = "t"; + key = ""; + action = ""; + options = {desc = "Enter Normal Mode";}; + } + { + mode = "t"; + key = ""; + action = "wincmd h"; + options = {desc = "Go to Left Window";}; + } + { + mode = "t"; + key = ""; + action = "wincmd j"; + options = {desc = "Go to Lower Window";}; + } + { + mode = "t"; + key = ""; + action = "wincmd k"; + options = {desc = "Go to Upper Window";}; + } + { + mode = "t"; + key = ""; + action = "wincmd l"; + options = {desc = "Go to Right Window";}; + } + { + mode = "t"; + key = ""; + action = "close"; + options = {desc = "Hide Terminal";}; + } + { + mode = "t"; + key = ""; + action = "close"; + options = {desc = "which_key_ignore";}; + } + { + mode = "n"; + key = "ww"; + action = "p"; + options = {desc = "Other Window"; remap = true;}; + } + { + mode = "n"; + key = "wd"; + action = "c"; + options = {desc = "Delete Window"; remap = true;}; + } + { + mode = "n"; + key = "w-"; + action = "s"; + options = {desc = "Split Window Below"; remap = true;}; + } + { + mode = "n"; + key = "w|"; + action = "v"; + options = {desc = "Split Window Right"; remap = true;}; + } + { + mode = "n"; + key = "-"; + action = "s"; + options = {desc = "Split Window Below"; remap = true;}; + } + { + mode = "n"; + key = "|"; + action = "v"; + options = {desc = "Split Window Right"; remap = true;}; + } + { + mode = "n"; + key = "l"; + action = "tablast"; + options = {desc = "Last Tab";}; + } + { + mode = "n"; + key = "f"; + action = "tabfirst"; + options = {desc = "First Tab";}; + } + { + mode = "n"; + key = ""; + action = "tabnew"; + options = {desc = "New Tab";}; + } + { + mode = "n"; + key = "]"; + action = "tabnext"; + options = {desc = "Next Tab";}; + } + { + mode = "n"; + key = "d"; + action = "tabclose"; + options = {desc = "Close Tab";}; + } + { + mode = "n"; + key = "["; + action = "tabprevious"; + options = {desc = "Previous Tab";}; + } + ]; +} + diff --git a/config/plugins/themes/default.nix b/config/plugins/themes/default.nix new file mode 100644 index 0000000..8cba6ba --- /dev/null +++ b/config/plugins/themes/default.nix @@ -0,0 +1,45 @@ +{config, ...}: let + lua = x: {__raw = x;}; +in { + colorschemes = { + catppuccin = { + enable = true; + background = { + light = "macchiato"; + dark = "mocha"; + }; + flavour = "frappe"; # "latte", "mocha", "frappe", "macchiato" or raw lua code + disableBold = false; + disableItalic = false; + disableUnderline = false; + transparentBackground = true; + integrations = { + cmp = true; + noice = true; + notify = true; + gitsigns = true; + which_key = true; + illuminate = { + enabled = true; + }; + treesitter = true; + treesitter_context = true; + telescope.enabled = true; + indent_blankline.enabled = true; + mini.enabled = true; + native_lsp = { + enabled = true; + inlay_hints = { + background = true; + }; + underlines = { + errors = ["underline"]; + hints = ["underline"]; + information = ["underline"]; + warnings = ["underline"]; + }; + }; + }; + }; + }; +} From 21d6becef2645514eec2e8481ff686bf5338834d Mon Sep 17 00:00:00 2001 From: Roel de Cort Date: Sat, 13 Apr 2024 01:38:23 +0200 Subject: [PATCH 2/2] remove unneeded keymaps --- config/keymaps.nix | 120 --------------------------------------------- 1 file changed, 120 deletions(-) diff --git a/config/keymaps.nix b/config/keymaps.nix index ed5d65b..d1bb12c 100644 --- a/config/keymaps.nix +++ b/config/keymaps.nix @@ -180,12 +180,6 @@ action = "'nN'[v:searchforward]"; options = {expr = true; desc = "Prev Search Result";}; } - { - mode = ["n" "v"]; - key = "cf"; - action = "function()\n LazyVim.format({ force = true })\nend"; - options = {desc = "Format";}; - } { mode = "n"; key = "cd"; @@ -228,90 +222,6 @@ action = "diagnostic_goto(false 'WARN')"; options = {desc = "Prev Warning";}; } - { - mode = "n"; - key = "uf"; - action = "function() LazyVim.format.toggle() end"; - options = {desc = "Toggle Auto Format (Global)";}; - } - { - mode = "n"; - key = "uF"; - action = "function() LazyVim.format.toggle(true) end"; - options = {desc = "Toggle Auto Format (Buffer)";}; - } - { - mode = "n"; - key = "us"; - action = "function() LazyVim.toggle('spell') end"; - options = {desc = "Toggle Spelling";}; - } - { - mode = "n"; - key = "uw"; - action = "function() LazyVim.toggle('wrap') end"; - options = {desc = "Toggle Word Wrap";}; - } - { - mode = "n"; - key = "uL"; - action = "function() LazyVim.toggle('relativenumber') end"; - options = {desc = "Toggle Relative Line Numbers";}; - } - { - mode = "n"; - key = "ul"; - action = "function() LazyVim.toggle.number() end"; - options = {desc = "Toggle Line Numbers";}; - } - { - mode = "n"; - key = "ud"; - action = "function() LazyVim.toggle.diagnostics() end"; - options = {desc = "Toggle Diagnostics";}; - } - { - mode = "n"; - key = "uc"; - action = "function() LazyVim.toggle('conceallevel'; false; {0; conceallevel}) end"; - options = {desc = "Toggle Conceal";}; - } - { - mode = "n"; - key = "uh"; - action = "function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end"; - options = {desc = "Toggle Treesitter Highlight";}; - } - { - mode = "n"; - key = "ub"; - action = "function() LazyVim.toggle('background'; false; {'light'; 'dark'}) end"; - options = {desc = "Toggle Background";}; - } - { - mode = "n"; - key = "gg"; - action = "function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end"; - options = {desc = "Lazygit (Root Dir)";}; - } - { - mode = "n"; - key = "gG"; - action = "function() LazyVim.lazygit() end"; - options = {desc = "Lazygit (cwd)";}; - } - { - mode = "n"; - key = "gb"; - action = "LazyVim.lazygit.blame_line"; - options = {desc = "Git Blame Line";}; - } - { - mode = "n"; - key = "gf"; - action = "function()\n local git_path = vim.api.nvim_buf_get_name(0)\n LazyVim.lazygit({args = { \"-f\"; vim.trim(git_path) }})\nend"; - options = {desc = "Lazygit Current File History";}; - } { mode = "n"; key = "qq"; @@ -324,30 +234,6 @@ action = "vim.show_pos"; options = {desc = "Inspect Pos";}; } - { - mode = "n"; - key = "ft"; - action = "lazyterm"; - options = {desc = "Terminal (Root Dir)";}; - } - { - mode = "n"; - key = "fT"; - action = "function() LazyVim.terminal() end"; - options = {desc = "Terminal (cwd)";}; - } - { - mode = "n"; - key = ""; - action = "lazyterm"; - options = {desc = "Terminal (Root Dir)";}; - } - { - mode = "n"; - key = ""; - action = "lazyterm"; - options = {desc = "which_key_ignore";}; - } { mode = "t"; key = ""; @@ -384,12 +270,6 @@ action = "close"; options = {desc = "Hide Terminal";}; } - { - mode = "t"; - key = ""; - action = "close"; - options = {desc = "which_key_ignore";}; - } { mode = "n"; key = "ww";