Closed cpkio closed 3 years ago
I dont yet understand how to do it in Lua
You don't need to just use '%B'.
https://github.com/shadmansaleh/lualine.nvim#vims-statusline-items-as-lualine-component
Note of this sections = {lualine_c = {'%=', '%t%m', '%3p'}}
or this sections = {lualine_c = {"os.data('%a')", 'data'}}
output anything on on my system.
Did you install shadmansaleh/lualine.nvim ?
Yes, I've even modified the default settings after playing for a while. Found out you made a typo, Lua is os.date('%a')
, not os.data
. But sections = {lualine_c = {'%=', '%t%m', '%3p'}}
settings dont work for some reason.
What's your entire lualine config ?
require('lualine').setup({ sections = {
lualine_a = { {'mode', lower = false} },
lualine_b = { 'branch' },
lualine_c = { vim.fn.getcwd, {'filename', color = "PmenuSelBold"} },
},
})
getcwd expects different arguments then what's given to lualines function components.
Lualines function conponents get somthing like
function(self, is_active)
so when lualine calls getcwd with those it errors out . You should wrap it witha function to ignore the args or pass it as a function name
lualine_c = {function() return vim.fn.getcwd() end}
or
lualine_c = {'getcwd'}
Try:
require('lualine').setup({ sections = {
lualine_a = { {'mode', lower = false} },
lualine_b = { 'branch' },
lualine_c = { 'getcwd', {'filename', color = "PmenuSelBold"}, '%B' },
},
})
'%B'
is not shown anyway.
Is your cursor on a char ? It's working for me.
Of course it is 🤷♂️
Of course it is 🤷♂️
I just can't think of any reason for that not to work as I just ran that config and it worked :P
Can you give a screenshot ?
What does this command say ?
:lua print(vim.inspect(require'lualine'.get_config()))
Error executing lua [string ":lua"]:1: attempt to call field 'get_config' (a nil value)
. There's no such function?
You have hoob3rt/lualine.nvim
installed not shadmansaleh/lualine.nvim
. Those features aren't available in this repo . You'll have to use my fork .
Your fork didn't load, so I had to revert to original:
Error detected while processing C:\NvimLua\nvim\init.lua: E5113: Error while calling lua chunk: ...ata\site\pack\user\start\lualine.nvim\lua\lualine.lua:256: attempt to index field 'config_module' (a number value)
Use this and try to reproduce the crash without any other plugins influence. And provide the minimal example with which you can reproduce the problem.
I'm on Windows so I cannot use bash script. I've created an isolated installation by creating separate nvim
and nvim-data...
directories and setting the XDG_*
variables. Strangely enough, now your plugin works (it still cannot do stuff like 0x%B
for 0x2014
for example, but anyway…). And I only had a few plugins installed to get this problem. Will try finding out what plugin is intervening with yours.
Do you have you lualine configuration file named lualine_config.lua
?
Yes. Renaming it didn't help.
What did you rename it to ?
Sorry, renamed the wrong one. Now its working. Thanks for your efforts! 👍
Can you add current character under cursor hex as a component (like
0x2014
)? I would gladly write this myself but I dont yet understand how to do it in Lua.