diff options
| Commit | c9ca8a09dc3a5e421c50dc3cfa16c573a3e87135 (patch) | |
|---|---|---|
| Author | 2026-11-01 22:51:04 +0200 | |
| Committer | 2026-11-01 22:51:18 +0200 | |
| Files | ec3e06cdc9099838406b918f5b9347eee46adf88 /nvim/.nvim/lua/ux.lua | |
| .files-main.tar .files-main.tar.gz .files-main.zip | ||
| Parent | 72d71324e1063d4d7402180e846aeff3056ba177 (diff) | |
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.lua | 69 |
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" |
