From 8fdc927d178eda80df23f6848ab068d38221035d Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Wed, 10 Jul 2024 22:44:31 -0500 Subject: [PATCH] terminal/editors/neovim: lualine disable aerial and location on large buffers --- .../editors/neovim/plugins/lualine.nix | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/modules/home/programs/terminal/editors/neovim/plugins/lualine.nix b/modules/home/programs/terminal/editors/neovim/plugins/lualine.nix index bd3bfa321..cf60d07e8 100644 --- a/modules/home/programs/terminal/editors/neovim/plugins/lualine.nix +++ b/modules/home/programs/terminal/editors/neovim/plugins/lualine.nix @@ -1,6 +1,18 @@ { config, lib, ... }: let inherit (lib) mkIf; + + cond.__raw = # Lua + '' + function() + local buf_size_limit = 1024 * 1024 -- 1MB size limit + if vim.api.nvim_buf_get_offset(0, vim.api.nvim_buf_line_count(0)) > buf_size_limit then + return false + end + + return true + end + ''; in { programs.nixvim = { @@ -69,6 +81,8 @@ in { name = "aerial"; extraConfig = { + inherit cond; + # -- The separator to be used to separate symbols in status line. sep = " ) "; @@ -90,6 +104,15 @@ in }; } ]; + + lualine_z = [ + { + name = "location"; + extraConfig = { + inherit cond; + }; + } + ]; }; tabline = mkIf (!config.programs.nixvim.plugins.bufferline.enable) { @@ -112,17 +135,7 @@ in { name = "navic"; extraConfig = { - cond.__raw = # Lua - '' - function() - local buf_size_limit = 1024 * 1024 -- 1MB size limit - if vim.api.nvim_buf_get_offset(0, vim.api.nvim_buf_line_count(0)) > buf_size_limit then - return false - end - - return true - end - ''; + inherit cond; }; } ];