mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 01:09:56 +08:00
fix(statusline): fix display current tag
This commit is contained in:
parent
9345f01986
commit
cb17aecf83
@ -59,6 +59,7 @@ if has('nvim-0.10.0')
|
|||||||
endtry
|
endtry
|
||||||
call SpaceVim#logger#info('finished loading local conf')
|
call SpaceVim#logger#info('finished loading local conf')
|
||||||
endif
|
endif
|
||||||
|
let g:_spacevim_after_vimenter = 1
|
||||||
endfunction
|
endfunction
|
||||||
function! SpaceVim#autocmds#init() abort
|
function! SpaceVim#autocmds#init() abort
|
||||||
lua require('spacevim.autocmds').init()
|
lua require('spacevim.autocmds').init()
|
||||||
|
@ -283,10 +283,23 @@ local function check_mode()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function current_tag()
|
local function current_tag()
|
||||||
return M._current_tag()
|
return '%{ v:lua.require("spacevim.plugin.statusline")._current_tag() }'
|
||||||
end
|
end
|
||||||
|
|
||||||
function M._current_tag() end
|
function M._current_tag()
|
||||||
|
|
||||||
|
local tag = ''
|
||||||
|
pcall(function()
|
||||||
|
-- current tag should be show only after vimenter
|
||||||
|
-- @fixme this make sure tagbar has been loaded
|
||||||
|
-- because when first run tagbar, it needs long time.
|
||||||
|
-- and also there no syntax highlight when first time open file.
|
||||||
|
if vim.g._spacevim_after_vimenter == 1 and vim.g.spacevim_enable_statusline_tag == 1 and vim.g.loaded_tagbar == 1 then
|
||||||
|
tag = vim.fn['tagbar#currenttag']('%s ', '')
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
return tag
|
||||||
|
end
|
||||||
|
|
||||||
local function active()
|
local function active()
|
||||||
local lsec = {}
|
local lsec = {}
|
||||||
@ -324,7 +337,7 @@ local function active()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local fname = buffer_name()
|
local fname = buffer_name()
|
||||||
local tab = current_tag()
|
local tag = current_tag()
|
||||||
local winwidth = vim.fn.winwidth(vim.fn.winnr())
|
local winwidth = vim.fn.winwidth(vim.fn.winnr())
|
||||||
if vim.o.laststatus == 3 then
|
if vim.o.laststatus == 3 then
|
||||||
winwidth = vim.o.columns
|
winwidth = vim.o.columns
|
||||||
@ -335,7 +348,7 @@ local function active()
|
|||||||
lsep,
|
lsep,
|
||||||
rsep,
|
rsep,
|
||||||
fname,
|
fname,
|
||||||
tab,
|
tag,
|
||||||
'SpaceVim_statusline_a',
|
'SpaceVim_statusline_a',
|
||||||
'SpaceVim_statusline_b',
|
'SpaceVim_statusline_b',
|
||||||
'SpaceVim_statusline_c',
|
'SpaceVim_statusline_c',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user