[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 SpellLocal guibg=Normal guifg=Normal gui=undercurl guisp=pink
|
||||
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 NormalFloat guibg=#666666
|
||||
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
|
||||
colo gruv
|
||||
set noshowmode
|
||||
set laststatus=2
|
||||
set cmdheight=0
|
||||
set laststatus=3
|
||||
set cmdheight=1
|
||||
"set foldcolumn=1
|
||||
|
||||
set statusline=%{%v:lua.require('plugins.statusline').statusline()%}
|
||||
set winbar=%{%v:lua.require('plugins.statusline').winbar()%}
|
||||
set statusline+=%#StatusLineMain#%{%v:lua.require('plugins.statusline').statusline()%}%*
|
||||
"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
|
||||
lua require('init')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
--require('plugins.gruvbox')
|
||||
--require('plugins.feline')
|
||||
require('gitsigns').setup({numhl = true})
|
||||
--require('plugins.matlab_ls')
|
||||
require('plugins.matlab_ls')
|
||||
require('plugins.lua_ls')
|
||||
require('plugins.treesitter')
|
||||
--require('battery').setup({
|
||||
|
@ -16,13 +16,14 @@ vim.diagnostic.config({
|
|||
underline = true,
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = '●',
|
||||
[vim.diagnostic.severity.WARN] = '●',
|
||||
[vim.diagnostic.severity.ERROR] = '✖',
|
||||
[vim.diagnostic.severity.WARN] = '⚠',
|
||||
[vim.diagnostic.severity.INFO] = '●',
|
||||
[vim.diagnostic.severity.HINT] = '●'
|
||||
[vim.diagnostic.severity.HINT] = '✦'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
--vim.api.nvim_set_hl(0,"DiagnosticUnderlineWarn",{undercurl=true,sp='DiagnosticWarn'})
|
||||
--For Alacritty:
|
||||
-- vim.api.nvim_create_autocmd("ExitPre", {
|
||||
|
@ -30,3 +31,6 @@ vim.diagnostic.config({
|
|||
-- command = "set guicursor=a:ver90-blinkwait250-blinkoff250-blinkon250",
|
||||
-- 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 = {
|
||||
MATLAB = {
|
||||
indexWorkspace = false,
|
||||
installPath = "/usr/local/MATLAB/R2024b",
|
||||
installPath = "/usr/local/MATLAB/R2025a",
|
||||
matlabConnectionTiming = "onStart",
|
||||
telemetry = false
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ M.modeMap = {
|
|||
GetMode = function()
|
||||
local m = vim.api.nvim_get_mode().mode
|
||||
if M.modeMap[m] ~= nil then
|
||||
return M.modeMap[m] .. " "
|
||||
return Highlight(" "..M.modeMap[m].." ","StatusLineMode")
|
||||
else
|
||||
return ""
|
||||
end
|
||||
|
@ -24,46 +24,85 @@ GetTime = function()
|
|||
end
|
||||
|
||||
GetLSP = function()
|
||||
local clients = vim.lsp.get_clients()
|
||||
local clients = vim.lsp.get_clients({bufnr = 0})
|
||||
if next(clients) ~= nil then
|
||||
local name = string.format('%s',clients[1].name)
|
||||
local root = clients[1].root_dir
|
||||
if name == 'matlab_ls' and root ~= nil then
|
||||
local sandbox = root:match(".+/([^/]+)$")
|
||||
--local handle = io.popen('p4 opened | grep tnrCRCDecode | sed \'s/^[^#]*//g\'')
|
||||
--local result = handle:read("*a")
|
||||
return string.format('| %s -> %s ',name,sandbox)
|
||||
return string.format(' {◉%s} [%s] ',name,sandbox)
|
||||
else
|
||||
return "| " .. name .. " "
|
||||
return string.format(' {◉%s} ',name)
|
||||
end
|
||||
else
|
||||
return ''
|
||||
return ' {◉} '
|
||||
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()
|
||||
local signs = vim.b.gitsigns_status_dict or {head = '', added = 0, changed = 0, removed = 0}
|
||||
local inRepo = signs.head ~= ''
|
||||
|
||||
return inRepo and string.format(
|
||||
'| %s: +%s ~%s -%s ',
|
||||
signs.head, signs.added, signs.changed, signs.removed
|
||||
) or ''
|
||||
'%s%s%s%s',
|
||||
Highlight(" {↣"..signs.head.."}","StatusLineGit"),
|
||||
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
|
||||
|
||||
function M.statusline()
|
||||
local sline = " "
|
||||
sline = sline .. GetMode() .. GetGitStatus() .. GetLSP() .. "%=" .. GetDate() .. " | " .. GetTime() .. " "
|
||||
local sline = ""
|
||||
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
|
||||
end
|
||||
|
||||
function M.winbar()
|
||||
return "%< %f %y%h%m%r%=%-5.(L%l C%c%V%) %P "
|
||||
return "%< %f %y%h%m%r%=" .. GetTime()
|
||||
end
|
||||
|
||||
local timer = vim.uv.new_timer()
|
||||
timer:start(0, 10000, vim.schedule_wrap(function()
|
||||
vim.cmd("let &stl=&stl")
|
||||
end))
|
||||
--local timer = vim.uv.new_timer()
|
||||
--timer:start(0, 5000, vim.schedule_wrap(function()
|
||||
-- vim.cmd("let &stl=&stl")
|
||||
--end))
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue