[2025-04-25] Updates to nvim config, mainly statusline stuff
This commit is contained in:
parent
628475c242
commit
f8c9b525ca
6 changed files with 91 additions and 28 deletions
|
@ -6,4 +6,20 @@ highlight SpellBad guibg=Normal guifg=Normal gui=undercurl guisp=red
|
||||||
highlight SpellCap guibg=Normal guifg=Normal gui=undercurl guisp=blue
|
highlight SpellCap guibg=Normal guifg=Normal gui=undercurl guisp=blue
|
||||||
highlight SpellLocal guibg=Normal guifg=Normal gui=undercurl guisp=pink
|
highlight SpellLocal guibg=Normal guifg=Normal gui=undercurl guisp=pink
|
||||||
highlight SpellRare guibg=Normal guifg=Normal gui=undercurl guisp=aqua
|
highlight SpellRare guibg=Normal guifg=Normal gui=undercurl guisp=aqua
|
||||||
highlight StatusLine gui=bold guibg=Normal guifg=Normal
|
highlight StatusLine guibg=Normal guifg=Normal gui=bold
|
||||||
|
highlight! link WinBar StatusLine
|
||||||
|
highlight! link StatusLineNC StatusLine
|
||||||
|
highlight @markup.raw.markdown_inline guifg=#928374 guibg=#2c2721
|
||||||
|
highlight @markup.raw.typst guifg=#928374 guibg=#2c2721
|
||||||
|
highlight StatusLineMode guibg=#474038 guifg=StatusLine gui=bold
|
||||||
|
highlight StatusLineFile guibg=#2b2622 guifg=StatusLine gui=bold
|
||||||
|
highlight StatusLineLSP guibg=#474038 gui=bold
|
||||||
|
highlight StatusLineDiagnosticError guibg=#474038 guifg=Red
|
||||||
|
highlight StatusLineDiagnosticWarn guibg=#474038 guifg=Orange
|
||||||
|
highlight StatusLineDiagnosticInfo guibg=#474038 guifg=LightBlue
|
||||||
|
highlight StatusLineDiagnosticHint guibg=#474038 guifg=LightGrey
|
||||||
|
highlight StatusLineGit guibg=#2b2622 gui=bold
|
||||||
|
highlight StatusLineGitAdd guibg=#2b2622 guifg=NvimLightGreen
|
||||||
|
highlight StatusLineGitChange guibg=#2b2622 guifg=NvimLightCyan
|
||||||
|
highlight StatusLineGitDelete guibg=#2b2622 guifg=NvimLightRed
|
||||||
|
highlight FoldColumn guibg=NONE
|
||||||
|
|
|
@ -20,4 +20,4 @@ highlight Comment gui=italic
|
||||||
highlight Constant guifg=#999999
|
highlight Constant guifg=#999999
|
||||||
highlight NormalFloat guibg=#666666
|
highlight NormalFloat guibg=#666666
|
||||||
highlight CursorLineNr guibg=NONE gui=bold
|
highlight CursorLineNr guibg=NONE gui=bold
|
||||||
highlight StatusLine guibg=Normal guifg=Normal
|
highlight StatusLine guibg=Normal guifg=Normal gui=bold
|
||||||
|
|
|
@ -28,11 +28,15 @@ endif
|
||||||
set termguicolors
|
set termguicolors
|
||||||
colo gruv
|
colo gruv
|
||||||
set noshowmode
|
set noshowmode
|
||||||
set laststatus=2
|
set laststatus=3
|
||||||
set cmdheight=0
|
set cmdheight=1
|
||||||
|
"set foldcolumn=1
|
||||||
|
|
||||||
set statusline=%{%v:lua.require('plugins.statusline').statusline()%}
|
set statusline+=%#StatusLineMain#%{%v:lua.require('plugins.statusline').statusline()%}%*
|
||||||
set winbar=%{%v:lua.require('plugins.statusline').winbar()%}
|
"set winbar=%{%v:lua.require('plugins.statusline').winbar()%}
|
||||||
|
|
||||||
|
au InsertEnter * hi StatusLineMode gui=bold,reverse cterm=bold,reverse
|
||||||
|
au InsertLeave * hi statuslineMode gui=bold cterm=bold
|
||||||
|
|
||||||
" .config/nvim/lua/init.lua
|
" .config/nvim/lua/init.lua
|
||||||
lua require('init')
|
lua require('init')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
--require('plugins.gruvbox')
|
--require('plugins.gruvbox')
|
||||||
--require('plugins.feline')
|
--require('plugins.feline')
|
||||||
require('gitsigns').setup({numhl = true})
|
require('gitsigns').setup({numhl = true})
|
||||||
--require('plugins.matlab_ls')
|
require('plugins.matlab_ls')
|
||||||
require('plugins.lua_ls')
|
require('plugins.lua_ls')
|
||||||
require('plugins.treesitter')
|
require('plugins.treesitter')
|
||||||
--require('battery').setup({
|
--require('battery').setup({
|
||||||
|
@ -16,13 +16,14 @@ vim.diagnostic.config({
|
||||||
underline = true,
|
underline = true,
|
||||||
signs = {
|
signs = {
|
||||||
text = {
|
text = {
|
||||||
[vim.diagnostic.severity.ERROR] = '●',
|
[vim.diagnostic.severity.ERROR] = '✖',
|
||||||
[vim.diagnostic.severity.WARN] = '●',
|
[vim.diagnostic.severity.WARN] = '⚠',
|
||||||
[vim.diagnostic.severity.INFO] = '●',
|
[vim.diagnostic.severity.INFO] = '●',
|
||||||
[vim.diagnostic.severity.HINT] = '●'
|
[vim.diagnostic.severity.HINT] = '✦'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
--vim.api.nvim_set_hl(0,"DiagnosticUnderlineWarn",{undercurl=true,sp='DiagnosticWarn'})
|
--vim.api.nvim_set_hl(0,"DiagnosticUnderlineWarn",{undercurl=true,sp='DiagnosticWarn'})
|
||||||
--For Alacritty:
|
--For Alacritty:
|
||||||
-- vim.api.nvim_create_autocmd("ExitPre", {
|
-- vim.api.nvim_create_autocmd("ExitPre", {
|
||||||
|
@ -30,3 +31,6 @@ vim.diagnostic.config({
|
||||||
-- command = "set guicursor=a:ver90-blinkwait250-blinkoff250-blinkon250",
|
-- command = "set guicursor=a:ver90-blinkwait250-blinkoff250-blinkon250",
|
||||||
-- desc = "Set cursor back to beam when leaving Neovim."
|
-- desc = "Set cursor back to beam when leaving Neovim."
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
|
-- vim.keymap.set('n','<C-l>',function() print(tostring(vim.fn.strftime('%H:%M'))) end)
|
||||||
|
vim.keymap.set('n','<C-l>',":r!date +\\%R<CR>")
|
||||||
|
|
|
@ -7,7 +7,7 @@ vim.lsp.config.matlab_ls =
|
||||||
settings = {
|
settings = {
|
||||||
MATLAB = {
|
MATLAB = {
|
||||||
indexWorkspace = false,
|
indexWorkspace = false,
|
||||||
installPath = "/usr/local/MATLAB/R2024b",
|
installPath = "/usr/local/MATLAB/R2025a",
|
||||||
matlabConnectionTiming = "onStart",
|
matlabConnectionTiming = "onStart",
|
||||||
telemetry = false
|
telemetry = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ M.modeMap = {
|
||||||
GetMode = function()
|
GetMode = function()
|
||||||
local m = vim.api.nvim_get_mode().mode
|
local m = vim.api.nvim_get_mode().mode
|
||||||
if M.modeMap[m] ~= nil then
|
if M.modeMap[m] ~= nil then
|
||||||
return M.modeMap[m] .. " "
|
return Highlight(" "..M.modeMap[m].." ","StatusLineMode")
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
@ -24,46 +24,85 @@ GetTime = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
GetLSP = function()
|
GetLSP = function()
|
||||||
local clients = vim.lsp.get_clients()
|
local clients = vim.lsp.get_clients({bufnr = 0})
|
||||||
if next(clients) ~= nil then
|
if next(clients) ~= nil then
|
||||||
local name = string.format('%s',clients[1].name)
|
local name = string.format('%s',clients[1].name)
|
||||||
local root = clients[1].root_dir
|
local root = clients[1].root_dir
|
||||||
if name == 'matlab_ls' and root ~= nil then
|
if name == 'matlab_ls' and root ~= nil then
|
||||||
local sandbox = root:match(".+/([^/]+)$")
|
local sandbox = root:match(".+/([^/]+)$")
|
||||||
--local handle = io.popen('p4 opened | grep tnrCRCDecode | sed \'s/^[^#]*//g\'')
|
return string.format(' {◉%s} [%s] ',name,sandbox)
|
||||||
--local result = handle:read("*a")
|
|
||||||
return string.format('| %s -> %s ',name,sandbox)
|
|
||||||
else
|
else
|
||||||
return "| " .. name .. " "
|
return string.format(' {◉%s} ',name)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return ''
|
return ' {◉} '
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.diagMap = {
|
||||||
|
err = vim.diagnostic.severity.ERROR,
|
||||||
|
warn = vim.diagnostic.severity.WARNING,
|
||||||
|
info = vim.diagnostic.severity.INFORMATION,
|
||||||
|
hint = vim.diagnostic.severity.HINT
|
||||||
|
}
|
||||||
|
|
||||||
|
M.diagSymMap = {
|
||||||
|
err = "✖",
|
||||||
|
warn = "⚠",
|
||||||
|
info = "●",
|
||||||
|
hint = "✦"
|
||||||
|
}
|
||||||
|
|
||||||
|
GetDiag = function(type)
|
||||||
|
return string.format("%s%d ",M.diagSymMap[type],#vim.diagnostic.get(0,{severity=M.diagMap[type]}))
|
||||||
|
end
|
||||||
|
|
||||||
GetGitStatus = function()
|
GetGitStatus = function()
|
||||||
local signs = vim.b.gitsigns_status_dict or {head = '', added = 0, changed = 0, removed = 0}
|
local signs = vim.b.gitsigns_status_dict or {head = '', added = 0, changed = 0, removed = 0}
|
||||||
local inRepo = signs.head ~= ''
|
local inRepo = signs.head ~= ''
|
||||||
|
|
||||||
return inRepo and string.format(
|
return inRepo and string.format(
|
||||||
'| %s: +%s ~%s -%s ',
|
'%s%s%s%s',
|
||||||
signs.head, signs.added, signs.changed, signs.removed
|
Highlight(" {↣"..signs.head.."}","StatusLineGit"),
|
||||||
) or ''
|
Highlight(" +"..signs.added,"StatusLineGitAdd"),
|
||||||
|
Highlight(" ~"..signs.changed,"StatusLineGitChange"),
|
||||||
|
Highlight(" -"..signs.removed.." ","StatusLineGitDelete")
|
||||||
|
) or string.format(
|
||||||
|
'%s%s%s%s',
|
||||||
|
Highlight(" {↣}","StatusLineGit"),
|
||||||
|
Highlight(" +0","StatusLineGitAdd"),
|
||||||
|
Highlight(" ~0","StatusLineGitChange"),
|
||||||
|
Highlight(" -0 ","StatusLineGitDelete")
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
Highlight = function(inp,hi)
|
||||||
|
return "%#" .. hi .. "#" .. inp .. "%*"
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.statusline()
|
function M.statusline()
|
||||||
local sline = " "
|
local sline = ""
|
||||||
sline = sline .. GetMode() .. GetGitStatus() .. GetLSP() .. "%=" .. GetDate() .. " | " .. GetTime() .. " "
|
sline = sline .. GetMode()
|
||||||
|
.. Highlight(" %<%f ","StatusLineFile") .. " %y%m%r%="
|
||||||
|
.. "%-5.(%l:%c%V%) %p%% "
|
||||||
|
.. GetGitStatus()
|
||||||
|
.. Highlight(GetLSP(),"StatusLineLSP")
|
||||||
|
.. Highlight(GetDiag("err"),"StatusLineDiagnosticError")
|
||||||
|
.. Highlight(GetDiag("warn"),"StatusLineDiagnosticWarn")
|
||||||
|
.. Highlight(GetDiag("info"),"StatusLineDiagnosticInfo")
|
||||||
|
.. Highlight(GetDiag("hint"),"StatusLineDiagnosticHint")
|
||||||
|
.. " "
|
||||||
return sline
|
return sline
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.winbar()
|
function M.winbar()
|
||||||
return "%< %f %y%h%m%r%=%-5.(L%l C%c%V%) %P "
|
return "%< %f %y%h%m%r%=" .. GetTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = vim.uv.new_timer()
|
--local timer = vim.uv.new_timer()
|
||||||
timer:start(0, 10000, vim.schedule_wrap(function()
|
--timer:start(0, 5000, vim.schedule_wrap(function()
|
||||||
vim.cmd("let &stl=&stl")
|
-- vim.cmd("let &stl=&stl")
|
||||||
end))
|
--end))
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue