nvim: fancy ruler with diagnostics
This commit is contained in:
parent
8b8a7cf04b
commit
4f8865c8ac
2 changed files with 33 additions and 18 deletions
|
@ -10,6 +10,7 @@
|
||||||
withRuby = false;
|
withRuby = false;
|
||||||
|
|
||||||
extraLuaConfig = lib.fileContents ./init.lua;
|
extraLuaConfig = lib.fileContents ./init.lua;
|
||||||
|
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
black
|
black
|
||||||
cue
|
cue
|
||||||
|
|
|
@ -8,18 +8,32 @@ vim.opt.laststatus = 0
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
vim.opt.ruler = true
|
vim.opt.ruler = true
|
||||||
vim.opt.rulerformat = "" -- FIXME: fancify!
|
|
||||||
vim.opt.rulerformat = "%36(%5l,%-6(%c%V%) %t%)%*"
|
|
||||||
vim.opt.syntax = "on"
|
vim.opt.syntax = "on"
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
|
-- Ruler
|
||||||
|
function GetIndicators()
|
||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
local counts = vim.diagnostic.count(bufnr)
|
||||||
|
local errors = counts[vim.diagnostic.severity.ERROR] or 0
|
||||||
|
local warnings = counts[vim.diagnostic.severity.WARN] or 0
|
||||||
|
local warn_string = warnings > 0 and "%#DiagnosticWarn# " .. warnings .. " " or " "
|
||||||
|
local error_string = errors > 0 and "%#DiagnosticError# " .. errors .. " " or " "
|
||||||
|
return warn_string .. error_string
|
||||||
|
end
|
||||||
|
function GetRulerIcon()
|
||||||
|
local icon = vim.bo.modified and "" or ""
|
||||||
|
return "%#CustomRulerSeparator#%#CustomRulerIcon#" .. icon .. " "
|
||||||
|
end
|
||||||
|
vim.opt.rulerformat = "%40(%=%{%v:lua.GetIndicators()%}%#Label#│ %t %)"
|
||||||
|
|
||||||
-- Search
|
-- Search
|
||||||
vim.opt.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
vim.opt.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
-- Tab completion
|
-- Tab completion
|
||||||
-- vim.opt.wildmode="list:longest,full"
|
-- vim.opt.wildmode="list:longest,full"
|
||||||
vim.opt.wildignore="*.swp,*.o,*.so,*.exe,*.dll"
|
vim.opt.wildignore = '*.swp,*.o,*.so,*.exe,*.dll'
|
||||||
|
|
||||||
-- Whitespaces
|
-- Whitespaces
|
||||||
vim.opt.breakindent = true
|
vim.opt.breakindent = true
|
||||||
|
@ -32,14 +46,14 @@ vim.opt.smartindent = true
|
||||||
vim.opt.tabstop = 2
|
vim.opt.tabstop = 2
|
||||||
vim.opt.wrap = false
|
vim.opt.wrap = false
|
||||||
vim.opt.list = true
|
vim.opt.list = true
|
||||||
vim.opt.listchars="tab:»·,trail:·"
|
im.opt.listchars = "tab:»·,trail:·"
|
||||||
|
|
||||||
-- Folds
|
-- Folds
|
||||||
vim.opt.foldenable = false
|
vim.opt.foldenable = false
|
||||||
vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()"
|
vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()"
|
||||||
vim.opt.foldmethod = "expr"
|
vim.opt.foldmethod = "expr"
|
||||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
|
qqq
|
||||||
--
|
--
|
||||||
|
|
||||||
vim.o.autochdir = true
|
vim.o.autochdir = true
|
||||||
|
@ -62,7 +76,7 @@ vim.opt.grepformat = vim.opt.grepformat ^ { "%f:%l:%c:%m" }
|
||||||
|
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DiagnosticSignError",
|
"DiagnosticSignError",
|
||||||
{ text = "", hl = "DiagnosticSignError", texthl = "DiagnosticSignError", culhl = "DiagnosticSignErrorLine" }
|
{ text = "", hl = "DiagnosticSignError", texthl = "DiagnosticSignError", culhl = "DiagnosticSignErrorLine" }
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DiagnosticSignWarn",
|
"DiagnosticSignWarn",
|
||||||
|
@ -70,7 +84,7 @@ vim.fn.sign_define(
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DiagnosticSignInfo",
|
"DiagnosticSignInfo",
|
||||||
{ text = "", hl = "DiagnosticSignInfo", texthl = "DiagnosticSignInfo", culhl = "DiagnosticSignInfoLine" }
|
{ text = "", hl = "DiagnosticSignInfo", texthl = "DiagnosticSignInfo", culhl = "DiagnosticSignInfoLine" }
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DiagnosticSignHint",
|
"DiagnosticSignHint",
|
||||||
|
|
Loading…
Reference in a new issue