Compare commits

...

4 commits

Author SHA1 Message Date
2f0f291167
cleanup 2024-11-06 00:49:48 +01:00
4f8865c8ac
nvim: fancy ruler with diagnostics 2024-11-06 00:43:04 +01:00
8b8a7cf04b
nvim: cleanup 2024-11-06 00:42:33 +01:00
93f6d76c76
nvim: use <leader>cf for code formatting 2024-11-06 00:41:50 +01:00
4 changed files with 31 additions and 23 deletions

View file

@ -10,6 +10,7 @@
withRuby = false;
extraLuaConfig = lib.fileContents ./init.lua;
extraPackages = with pkgs; [
black
cue

View file

@ -1,5 +1,5 @@
-- vim.g.mapleader = "<space>"
vim.g.maplocalleader = ','
vim.g.mapleader = "<space>"
vim.g.maplocalleader = ","
-- UI
@ -8,18 +8,28 @@ vim.opt.laststatus = 0
vim.opt.number = true
vim.opt.relativenumber = 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.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
vim.opt.rulerformat = "%40(%=%{%v:lua.GetIndicators()%}%#Label#│ %t %)"
-- Search
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Tab completion
-- vim.opt.wildmode="list:longest,full"
vim.opt.wildignore="*.swp,*.o,*.so,*.exe,*.dll"
vim.opt.wildignore = '*.swp,*.o,*.so,*.exe,*.dll'
-- Whitespaces
vim.opt.breakindent = true
@ -39,7 +49,6 @@ vim.opt.foldenable = false
vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()"
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
--
vim.o.autochdir = true
@ -62,7 +71,7 @@ vim.opt.grepformat = vim.opt.grepformat ^ { "%f:%l:%c:%m" }
vim.fn.sign_define(
"DiagnosticSignError",
{ text = "", hl = "DiagnosticSignError", texthl = "DiagnosticSignError", culhl = "DiagnosticSignErrorLine" }
{ text = "", hl = "DiagnosticSignError", texthl = "DiagnosticSignError", culhl = "DiagnosticSignErrorLine" }
)
vim.fn.sign_define(
"DiagnosticSignWarn",
@ -70,7 +79,7 @@ vim.fn.sign_define(
)
vim.fn.sign_define(
"DiagnosticSignInfo",
{ text = "", hl = "DiagnosticSignInfo", texthl = "DiagnosticSignInfo", culhl = "DiagnosticSignInfoLine" }
{ text = "", hl = "DiagnosticSignInfo", texthl = "DiagnosticSignInfo", culhl = "DiagnosticSignInfoLine" }
)
vim.fn.sign_define(
"DiagnosticSignHint",

View file

@ -35,7 +35,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
vim.keymap.set("n", "<space>r", vim.lsp.buf.rename, opts("Rename Symbol"))
vim.keymap.set({ "n", "v" }, "<space>a", vim.lsp.buf.code_action, opts("Code Action"))
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts("Buffer References"))
vim.keymap.set("n", "<localleader>f", function()
vim.keymap.set("n", "<space>cf", function()
vim.lsp.buf.format({ async = true })
end, opts("Format Buffer"))
end,

View file

@ -9,8 +9,6 @@
require('mini.extra').setup()
require('mini.icons').setup()
require('mini.jump').setup()
-- require('mini.pairs').setup()
-- require('mini.statusline').setup()
require('mini.surround').setup()
require('mini.splitjoin').setup()