From 5e5fbcfd1010f1f380d4e01709d7c08ffb9a76e4 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Wed, 10 Jul 2024 22:28:26 -0500 Subject: [PATCH] terminal/editors/neovim: lualine disable navic on large buffer --- .../editors/neovim/plugins/lualine.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/home/programs/terminal/editors/neovim/plugins/lualine.nix b/modules/home/programs/terminal/editors/neovim/plugins/lualine.nix index a07021768..bd3bfa321 100644 --- a/modules/home/programs/terminal/editors/neovim/plugins/lualine.nix +++ b/modules/home/programs/terminal/editors/neovim/plugins/lualine.nix @@ -108,7 +108,24 @@ in }; winbar = { - lualine_c = [ "navic" ]; + lualine_c = [ + { + 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 + ''; + }; + } + ]; # TODO: Need to dynamically hide/show component so navic takes precedence on smaller width lualine_x = [