vim: Fix tabline bindings

This commit is contained in:
Geoffrey Frogeye 2024-01-25 23:53:59 +01:00
parent dfc8d68495
commit 0bb5981f3a
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8

View file

@ -1,7 +1,16 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
{ {
config = { config = {
programs.nixvim = { programs = {
# https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
alacritty.settings.key_bindings = [
{ key = "H"; mods = "Control|Shift"; chars = "\\x1b[72;5u"; }
{ key = "L"; mods = "Control|Shift"; chars = "\\x1b[76;5u"; }
] ++ (map
(n: { key = "Key${builtins.toString n}"; mods = "Control"; chars = "\\x1b[${builtins.toString (48+n)};5u"; })
(lib.lists.range 0 9));
# Ctrl+<number> doesn't get interpreted, but Ctrl+Shift+<number> does, so let's use that
nixvim = {
autoCmd = [ autoCmd = [
# Turn off relativenumber only for insert mode # Turn off relativenumber only for insert mode
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; } { event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
@ -10,27 +19,21 @@
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
nvim-scrollview # Scroll bar nvim-scrollview # Scroll bar
]; ];
keymaps = [ keymaps =
let
options = { silent = true; };
in
[
# barbar # barbar
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; } { key = "gb"; action = "<Cmd>BufferPick<CR>"; inherit options; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; } { key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; inherit options; }
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/ { key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; inherit options; }
{ key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; } { key = "<C-S-H>"; action = "<Cmd>BufferMovePrevious<CR>"; inherit options; }
{ key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; } { key = "<C-S-L>"; action = "<Cmd>BufferMoveNext<CR>"; inherit options; }
# TODO gotos don't work { key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; inherit options; }
{ key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; } ] ++ (map
{ key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; } (n: { key = "<C-${builtins.toString n}>"; action = "<Cmd>BufferGoto ${builtins.toString n}<CR>"; inherit options; })
{ key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; } (lib.lists.range 1 9));
{ key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
{ key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
{ key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
{ key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
{ key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
{ key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
# TODO Other useful options?
];
options = { options = {
showmode = false; showmode = false;
number = true; number = true;
@ -40,7 +43,6 @@
plugins = { plugins = {
# Tabline # Tabline
barbar.enable = true; barbar.enable = true;
# TODO Investigate bufferline?
# Status line # Status line
lualine = with config.lib.stylix.colors.withHashtag; let lualine = with config.lib.stylix.colors.withHashtag; let
normal = { fg = base05; bg = base01; }; normal = { fg = base05; bg = base01; };
@ -153,4 +155,5 @@
}; };
}; };
}; };
};
} }