From a58f43a3155f1913a123e3ae119a56df298941d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Wed, 10 Aug 2022 10:41:35 +0100 Subject: [PATCH] add bufferline --- .../vim/modules/visual/bufferline.nix | 72 +++++++++++++++++++ .../vim/modules/visual/vim-devicons.nix | 5 ++ 2 files changed, 77 insertions(+) create mode 100644 config/programs/vim/modules/visual/bufferline.nix create mode 100644 config/programs/vim/modules/visual/vim-devicons.nix diff --git a/config/programs/vim/modules/visual/bufferline.nix b/config/programs/vim/modules/visual/bufferline.nix new file mode 100644 index 00000000..5565538c --- /dev/null +++ b/config/programs/vim/modules/visual/bufferline.nix @@ -0,0 +1,72 @@ +{ pkgs, lib, ... }: { + vim.keybindings = { + keybindings = { + "[" = { + b = { + command = "BufferLineCycleNext"; + label = "Navigate to next buffer"; + options.silent = true; + }; + }; + "]" = { + b = { + command = "BufferLineCyclePrev"; + label = "Navigate to previous buffer"; + options.silent = true; + }; + }; + "" = { + b = { + label = "Buffer commands"; + d = { + command = "BufferLineSortByDirectory"; + label = "Sort bufferline by directory"; + options.silent = true; + }; + e = { + command = "BufferLineSortByExtension"; + label = "Sort bufferline by extension"; + options.silent = true; + }; + "$" = { + command = "BufferLineGoToBuffer -1"; + label = "Go to last buffer"; + options.silent = true; + }; + } // (lib.attrsets.genAttrs ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"] (n: { + command = "BufferLineGoToBuffer ${n}"; + label = "Go to buffer ${n}"; + options.silent = true; + })); + }; + g = { + b = { + command = "BufferLinePick"; + label = "Go to buffer"; + options.silent = true; + }; + }; + }; + }; + output.plugins = with pkgs.vimPlugins; [ + bufferline-nvim + ]; + output.extra_config = '' + set termguicolors + lua << EOF + require("bufferline").setup{ + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local s = " " + for e, n in pairs(diagnostics_dict) do + local sym = e == "error" and " " + or (e == "warning" and " " or "" ) + s = s .. n .. sym + end + return s + end + } + EOF + ''; +} + diff --git a/config/programs/vim/modules/visual/vim-devicons.nix b/config/programs/vim/modules/visual/vim-devicons.nix new file mode 100644 index 00000000..69769a5b --- /dev/null +++ b/config/programs/vim/modules/visual/vim-devicons.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + output.plugins = with pkgs.vimPlugins; [ + vim-web-devicons + ]; +}