Summary Files Commits Branches @commit @diff @stats
path: root / nvim / .nvim / lua / ux.lua
diff options
context:
space:
mode:
Commitc9ca8a09dc3a5e421c50dc3cfa16c573a3e87135 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-11-01 22:51:04 +0200
Committer
 Syndamia <kamen@syndamia.com>
2026-11-01 22:51:18 +0200
Filesec3e06cdc9099838406b918f5b9347eee46adf88 /nvim/.nvim/lua/ux.lua
.files-main.tar
.files-main.tar.gz
.files-main.zip
Parent72d71324e1063d4d7402180e846aeff3056ba177 (diff)
feat(nvim): Implement nvim config HEAD main
Latest version from https://git.syndamia.com/conf/anderson (and formerly https://gitlab.com/Syndamia/anderson). Not edited in 7 months.
1 files changed, 69 insertions, 0 deletions
-rw-r--r--nvim/.nvim/lua/ux.lua69
diff --git a/nvim/.nvim/lua/ux.lua b/nvim/.nvim/lua/ux.lua
new file mode 100644
index 0000000..8ff01fc
--- /dev/null
+++ b/nvim/.nvim/lua/ux.lua
@@ -0,0 +1,69 @@
+--[=[ Search ]=]--
+
+vim.o.hlsearch = false -- No highlighting when searching
+
+vim.api.nvim_create_autocmd({ "Filetype" }, {
+ pattern = "qf",
+ command = "wincmd J"
+})
+
+--[=[ Cursor and mouse ]=]--
+
+vim.o.scrolloff = 5 -- Lines above and below cursor
+vim.o.showmatch = true -- Jump to opening brace when having typed closing one
+
+vim.o.cursorline = true
+vim.api.nvim_create_autocmd({ "InsertLeave", "BufEnter" }, {
+ command = "set cul"
+})
+vim.api.nvim_create_autocmd({ "InsertEnter", "BufLeave" }, {
+ command = "set nocul"
+})
+
+vim.o.mouse = "a"
+
+--[=[ Windows ]=]--
+
+vim.o.splitbelow = true
+vim.o.splitright = true
+
+vim.o.number = true
+vim.o.signcolumn = "number"
+
+vim.o.showmode = false
+vim.o.timeoutlen = 350
+
+--[=[ History ]=]--
+
+vim.o.undofile = true
+vim.o.undodir = vim.fn.expand("~/nvim/undo")
+
+--[=[ Quickfix ]=]--
+
+vim.cmd [[
+ function QuickFixFormat(info)
+ let qfl = []
+
+ let maxfnlen = 0
+ let maxlilen = 0
+ for d in getqflist()
+ let maxfnlen = max([maxfnlen, strdisplaywidth(fnamemodify(bufname(d.bufnr), ":t"))])
+ let maxlilen = max([maxlilen, strdisplaywidth(string(d.lnum))])
+ endfor
+ let strfmt = "%-" . maxfnlen . "s |%". maxlilen ."d|%s"
+
+ let lastfile = ""
+ for d in getqflist()
+ let fn = fnamemodify(bufname(d.bufnr), ":t")
+ if d.lnum != 0
+ call add(qfl, printf(strfmt, fn == lastfile ? '' : fn, d.lnum, d.text))
+ let lastfile = fn
+ else
+ call add(qfl, ' ')
+ endif
+ endfor
+ return qfl
+ endfunction
+]]
+
+vim.o.quickfixtextfunc = "QuickFixFormat"