Closed viking66 closed 2 years ago
https://nvchad.com/config/nvchad_ui override statusline modules
Here is my solution:
EDIT: I am not LUA expert so my code might be bit clunky or inaccurate, but hey it works and does what I need :)
@dhruvinsh no need to be a lua expert for this xD, you're the same as me
Hey I am sorry, but I wanted to add this but your code doesn't seem to be working. My custom directory look like this :
├── custom
│ ├── chadrc.lua
│ ├── configs
│ │ ├── lint.lua
│ │ └── lspconfig.lua
│ └── overrides.lua
│ └── plugins.lua
with overrides.lua
being the exact file provided and plugins.lua
is :
local plugins = {
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"pyright",
"black",
"ruff",
},
},
},
{
"neovim/nvim-lspconfig",
config = function ()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end,
},
{
"mfussenegger/nvim-lint",
lazy=false,
config = function ()
require "custom.configs.lint"
end
},
{
"mhartington/formatter.nvim",
lazy=false,
config = function ()
require "custom.configs.format"
end
},
{
"NvChad/ui",
override_options = require("custom.overrides").statusline
}
}
return plugins
Do you have any idea why this doesn't work ?
Also @siduck your link is broken, do you have a new version for it ?
@tanguymagne https://nvchad.com/docs/config/nvchad_ui
Hey thanks for your answer, I manage to make what I wanted with the following code in chadrc.lua
:
---@type ChadrcConfig
local M = {}
M.ui = {
theme = 'catppuccin',
statusline = {
-- modules arg here is the default table of modules
overriden_modules = function(modules)
table.insert(
modules,
11,
(function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return "l" .. line .. ":c" .. (col + 1)
end)()
)
end,
},
}
return M
@tanguymagne :D
table.insert(modules, " Ln %l, Col %c") -- or
-- modules[11] = " Ln %l, Col %c"
https://nvchad.com/config/nvchad_ui override statusline modules
Link shows 404.
This is my chadrc.lua
---@type ChadrcConfig
local M = {}
M.base46 = {
theme = "onenord",
}
M.ui = {
statusline = {
-- modules arg here is the default table of modules
overriden_modules = function(modules)
table.insert(modules, " Ln %l, Col %c")
end,
},
}
return M
But I do not see the cursor position in status line.
I can not find any references for "overriden_modules".
How can I add cursor position in default theme in the newest NvChad?
Is there a way to configure NvChad's status line to include the current line number and column next to the file location percentage? If not, is that a feature that can be added?