Prechádzať zdrojové kódy

nixpkgs/neovim: restore git branch on statusline

mini.statusline was relying on gitsigns.nvim for this. We also don't
want to enable mini.git since it would clobber fugitive :Git
Thomas Dy 2 týždňov pred
rodič
commit
f2185514cc
1 zmenil súbory, kde vykonal 6 pridanie a 1 odobranie
  1. 6 1
      .config/nixpkgs/neovim/plugins.lua

+ 6 - 1
.config/nixpkgs/neovim/plugins.lua

@@ -232,12 +232,17 @@ MiniDiff.setup({
   }
 })
 
+local function section_git(args)
+  if MiniStatusline.is_truncated(args.trunc_width) then return '' end
+  return vim.fn.FugitiveHead()
+end
+
 require('mini.statusline').setup({
   content = {
     -- copy-pasted from default, we just want to remove the icon
     active = function()
       local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
-      local git           = MiniStatusline.section_git({ trunc_width = 75, icon = '' })
+      local git           = section_git({ trunc_width = 75 })
       local diagnostics   = MiniStatusline.section_diagnostics({ trunc_width = 75, icon = '' })
       local filename      = MiniStatusline.section_filename({ trunc_width = 140 })
       local fileinfo      = MiniStatusline.section_fileinfo({ trunc_width = 120 })