Closed ghost closed 8 months ago
Heyyo @AXVIII3, Have you tried wrapping it inside a function?
Something like:
-- ...
right = {
"right_sep", "- ", function() return vim.bo.ft:upper() end, "- ", "left_sep", " ",
"right_sep", "-line_column", "left_sep", " ",
}
-- ...
@tamton-aquib Hey! I hadn't though of that.... Sorry I probably should have experimented more before filing this issue... Also how you I invert the colour of this text?
the -
inside the function isnt implemented. But we could return a table like {"HighlighName", "string"}
.
In this case, we could do something like:
--- Since "StalineFill" is the highlight for filling bg
function() return { "StalineFill", vim.bo.filetype:upper() } end
@tamton-aquib Heyy... that worked great... thanks for your help.... and this was quick too! Great plugin btw! I found you via the reddit post you made years ago... Still find it amazing that you made this when you were only 12days (if I'm not wrong) into vim
Also one last question I'd like to bother you with.. sometimes the plugin reverts to the base nvim status line when using Netrw... while sometimes it doesnt.. See video... Also I noticed that you had seperate configs for nvimtree, dashboard and packer... so is it possible to create different configs for different buffertypes?
I found you via the reddit post you made years ago.
That might not be me 😅 . This plugin was made maybe 4 years ago.
sometimes the plugin reverts to the base nvim status line when using Netrw
That is strange. I dont use netrw much since i'm still on nvim-tree, but I'll check.
is it possible to create different configs for different buffertypes
Buffer specific lines can be configured via special_table
opt in setup.
For example:
require("staline").setup({
special_table = {
-- Where "netrw" key is the filetype.
netrw = { 'NetRW', ' ' },
},
}
That might not be me 😅 . This plugin was made maybe 4 years ago.
Oops... Sorry.. I used to use Lualine which was tremendously slow... So I have been researching many status lines today... so I mixed up some... this is a very good plugin nonetheless... love the customizability it provides
Buffer specific lines can be configured via
special_table
opt in setup.
So these special tables are similar to the sections table but for specific file types?
So these special tables are similar to the sections table but for specific file types?
Hmm nope, its just a table with 2 values. The text and the icon for the specific filetype key. (I designed this 3-4 years ago so it isnt that good 😅 )
Hmm nope, its just a table with 2 values. The text and the icon for the specific filetype key. (I designed this 3-4 years ago so it isnt that good 😅 )
Yeah I figured that one out pretty soon..... And absolutely not... this is an amazing plugins... better than anything I (or most) could write
Also one final thing.. I swear I'll stop bothering you after this This isnt important and is a rare weird edge case... but with pages like help and netrw... the status lines exhibit some weird behaviours which do not really need to be fixed...
Sometimes they duplicate for all buffers
And somethimes does this
Heyyo @AXVIII3,
I think that behaviour is because of me not taking into account the laststatus
option. I started assuming everyone moved to laststatus=3
(aka global statusline).
I'll check it this/next week.
@tamton-aquib Alright! Thanks a lot for your help
I think that behaviour is because of me not taking into account the
laststatus
option. I started assuming everyone moved tolaststatus=3
(aka global statusline).
I see... I actually like the concept of laststatus = 3.... I'm switching to that
I'll check it this/next week.
Sure sure.. no worries... take your time 👍🏻
Cheers :)
So hey @AXVIII3,
Im closing this issue for now. Feel free to re-open if there are any more issues 👍🏻
@tamton-aquib Yeah sure... dont have any breaking problems.... any luck with NetRw though?
Ah yes sorry, I did fix it but forgot to push.
I have pushed a fix, can you check? @AXVIII3 (No hurry btw)
It works great with NetRw now! No need to be sorry... I'm the one who dragged you into fixing a niche issue 😅
Also I was contemplating even mentioning this issue as its very minor. But the status line doesnt appear immediately after vim is opened... it appears after a file is opened.... it also seems to appear on some buffer functions such as while changing folders or opening NetRw but the colors dont work in those cases...
I am mentioning just the sake of it existing... not an issue per se
Thanks a ton though!! :)
@tamton-aquib I had some free time, so I decided to look into the code for a bit In staline.nvim you have this function to "create" the status line
M.get_statusline = function(status)
if conf.special_table[vim.bo.ft] ~= nil then
local special = conf.special_table[vim.bo.ft]
return "%#Staline#%=" .. special[2] .. special[1] .. "%="
end
M.sections = {}
local mode = vim.api.nvim_get_mode()['mode']
local fgColor = status and conf.mode_colors[mode] or t.inactive_color
local bgColor = status and t.bg or t.inactive_bgcolor
local modeIcon = conf.mode_icons[mode] or " "
local f_name = t.full_path and '%F' or '%t'
-- TODO: original color of icon
local f_icon = util.get_file_icon(vim.fn.expand('%:t'), vim.fn.expand('%:e'))
local edited = vim.bo.mod and t.mod_symbol or ""
-- TODO: need to support b, or mb?
local size = ("%.1f"):format(vim.fn.getfsize(vim.api.nvim_buf_get_name(0))/1024)
call_highlights(fgColor, bgColor)
.
.
.
.
.
end
The if statement in the first few lines blocks the execution of the call_highlights()
function which comes later if the buffer is something like the dashboard or netrw. So I pushed that function above the if statement. This seemed to fix my issue. But I am not sure if any other issues would be created. What do you think about this?
M.get_statusline = function(status)
local mode = vim.api.nvim_get_mode()['mode']
local fgColor = status and conf.mode_colors[mode] or t.inactive_color
local bgColor = status and t.bg or t.inactive_bgcolor
call_highlights(fgColor, bgColor)
if conf.special_table[vim.bo.ft] ~= nil then
local special = conf.special_table[vim.bo.ft]
return "%#Staline#%=" .. special[2] .. special[1] .. "%="
end
M.sections = {}
local modeIcon = conf.mode_icons[mode] or " "
local f_name = t.full_path and '%F' or '%t'
-- TODO: original color of icon
local f_icon = util.get_file_icon(vim.fn.expand('%:t'), vim.fn.expand('%:e'))
local edited = vim.bo.mod and t.mod_symbol or ""
-- TODO: need to support b, or mb?
local size = ("%.1f"):format(vim.fn.getfsize(vim.api.nvim_buf_get_name(0))/1024)
call_highlights(fgColor, bgColor)
end
Reopened just to gain your attention 😉 WIll close soon
Hi @AXVIII3,
Could you open a new issue for this? 😅 Since the original issue and this new issue seems to be different, it would be better to track in a new issue.
Sure!
There is this string vim.bo.filetype
I want a section with this string.. So I edited the premade pebble config... however it just shows an empty string (right side)
Full config