Try to override statusline modules
This commit is contained in:
parent
6fa41890ab
commit
822b092d15
@ -35,18 +35,6 @@ M.ui = {
|
|||||||
-- default/round/block/arrow separators work only for default statusline theme
|
-- default/round/block/arrow separators work only for default statusline theme
|
||||||
-- round and block will work for minimal theme only
|
-- round and block will work for minimal theme only
|
||||||
separator_style = "default",
|
separator_style = "default",
|
||||||
overriden_modules = function(modules)
|
|
||||||
modules[1] = (function()
|
|
||||||
local noice = require("noice")
|
|
||||||
if noice.api.statusline.mode.has() then
|
|
||||||
return "%#St_CommandMode#" .. noice.api.statusline.mode.get() .. modules[1]
|
|
||||||
end
|
|
||||||
return modules[1]
|
|
||||||
end)()
|
|
||||||
end,
|
|
||||||
fileInfo = function()
|
|
||||||
return require("nvchad_ui.statusline.default.fileInfo").run()
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- lazyload it when there are 1+ buffers
|
-- lazyload it when there are 1+ buffers
|
||||||
|
|||||||
@ -61,7 +61,7 @@ for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- add binaries installed by mason.nvim to path
|
-- add binaries installed by mason.nvim to path
|
||||||
local is_windows = vim.fn.has("win32") ~= 0
|
local is_windows = vim.fn.has "win32" ~= 0
|
||||||
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
||||||
|
|
||||||
-------------------------------------- autocmds ------------------------------------------
|
-------------------------------------- autocmds ------------------------------------------
|
||||||
|
|||||||
@ -59,6 +59,14 @@ M.general = {
|
|||||||
-- ["<leader>y"] = {"<cmd> :w! /tmp/vimtmp<CR>", "Save into a global tmp file"},
|
-- ["<leader>y"] = {"<cmd> :w! /tmp/vimtmp<CR>", "Save into a global tmp file"},
|
||||||
-- ["<leader>p"] = {"<cmd> :r! cat /tmp/vimtmp<CR>", "Restore from the global tmp file"},
|
-- ["<leader>p"] = {"<cmd> :r! cat /tmp/vimtmp<CR>", "Restore from the global tmp file"},
|
||||||
|
|
||||||
|
-- (Double) Trouble
|
||||||
|
["<leader>tx"] = { ":Trouble diagnostics toggle<CR>", "[T]rouble diagnostics" },
|
||||||
|
["<leader>tX"] = { ":Trouble diagnostics toggle filter.buf=0<CR>", "[T]rouble buffer diagnostics" },
|
||||||
|
["<leader>ts"] = { ":Trouble symbols toggle focus=false<CR>", "[T]rouble [S]ymbols" },
|
||||||
|
["<leader>tl"] = { ":Trouble lsp toggle focus=false win.position=right<CR>", "[T]rouble [L]sp def / ref / ..." },
|
||||||
|
["<leader>tL"] = { ":Trouble loclist toggle<CR>", "[T]rouble [L]oclist" },
|
||||||
|
["<leader>tQ"] = { ":Trouble qflist toggle<CR>", "[T]rouble [Q]uickfix" },
|
||||||
|
|
||||||
["<leader>dgg"] = { ":lua require('dap').continue() <CR>", "Continue debu[g]ging" },
|
["<leader>dgg"] = { ":lua require('dap').continue() <CR>", "Continue debu[g]ging" },
|
||||||
["<leader>dg<CR>"] = { ":lua require('dapui').toggle() <CR>", "Toggle DAP ui" },
|
["<leader>dg<CR>"] = { ":lua require('dapui').toggle() <CR>", "Toggle DAP ui" },
|
||||||
["<leader>dgw"] = { ":lua require('dapui').eval() <CR>", "Open floating windows about current [w]ord" },
|
["<leader>dgw"] = { ":lua require('dapui').eval() <CR>", "Open floating windows about current [w]ord" },
|
||||||
@ -227,12 +235,12 @@ M.tabufline = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- close buffer + hide terminal buffer
|
-- close buffer + hide terminal buffer
|
||||||
["<leader>x"] = {
|
-- ["<leader>x"] = {
|
||||||
function()
|
-- function()
|
||||||
require("nvchad.tabufline").close_buffer()
|
-- require("nvchad.tabufline").close_buffer()
|
||||||
end,
|
-- end,
|
||||||
"Close buffer",
|
-- "Close buffer",
|
||||||
},
|
-- },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,8 +531,7 @@ M.telescope = {
|
|||||||
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
|
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
|
||||||
|
|
||||||
-- theme switcher
|
-- theme switcher
|
||||||
["<leader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
|
-- ["<leader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
|
||||||
|
|
||||||
["<leader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
|
["<leader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
|
||||||
|
|
||||||
-- History
|
-- History
|
||||||
@ -709,7 +716,7 @@ M.gitsigns = {
|
|||||||
"Blame line",
|
"Blame line",
|
||||||
},
|
},
|
||||||
|
|
||||||
["<leader>td"] = {
|
["<leader>bd"] = {
|
||||||
function()
|
function()
|
||||||
require("gitsigns").toggle_deleted()
|
require("gitsigns").toggle_deleted()
|
||||||
end,
|
end,
|
||||||
|
|||||||
@ -13,6 +13,9 @@ M.load_config = function()
|
|||||||
config.mappings.disabled = nil
|
config.mappings.disabled = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- print(vim.inspect(config))
|
||||||
|
-- print(config)
|
||||||
|
-- print(vim.inspect(config.ui.statusline))
|
||||||
return config
|
return config
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,46 @@ local highlights = require "custom.highlights"
|
|||||||
|
|
||||||
M.ui = {
|
M.ui = {
|
||||||
theme = "onedark",
|
theme = "onedark",
|
||||||
theme_toggle = { "onedark", "monekai" },
|
theme_toggle = { "onedark", "onedark" },
|
||||||
|
|
||||||
hl_override = highlights.override,
|
hl_override = highlights.override,
|
||||||
hl_add = highlights.add,
|
hl_add = highlights.add,
|
||||||
|
|
||||||
|
statusline = {
|
||||||
|
order = {
|
||||||
|
"macro",
|
||||||
|
"mode",
|
||||||
|
"relativepath",
|
||||||
|
"file",
|
||||||
|
"git",
|
||||||
|
"%=",
|
||||||
|
"lsp_msg",
|
||||||
|
"%=",
|
||||||
|
"diagnostics",
|
||||||
|
"lsp",
|
||||||
|
"cwd",
|
||||||
|
"cursor",
|
||||||
|
},
|
||||||
|
modules = {
|
||||||
|
macro = function()
|
||||||
|
local noice = require "noice"
|
||||||
|
if noice.api.statusline.mode.has() then
|
||||||
|
return "%#St_CommandMode#" .. noice.api.statusline.mode.get()
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end,
|
||||||
|
relativepath = function()
|
||||||
|
local stbufnr = vim.api.nvim_win_get_buf(vim.g.statusline_winid or 0)
|
||||||
|
local path = vim.api.nvim_buf_get_name(stbufnr)
|
||||||
|
|
||||||
|
if path == "" then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
return "%#St_relativepath# " .. vim.fn.expand "%:.:h" .. " /"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M.plugins = "custom.plugins"
|
M.plugins = "custom.plugins"
|
||||||
|
|||||||
@ -42,10 +42,17 @@ M.capabilities.textDocument.completion.completionItem = {
|
|||||||
|
|
||||||
M.capabilities.textDocument.publishDiagnostics.tagSupport.valueSet = { 2 }
|
M.capabilities.textDocument.publishDiagnostics.tagSupport.valueSet = { 2 }
|
||||||
|
|
||||||
|
-- LSP settings (for overriding per client)
|
||||||
|
M.handlers = {
|
||||||
|
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }),
|
||||||
|
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }),
|
||||||
|
}
|
||||||
|
|
||||||
require("lspconfig").lua_ls.setup {
|
require("lspconfig").lua_ls.setup {
|
||||||
on_init = M.on_init,
|
on_init = M.on_init,
|
||||||
on_attach = M.on_attach,
|
on_attach = M.on_attach,
|
||||||
capabilities = M.capabilities,
|
capabilities = M.capabilities,
|
||||||
|
handlers = M.handlers,
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
@ -73,6 +80,7 @@ require("lspconfig").pyright.setup {
|
|||||||
on_init = M.on_init,
|
on_init = M.on_init,
|
||||||
on_attach = M.on_attach,
|
on_attach = M.on_attach,
|
||||||
capabilities = M.capabilities,
|
capabilities = M.capabilities,
|
||||||
|
handlers = M.handlers,
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
pyright = {
|
pyright = {
|
||||||
@ -86,6 +94,7 @@ require("lspconfig").pyright.setup {
|
|||||||
-- typeCheckingMode = "off", -- Using mypy
|
-- typeCheckingMode = "off", -- Using mypy
|
||||||
diagnosticSeverityOverrides = {
|
diagnosticSeverityOverrides = {
|
||||||
reportMissingImports = false,
|
reportMissingImports = false,
|
||||||
|
reportAttributeAccessIssue = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -136,7 +136,7 @@ local default_plugins = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
format_on_save = {
|
format_on_save = {
|
||||||
timeout_ms = 500,
|
timeout_ms = 1000,
|
||||||
lsp_format = "fallback",
|
lsp_format = "fallback",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -591,6 +591,12 @@ local default_plugins = {
|
|||||||
-- refer to the configuration section below
|
-- refer to the configuration section below
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
lazy = false,
|
||||||
|
cmd = "Trouble",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local config = require("core.utils").load_config()
|
local config = require("core.utils").load_config()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user