From 9c16443e10f09bc3f3bb0846ee397bb321dd7512 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Thu, 10 Feb 2022 11:36:38 +0530 Subject: [PATCH] nvim: statusline: Handle some more cases for filename & treesitter status --- nvim/.config/nvim/after/plugin/statusline.lua | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/nvim/.config/nvim/after/plugin/statusline.lua b/nvim/.config/nvim/after/plugin/statusline.lua index 904967a..c07ce57 100644 --- a/nvim/.config/nvim/after/plugin/statusline.lua +++ b/nvim/.config/nvim/after/plugin/statusline.lua @@ -122,12 +122,14 @@ end M.get_filename = function(self) local filetype = vim.bo.filetype - - if filetype == "qf" then - return string.format(" %s%s", "%#Filename#", "QF") - else - return string.format(" %s%s", "%#Filename#", '%t%m%r') + local special_ft = { 'diff', 'fugitive', 'git', 'qf' } + for _, v in pairs(special_ft) do + if v == filetype then + return string.format(" %s%s", "%#Filename#", filetype) + end end + + return string.format(" %s%s", "%#Filename#", '%t%m%r') end M.get_fileformat = function() @@ -169,6 +171,14 @@ M.progress = function() end M.treesitter_status = function() + local filetype = vim.bo.filetype + local ignore_ft = { 'diff', 'fugitive', 'git', 'markdown', 'qf', 'text', '' } + for _, v in pairs(ignore_ft) do + if v == filetype then + return "" + end + end + if gps.is_available then return string.format("%s%s", ' %#TSStatus#', gps.get_location()) end