diff --git a/nixos/modules/nixvim/keymaps.nix b/nixos/modules/nixvim/keymaps.nix index e792ea0..080a20d 100644 --- a/nixos/modules/nixvim/keymaps.nix +++ b/nixos/modules/nixvim/keymaps.nix @@ -1,15 +1,72 @@ -{ +{ config, lib, ... }: { programs.nixvim = { globals = { mapleader = "\\"; maplocalleader = "\\"; }; - keymaps = [ - { - key = "n"; - action = "Neotree"; - } - ]; + keymaps = let + normal = + lib.mapAttrsToList + (key: action: { + mode = "n"; + inherit action key; + }) + { + # Open Neotree + "n" = ":Neotree"; + + # Esc to clear search results + "" = ":noh"; + + # fix Y behaviour + Y = "y$"; + + # back and fourth between the two most recent files + "" = ":b#"; + + # close by Ctrl+x + "" = ":close"; + + # save by \+s or Ctrl+s + "s" = ":w"; + "" = ":w"; + + # navigate windows + "h" = "h"; + "j" = "j"; + "k" = "k"; + "l" = "l"; + + # Press 'H', 'L' to jump to start/end of a line (first/last character) + # L = "$"; + # H = "^"; + + # resize with arrows + "" = ":resize -2"; + "" = ":resize +2"; + "" = ":vertical resize +2"; + "" = ":vertical resize -2"; + + # move current line up/down + # M = Alt key + "" = ":move-2"; + "" = ":move+"; + }; + visual = + lib.mapAttrsToList + (key: action: { + mode = "v"; + inherit action key; + }) + { + # move selected line / block of text in visual mode + "K" = ":m '<-2gv=gv"; + "J" = ":m '>+1gv=gv"; + }; + in + config.nixvim.helpers.keymaps.mkKeymaps + {options.silent = true;} + (normal ++ visual); }; } diff --git a/nixos/modules/nixvim/plugins/barbar.nix b/nixos/modules/nixvim/plugins/barbar.nix index 516ec13..218fc90 100644 --- a/nixos/modules/nixvim/plugins/barbar.nix +++ b/nixos/modules/nixvim/plugins/barbar.nix @@ -6,7 +6,7 @@ next = ""; previous = ""; - close = ""; + # close = ""; }; }; }