Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk
4fad50925d5625376bf18361a4df229927a0ed0a
Oliver Krylow <o.krylow@isp-insoft.de> ·
unsigned
- Parent 1: 0da4a2334e2e · Diff against parent 1
- Parent 2: fc1e16222c20 · Showing diff
bugabingas dorkfiles
4fad50925d5625376bf18361a4df229927a0ed0a
Oliver Krylow <o.krylow@isp-insoft.de> ·
unsigned
+685 / −719 text lines
+5 / −4 text lines
+0 / −15 text lines
+20 / −15 text lines
"indent-blankline.nvim": { "branch": "master", "commit": "046e2cf04e08ece927bacbfb87c5b35c0b636546" }, "lazy.nvim": { "branch": "main", "commit": "e42fccc3cda70266e0841c5126de2c23e8982800" }, "hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" }, "inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" }, "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, "lazy.nvim": { "branch": "main", "commit": "7ca3bdb566c3ba4492f2d22b37c2c9e26f09470f" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, "nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" }, "nvim-neoclip.lua": { "branch": "main", "commit": "4e406ae0f759262518731538f2585abb9d269bac" }, "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, "nvim-surround": { "branch": "main", "commit": "4f0e1f470595af067eca9b872778d83c7f52f134" }, "nvim-treesitter": { "branch": "master", "commit": "44762abc90725e279f3b9cfbe4cafb41ea72f09b" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "eb208bfdfcf76efea0424747e23e44641e13aaa6" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-spectre": { "branch": "master", "commit": "be7ff1d29ddf2de59b3dc293988d110c2c00ac84" }, "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" }, "nvim-treesitter": { "branch": "master", "commit": "d6c9c85e14e15bc59478a0d5d810e88dad0ac53f" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "4c344ffc8d54d7e1ba2cefaaa2c10ea93aa1cc2d" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" }, "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, "telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "b0015e6e4b46a64192c64b68dec9a9ac5a4e5690" }, "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" }, "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, "todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" }, "toggleterm.nvim": { "branch": "main", "commit": "c80844fd52ba76f48fabf83e2b9f9b93273f418d" }, "treesj": { "branch": "main", "commit": "070e6761d0b11a55446d988a69908f7a0928dbab" }, "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" }, "virt-column.nvim": { "branch": "master", "commit": "9c82009c53e5f9d43b6c0f5e8cb69c53663b786a" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, "zen-mode.nvim": { "branch": "main", "commit": "50e2e2a36cc97847d9ab3b1a3555ba2ef6839b50" }}No final newline "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" }, "toggleterm.nvim": { "branch": "main", "commit": "faee9d60428afc7857e0927fdc18daa6c409fa64" }, "treesj": { "branch": "main", "commit": "bff8c32b826e188fa558e94c7c93ac17a8ef0365" }, "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" }, "virt-column.nvim": { "branch": "master", "commit": "5fc72873dc3175eddbdbbedea8071919c99ad755" }, "which-key.nvim": { "branch": "main", "commit": "bf09a25bdc9a83bcc69d2cf078e680368676513b" }, "zen-mode.nvim": { "branch": "main", "commit": "6e6c963d70a8e47854fa656987666bfb863f9c4e" }}+8 / −0 text lines
+10 / −8 text lines
+1 / −1 text lines
+1 / −0 text lines
+573 / −672 text lines
---@diagnostic disable: param-type-mismatch { 'rebelot/heirline.nvim', event = 'BufEnter', dependencies = { 'nvim-tree/nvim-web-devicons', 'lewis6991/gitsigns.nvim', }, config = function () local heirline = require 'heirline' local conditions = require 'heirline.conditions' local utils = require 'heirline.utils' local nugu = require 'bugabinga.nugu.palette' heirline.load_colors( nugu ) auto 'reload_heirline_colors' { description = 'Reload dark/light nugu colors for Heirline', events = 'ColorScheme', command = function () utils.on_colorscheme( nugu ) end, } local vi_mode = { init = function ( self ) self.mode = vim.fn.mode( 1 ) -- :h mode() end, static = { mode_names = { n = icon.normal, no = icon.normal .. '?', nov = icon.normal .. '?', noV = icon.normal .. '?', ['no\22'] = icon.normal .. '?', niI = icon.normal .. 'i', niR = icon.normal .. 'r', niV = icon.normal .. 'v', nt = icon.normal .. 't', v = icon.visual, vs = icon.visual .. 's', V = icon.visual .. '_', Vs = icon.visual .. 's', ['\22'] = '^' .. icon.visual, ['\22s'] = '^' .. icon.visual, s = icon.select, S = icon.select .. '_', ['\19'] = '^' .. icon.select, i = icon.insert, ic = icon.insert .. 'c', ix = icon.insert .. 'x', R = icon.replace, Rc = icon.replace .. 'c', Rx = icon.replace .. 'x', Rv = icon.replace .. 'v', Rvc = icon.replace .. 'v', Rvx = icon.replace .. 'v', c = icon.command, cv = icon.command .. 'x', r = icon.pending, rm = icon.pending .. 'm', ['r?'] = icon.pending .. '?', ['!'] = icon.exclaim, t = icon.terminal, }, mode_colors = { n = 'ui_normal', i = 'ui_accent', v = 'ui_important_global', V = 'ui_important_global', ['\22'] = 'ui_important_global', c = 'ui_important_global', s = 'ui_important_global', S = 'ui_important_global', ['\19'] = 'ui_important_global', R = 'ui_important_global', r = 'ui_important_global', ['!'] = 'ui_important_global', t = 'ui_important_global', } }, provider = function ( self ) local mode_name = self.mode_names[self.mode] return ' ' .. icon.vim .. ' %3(' .. mode_name .. '%) ' end, hl = function ( self ) local mode = self.mode:sub( 1, 1 ) -- get only the first mode character return { fg = self.mode_colors[mode], bold = true } end, update = { 'ModeChanged', pattern = '*:*', callback = vim.schedule_wrap( function () vim.cmd.redrawstatus() end ), }, } local file_icon = { init = function ( self ) local filename = self.filename local extension = vim.fn.fnamemodify( filename, ':e' ) self.icon = require 'nvim-web-devicons'.get_icon_color( filename, extension, { default = true } ) end, provider = function ( self ) return self.icon and (self.icon .. ' ') end, hl = 'DefaultIcon', } local file_name = { init = function ( self ) self.lfilename = vim.fs.normalize( vim.fn.fnamemodify( self.filename, ':.' ) ) if self.lfilename == '' then self.lfilename = NEW_FILE end end, flexible = 2, { provider = function ( self ) return self.lfilename end, }, { provider = function ( self ) return vim.fs.normalize( vim.fn.pathshorten( self.lfilename ) ) end, }, } local file_flags = { { condition = function () return vim.bo.modified end, provider = string.format( ' %s ', icon.modified ), hl = 'Comment', }, { condition = function () return not vim.bo.modifiable or vim.bo.readonly end, provider = string.format( ' %s ', icon.lock ), hl = 'ErrorMsg', }, } local file_name_block = { init = function ( self ) self.filename = vim.fs.normalize( vim.api.nvim_buf_get_name( 0 ) ) end, file_icon, { provider = ' ' }, file_name, file_flags, { provider = '%<' } -- this means that the statusline is cut here when there's not enough space } local file_type = { provider = function () return icon.file .. ' ' .. string.upper( vim.bo.filetype ) end, } local file_encoding = { provider = function () local enc = (vim.bo.fenc ~= '' and vim.bo.fenc) or vim.o.enc -- :h 'enc' return enc ~= 'utf-8' and enc:upper() end, } local file_format = { static = { dos = icon.newline .. icon.carriage_return, unix = icon.newline, mac = icon.carriage_return, }, provider = function ( self ) local fileformat = vim.bo.fileformat return self[fileformat] end } local file_size = { provider = function () -- stackoverflow, compute human readable file size -- i want to see vim opening a 1EiB file local suffix = { 'b', 'k', 'M', 'G', 'T', 'P', 'E' } local fsize = vim.fn.getfsize( vim.api.nvim_buf_get_name( 0 ) ) fsize = (fsize < 0 and 0) or fsize if fsize < 1024 then return fsize .. suffix[1] end local i = math.floor( (math.log( fsize ) / math.log( 1024 )) ) return string.format( '%.2g%s', fsize / math.pow( 1024, i ), suffix[i + 1] ) end, } local file_last_modified = { provider = function () local ftime = vim.fn.getftime( vim.api.nvim_buf_get_name( 0 ) ) if ftime > 0 then local timeago = require 'std.timeago' return timeago.format( ftime ) end end, } local lsp_active = { condition = conditions.lsp_attached, update = { 'LspAttach', 'LspDetach', 'BufEnter' }, provider = function () local names = {} for _, client in pairs( vim.lsp.get_clients { bufnr = 0 } ) do table.insert( names, client.name ) end return icon.lsp .. ' ' .. table.concat( names, ' ' ) end, } local diagnostic_enabled = { init = function ( self ) self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on end, provider = function ( self ) return icon.diagnostic .. ' ' .. self.icon end, } local diagnostic = { condition = conditions.has_diagnostics, static = { error_icon = icon.error, warn_icon = icon.warn, info_icon = icon.info, hint_icon = icon.hint, }, init = function ( self ) self.errors = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.ERROR } ) self.warnings = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.WARN } ) self.hints = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.HINT } ) self.info = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.INFO } ) end, update = { 'DiagnosticChanged', 'BufEnter' }, { provider = function ( self ) -- 0 is just another output, we can decide to print it or not! return self.errors > 0 and (self.error_icon .. ' ' .. self.errors .. ' ') end, hl = 'DiagnosticError', }, { provider = function ( self ) return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. ' ') end, hl = 'DiagnosticWarn', }, { provider = function ( self ) return self.info > 0 and (self.info_icon .. ' ' .. self.info .. ' ') end, hl = 'DiagnosticInfo', }, { provider = function ( self ) return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints) end, hl = 'DiagnosticHint', }, } local is_svn_repo = function () local svn_dir = vim.fs.find( '.svn', { upward = true, stop = vim.uv.os_homedir(), path = vim.fs.dirname( vim.api.nvim_buf_get_name( 0 ) ), type = 'directory', } ) return not vim.tbl_isempty( svn_dir ) end local svn_get_relative_url = function () -- FIXME: replace with vim.system local job = require 'plenary.job' local relative_url = { '[ERR]' } job:new { command = 'svn', args = { 'info', '--show-item', 'relative-url', '--no-newline' }, on_exit = function ( current_job, exit_code ) if exit_code == 0 then relative_url = current_job:result() end end, }:sync() return relative_url[1] end local svn = { condition = is_svn_repo, update = 'BufEnter', init = function ( self ) self.relative_url = svn_get_relative_url() end, { provider = function ( self ) return icon.subversion .. ' ' .. icon.branch .. ' ' .. self.relative_url end, }, } local git = { condition = conditions.is_git_repo, init = function ( self ) self.status_dict = vim.b.gitsigns_status_dict end, { provider = function ( self ) return icon.git .. ' ' .. icon.branch .. ' ' .. self.status_dict.head .. ' ' end, }, { provider = function ( self ) local count = self.status_dict.added or 0 return count > 0 and (icon.diff_add .. ' ' .. count .. ' ') end, hl = 'DiffAdd', }, { provider = function ( self ) local count = self.status_dict.removed or 0 return count > 0 and (icon.diff_remove .. ' ' .. count .. ' ') end, hl = 'DiffDelete', }, { provider = function ( self ) local count = self.status_dict.changed or 0 return count > 0 and (icon.diff_change .. ' ' .. count .. ' ') end, hl = 'DiffChange', }, } local work_dir = { init = function ( self ) self.icon = (vim.fn.haslocaldir( 0 ) == 1 and icon['local'] or '') .. ' ' .. icon.global .. ' ' self.cwd = vim.fs.normalize( vim.uv.cwd() ):gsub( vim.fs.normalize( vim.uv.os_homedir() ), '~' ) end, flexible = 1, { provider = function ( self ) return self.icon .. self.cwd end, }, { provider = function ( self ) local cwd = vim.fn.pathshorten( self.cwd ) return self.icon .. cwd end, }, { provider = '', } } local help_file_name = { condition = function () return vim.bo.filetype == 'help' end, provider = function () local filename = vim.api.nvim_buf_get_name( 0 ) return vim.fn.fnamemodify( filename, ':t' ) end, hl = 'Question', } local terminal_name = { provider = function () local name, _ = vim.api.nvim_buf_get_name( 0 ):gsub( '.*:', '' ) local basename = vim.fs.basename( name ) return icon.terminal .. ' ' .. (basename or 'noname') end, hl = 'Bold', } local togglers = { provider = function () local togglers = require 'bugabinga.options.togglers' return tostring( togglers ) end, } local macro_recording = { condition = function () return vim.fn.reg_recording() ~= '' and vim.o.cmdheight == 0 end, provider = icon.macro .. ' ', hl = 'PreProc', utils.surround( { '░▒▓ ', ' ▓▒░' }, nil, { provider = function () return vim.fn.reg_recording() end, hl = 'Bold', } ), update = { 'RecordingEnter', 'RecordingLeave', } } local lazy = { condition = function () local ok, lazy_status = pcall( require, 'lazy.status' ) return ok and lazy_status.has_updates() end, update = { 'User', pattern = 'LazyUpdate' }, provider = function () return ' ' .. icon.lazy .. ' ' .. require 'lazy.status'.updates() .. ' ' end, on_click = { callback = function () require 'lazy'.update() end, name = 'update_plugins', }, } local align = { provider = '%=' } local space = { provider = ' ' } local default_statusline = { vi_mode, macro_recording, align, work_dir, space, git, svn, align, diagnostic_enabled, space, diagnostic, space, lsp_active, align, togglers, align, lazy, space, file_encoding, space, file_format, space, file_type, space, file_size, space, file_last_modified, } local special_statusline = { condition = function () return conditions.buffer_matches { buftype = ignored.buftypes, filetype = ignored.filetypes, } end, file_type, space, help_file_name, align } local terminal_statusline = { condition = function () return conditions.buffer_matches { buftype = { 'terminal' } } end, { condition = conditions.is_active, vi_mode, space }, file_type, space, terminal_name, align, } local inactive_statusline = { condition = conditions.is_not_active, file_type, space, file_name, align, } local statuslines = { hl = function () if conditions.is_active() then return 'StatusLine' else return 'StatusLineNC' end end, fallthrough = false, special_statusline, terminal_statusline, inactive_statusline, default_statusline, } local winbars = { hl = function () if conditions.is_active() then return 'Winbar' else return 'WinbarNC' end end, fallthrough = false, { condition = function () return conditions.buffer_matches { buftype = { 'terminal' } } end, file_type, space, terminal_name, }, file_name_block, } local tabline_buffer_number = { provider = function ( self ) return '(' .. tostring( self.bufnr ) .. ')' end, hl = function ( self ) if self.is_active then return { fg = utils.get_highlight 'TabLineSel'.fg } elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then return { fg = 'ui_normal' } else return { fg = utils.get_highlight 'TabLine'.fg } end end, } local tabline_file_name = { provider = function ( self ) local name = self.file_name return name == '' and NEW_FILE or vim.fs.normalize( vim.fn.fnamemodify( name, ':t' ) ) end, hl = function ( self ) return { bold = self.is_active or self.is_visible, italic = true } end, } local tabline_file_flags = { { condition = function ( self ) return vim.api.nvim_get_option_value( 'modified', { buf = self.bufnr } ) end, provider = icon.modified .. ' ', }, { condition = function ( self ) return not vim.api.nvim_get_option_value( 'modifiable', { buf = self.bufnr } ) or vim.api.nvim_get_option_value( 'readonly', { buf = self.bufnr } ) end, provider = function ( self ) if vim.api.nvim_get_option_value( 'buftype', { buf = self.bufnr } ) == 'terminal' then return icon.terminal else return icon.lock end end, }, hl = 'Bold', } local tabline_file_name_block = { init = function ( self ) self.file_name = vim.api.nvim_buf_get_name( self.bufnr ) end, hl = function ( self ) if self.is_active then return 'TabLineSel' elseif not vim.api.nvim_buf_is_loaded( self.bufnr ) then return { fg = 'ui_normal' } else return 'TabLine' end end, on_click = { callback = function ( _, minwid, _, button ) if button == 'm' then --m = middle click vim.schedule( function () vim.api.nvim_buf_delete( minwid, { force = false } ) vim.cmd.redrawtabline() end ) else vim.api.nvim_win_set_buf( 0, minwid ) end end, minwid = function ( self ) return self.bufnr end, name = 'heirline_tabline_buffer_callback', }, file_icon, { provider = ' ' }, tabline_file_name, tabline_buffer_number, tabline_file_flags, } local tabline_buffer_block = utils.surround( { ' ' .. icon.slant_left, icon.slant_right .. ' ', }, function ( self ) if self.is_active then return utils.get_highlight 'TabLineSel'.bg else return utils.get_highlight 'TabLine'.bg end end, { tabline_file_name_block } ) local buffer_line = utils.make_buflist( tabline_buffer_block, { provider = icon.arrow_left .. ' ', hl = 'TabLineFill' }, { provider = ' ' .. icon.arrow_right, hl = 'TabLineFill' } ) local tabpage = { provider = function ( self ) return '%' .. self.tabnr .. 'T ' .. self.tabpage .. ' %T' end, hl = function ( self ) if not self.is_active then return 'TabLine' else return 'TabLineSel' end end, } local tab_pages = { { provider = '%=' }, utils.make_tablist( tabpage ), } local tabline = { buffer_line, tab_pages } -- local statuscolumn = {} heirline.setup { statusline = statuslines, winbar = winbars, tabline = tabline, -- statuscolumn = statuscolumn, opts = { colors = nugu, disable_winbar_cb = function ( args ) return conditions.buffer_matches( { buftype = ignored.buftypes, filetype = ignored.filetypes, }, args.buf ) end, }, } end, }, { 'rebelot/heirline.nvim', event = 'BufEnter', dependencies = { 'nvim-tree/nvim-web-devicons', 'lewis6991/gitsigns.nvim', }, config = function () local heirline = require 'heirline' local conditions = require 'heirline.conditions' local utils = require 'heirline.utils' local nugu = require 'bugabinga.nugu.palette' heirline.load_colors( nugu ) auto 'ReloadHeirlineColors' { description = 'Reload dark/light nugu colors for Heirline', events = 'ColorScheme', command = function () utils.on_colorscheme( nugu ) end, } local vi_mode = { init = function ( self ) self.mode = vim.fn.mode( 1 ) -- :h mode() end, static = { mode_names = { n = icon.normal, no = icon.normal .. '?', nov = icon.normal .. '?', noV = icon.normal .. '?', ['no\22'] = icon.normal .. '?', niI = icon.normal .. 'i', niR = icon.normal .. 'r', niV = icon.normal .. 'v', nt = icon.normal .. 't', v = icon.visual, vs = icon.visual .. 's', V = icon.visual .. '_', Vs = icon.visual .. 's', ['\22'] = '^' .. icon.visual, ['\22s'] = '^' .. icon.visual, s = icon.select, S = icon.select .. '_', ['\19'] = '^' .. icon.select, i = icon.insert, ic = icon.insert .. 'c', ix = icon.insert .. 'x', R = icon.replace, Rc = icon.replace .. 'c', Rx = icon.replace .. 'x', Rv = icon.replace .. 'v', Rvc = icon.replace .. 'v', Rvx = icon.replace .. 'v', c = icon.command, cv = icon.command .. 'x', r = icon.pending, rm = icon.pending .. 'm', ['r?'] = icon.pending .. '?', ['!'] = icon.exclaim, t = icon.terminal, }, mode_colors = { n = 'ui_normal', i = 'ui_accent', v = 'ui_important_global', V = 'ui_important_global', ['\22'] = 'ui_important_global', c = 'ui_important_global', s = 'ui_important_global', S = 'ui_important_global', ['\19'] = 'ui_important_global', R = 'ui_important_global', r = 'ui_important_global', ['!'] = 'ui_important_global', t = 'ui_important_global', } }, provider = function ( self ) local mode_name = self.mode_names[self.mode] return ' ' .. icon.vim .. ' %3(' .. mode_name .. '%) ' end, hl = function ( self ) local mode = self.mode:sub( 1, 1 ) -- get only the first mode character return { fg = self.mode_colors[mode], bold = true } end, update = { 'ModeChanged', pattern = '*:*', callback = vim.schedule_wrap( function () vim.cmd.redrawstatus() end ), }, } local file_icon = { init = function ( self ) local filename = self.filename local extension = vim.fn.fnamemodify( filename, ':e' ) self.icon = require 'nvim-web-devicons'.get_icon_color( filename, extension, { default = true } ) end, provider = function ( self ) return self.icon and (self.icon .. ' ') end, hl = 'DefaultIcon', } local file_name = { init = function ( self ) self.lfilename = vim.fs.normalize( vim.fn.fnamemodify( self.filename, ':.' ) ) if self.lfilename == '' then self.lfilename = '~new~' end end, flexible = 2, { provider = function ( self ) return self.lfilename end, }, { provider = function ( self ) return vim.fs.normalize( vim.fn.pathshorten( self.lfilename ) ) end, }, } local file_flags = { { condition = function () return vim.bo.modified end, provider = string.format( ' %s ', icon.modified ), hl = 'Comment', }, { condition = function () return not vim.bo.modifiable or vim.bo.readonly end, provider = string.format( ' %s ', icon.lock ), hl = 'ErrorMsg', }, } local file_name_block = { init = function ( self ) self.filename = vim.fs.normalize( vim.api.nvim_buf_get_name( 0 ) ) end, file_name, file_flags, { provider = ' ' }, file_icon, { provider = '%<' } -- this means that the statusline is cut here when there's not enough space } local file_type = { provider = function () return icon.file .. ' ' .. string.upper( vim.bo.filetype ) end, } local file_encoding = { provider = function () local enc = (vim.bo.fenc ~= '' and vim.bo.fenc) or vim.o.enc -- :h 'enc' return enc ~= 'utf-8' and enc:upper() end, } local file_format = { static = { dos = icon.newline .. icon.carriage_return, unix = icon.newline, mac = icon.carriage_return, }, provider = function ( self ) local fileformat = vim.bo.fileformat return self[fileformat] end } local file_size = { provider = function () -- stackoverflow, compute human readable file size -- i want to see vim opening a 1EiB file local suffix = { 'b', 'k', 'M', 'G', 'T', 'P', 'E' } local fsize = vim.fn.getfsize( vim.api.nvim_buf_get_name( 0 ) ) fsize = (fsize < 0 and 0) or fsize if fsize < 1024 then return fsize .. suffix[1] end local i = math.floor( (math.log( fsize ) / math.log( 1024 )) ) return string.format( '%.2g%s', fsize / math.pow( 1024, i ), suffix[i + 1] ) end, } local file_last_modified = { provider = function () local ftime = vim.fn.getftime( vim.api.nvim_buf_get_name( 0 ) ) if ftime > 0 then local timeago = require 'std.timeago' return timeago.format( ftime ) end end, } local lsp_active = { condition = conditions.lsp_attached, update = { 'LspAttach', 'LspDetach', 'BufEnter' }, provider = function () local names = {} for _, client in pairs( vim.lsp.get_clients { bufnr = 0 } ) do table.insert( names, client.name ) end return icon.lsp .. ' ' .. table.concat( names, ' ' ) end, } local diagnostic_enabled = { init = function ( self ) self.icon = vim.diagnostic.is_disabled() and icon.toggle_off or icon.toggle_on end, provider = function ( self ) return icon.diagnostic .. ' ' .. self.icon end, } local diagnostic = { condition = conditions.has_diagnostics, static = { error_icon = icon.error, warn_icon = icon.warn, info_icon = icon.info, hint_icon = icon.hint, }, init = function ( self ) self.errors = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.ERROR } ) self.warnings = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.WARN } ) self.hints = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.HINT } ) self.info = #vim.diagnostic.get( 0, { severity = vim.diagnostic.severity.INFO } ) end, update = { 'DiagnosticChanged', 'BufEnter' }, { provider = function ( self ) -- 0 is just another output, we can decide to print it or not! return self.errors > 0 and (self.error_icon .. ' ' .. self.errors .. ' ') end, hl = 'DiagnosticError', }, { provider = function ( self ) return self.warnings > 0 and (self.warn_icon .. ' ' .. self.warnings .. ' ') end, hl = 'DiagnosticWarn', }, { provider = function ( self ) return self.info > 0 and (self.info_icon .. ' ' .. self.info .. ' ') end, hl = 'DiagnosticInfo', }, { provider = function ( self ) return self.hints > 0 and (self.hint_icon .. ' ' .. self.hints) end, hl = 'DiagnosticHint', }, } local is_svn_repo = function () local svn_dir = vim.fs.find( '.svn', { upward = true, stop = vim.uv.os_homedir(), path = vim.fs.dirname( vim.api.nvim_buf_get_name( 0 ) ), type = 'directory', } ) return not vim.tbl_isempty( svn_dir ) end local svn_get_relative_url = function () local job = require 'plenary.job' local relative_url = '[unversioned]' job:new { command = 'svn', args = { 'info', '--show-item', 'relative-url', '--no-newline' }, on_exit = function ( current_job, exit_code ) if exit_code == 0 then relative_url = current_job:result() end end, }:sync() return type(relative_url) == 'table' and relative_url[1] or relative_url end local svn = { condition = is_svn_repo, update = 'BufEnter', init = function ( self ) self.relative_url = svn_get_relative_url() end, { provider = function ( self ) return icon.subversion .. ' ' .. icon.branch .. ' ' .. self.relative_url end, }, } local git = { condition = conditions.is_git_repo, init = function ( self ) self.status_dict = vim.b.gitsigns_status_dict end, { provider = function ( self ) return icon.git .. ' ' .. icon.branch .. ' ' .. self.status_dict.head .. ' ' end, }, { provider = function ( self ) local count = self.status_dict.added or 0 return count > 0 and (icon.diff_add .. ' ' .. count .. ' ') end, hl = 'DiffAdd', }, { provider = function ( self ) local count = self.status_dict.removed or 0 return count > 0 and (icon.diff_remove .. ' ' .. count .. ' ') end, hl = 'DiffDelete', }, { provider = function ( self ) local count = self.status_dict.changed or 0 return count > 0 and (icon.diff_change .. ' ' .. count .. ' ') end, hl = 'DiffChange', }, } local work_dir = { init = function ( self ) self.icon = (vim.fn.haslocaldir( 0 ) == 1 and icon['local'] or '') .. ' ' .. icon.global .. ' ' self.cwd = vim.fs.normalize( vim.uv.cwd() ):gsub( vim.fs.normalize( vim.uv.os_homedir() ), '~' ) end, flexible = 1, { -- evaluates to the full-length path provider = function ( self ) return self.icon .. self.cwd end, }, { -- evaluates to the shortened path provider = function ( self ) local cwd = vim.fn.pathshorten( self.cwd ) return self.icon .. cwd end, }, { -- evaluates to "", hiding the component provider = '', } } local help_file_name = { condition = function () return vim.bo.filetype == 'help' end, provider = function () local filename = vim.api.nvim_buf_get_name( 0 ) return vim.fn.fnamemodify( filename, ':t' ) end, hl = 'Question', } local terminal_name = { -- we could add a condition to check that buftype == 'terminal' -- or we could do that later (see #conditional-statuslines below) provider = function () local tname, _ = vim.api.nvim_buf_get_name( 0 ):gsub( '.*:', '' ) tname = vim.fs.basename( tname ) return icon.terminal .. ' ' .. tname end, hl = 'Bold', } local togglers = { provider = function () local togglers = require 'bugabinga.options.togglers' return tostring( togglers ) end, } local macro_recording = { condition = function () return vim.fn.reg_recording() ~= '' and vim.o.cmdheight == 0 end, provider = icon.macro .. ' ', hl = 'PreProc', utils.surround( { '░▒▓ ', ' ▓▒░' }, nil, { provider = function () return vim.fn.reg_recording() end, hl = 'Bold', } ), update = { 'RecordingEnter', 'RecordingLeave', } } local lazy = { condition = function () local ok, lazy_status = pcall( require, 'lazy.status' ) return ok and lazy_status.has_updates() end, update = { 'User', pattern = 'LazyUpdate' }, provider = function () return ' ' .. icon.lazy .. ' ' .. require 'lazy.status'.updates() .. ' ' end, on_click = { callback = function () require 'lazy'.update() end, name = 'update_plugins', }, hl = 'LazyProgressTodo', } local align = { provider = '%=' } local space = { provider = ' ' } local default_statusline = { vi_mode, macro_recording, align, work_dir, space, git, svn, align, diagnostic_enabled, space, diagnostic, space, lsp_active, align, togglers, align, lazy, space, file_encoding, space, file_format, space, file_type, space, file_size, space, file_last_modified, } local special_statusline = { condition = function () return conditions.buffer_matches { buftype = { 'nofile', 'prompt', 'help', 'quickfix', 'noice', 'Trouble' }, filetype = { '^git.*', 'fugitive' }, } end, file_type, space, help_file_name, align } local terminal_statusline = { condition = function () return conditions.buffer_matches { buftype = { 'terminal' } } end, { condition = conditions.is_active, vi_mode, space }, file_type, space, terminal_name, align, } local inactive_statusline = { condition = conditions.is_not_active, file_type, space, file_name, align, } local statuslines = { hl = function () if conditions.is_active() then return 'StatusLine' else return 'StatusLineNC' end end, fallthrough = false, special_statusline, terminal_statusline, inactive_statusline, default_statusline, } local winbars = { hl = function () if conditions.is_active() then return 'Winbar' else return 'WinbarNC' end end, fallthrough = false, { condition = function () return conditions.buffer_matches { buftype = { 'terminal' } } end, file_type, space, terminal_name, }, file_name_block, } local tabpage = { provider = function ( self ) return '%' .. self.tabnr .. 'T ' .. self.tabpage .. ' %T' end, hl = function ( self ) if not self.is_active then return 'TabLine' else return 'TabLineSel' end end, } local tab_pages = { -- only show this component if there's 2 or more tabpages condition = function () return #vim.api.nvim_list_tabpages() >= 2 end, { provider = '%=' }, utils.make_tablist( tabpage ), } local tabline = { tab_pages } -- local statuscolumn = {} heirline.setup { statusline = statuslines, winbar = winbars, tabline = tabline, -- statuscolumn = statuscolumn, opts = { colors = nugu, disable_winbar_cb = function ( args ) return conditions.buffer_matches( { buftype = { 'nofile', 'prompt', 'help', 'quickfix' }, filetype = { '^git.*', 'noice', 'Trouble' }, }, args.buf ) end, }, } end, },+66 / −3 text lines
'RRethy/nvim-treesitter-endwise', -- nvim-treesitter assumes that windows users use either cmd or powershell. -- my win32 + nushell combination does not work well. -- override some internal functions of nvim-treesitter for nushell support. local shell = require 'nvim-treesitter.shell_command_selectors' shell.make_directory_change_for_command = function ( dir, command ) return string.format( 'cd %s; %s', dir, command ) end shell.select_mv_cmd = function ( from, to, cwd ) return { cmd = 'mv', opts = { args = { '--force', from, to }, cwd = cwd, } } end shell.select_install_rm_cmd = function ( cache_folder, project_name ) local project = vim.fs.joinpath( cache_folder, project_name ) return { cmd = 'rm', opts = { args = { '--recursive', '--force', '--permanent', project, } }, err = 'Could not delete project ' .. project, } end shell.select_rm_file_cmd = function ( file, info_msg ) return { cmd = 'rm', opts = { args = { '--force', '--permanent', file } }, info = info_msg, err = 'Could not delete file ' .. file, } end shell.select_mkdir_cmd = function ( directory, cwd, info_msg ) return { cmd = 'mkdir', opts = { args = { directory }, cwd = cwd, }, info = info_msg, err = 'Could not create directory ' .. directory, } end install.compilers = { 'zig', 'clang', 'gcc', 'cl', 'cc', vim.fn.getenv 'CC' } install.compilers = { 'zig' } 'xml', autotag = { enable = true },+1 / −1 text lines