From 07209b572031a01d7a76099c027b9779770840d1 Mon Sep 17 00:00:00 2001 From: Andrey0189 Date: Thu, 18 Apr 2024 09:51:55 +0500 Subject: Optimizing keymaps --- nixos/modules/nixvim/keymaps.nix | 71 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 7 deletions(-) (limited to 'nixos/modules/nixvim/keymaps.nix') 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); }; } -- cgit v1.2.3 method='get'>
context:
space:
mode:
authorPeter2024-07-26 11:11:26 +0100
committerPeter2024-07-26 11:11:26 +0100
commitcd5e47d8dd72aa69300f710d2d387c14302422a7 (patch)
tree549fd31a632860fab3d978ab4b5b1138c43de003 /.local/bin/cbzviewer
parentc30165a2aef2c56fc7f5c3ac4a9b15edc81b8f30 (diff)
downloaddotfiles-cd5e47d8dd72aa69300f710d2d387c14302422a7.tar.gz
dotfiles-cd5e47d8dd72aa69300f710d2d387c14302422a7.tar.bz2
dotfiles-cd5e47d8dd72aa69300f710d2d387c14302422a7.zip
Simplified folder structure
Diffstat (limited to '.local/bin/cbzviewer')