Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

neovim/lua/bugabinga/options/core.lua

Raw
local icon = require 'std.icon'

-- disable some runtime providers that i will not use.
-- keeps checkhealth clean
-- pls stop haunting me python...
vim.g.loaded_python3_provider = 0
vim.g.loaded_ruby_provider = 0
vim.g.loaded_node_provider = 0
vim.g.loaded_perl_provider = 0

-- Disable builtin statusline of qf window
vim.g.qf_disable_statusline = 1

-- NEOVIM EDITOR OPTIONS

-- encode files in UTF-8
vim.opt.fileencoding = 'utf-8'

-- do not create local backup files
vim.opt.backup = true
-- by default backups are created next to the edited file.
-- that tends to pollute the workspace.
-- instead, backup to the second default directory only.
-- neovim should create it if it does not exist.
-- the double slash at the end means something important...
-- i think it means to use full path as name for backup files to avoid
-- collisions.
vim.opt.backupdir = vim.fn.stdpath 'state' .. '/backup//'

vim.opt.updatecount = 100

-- enable persistent undo. save undo history across neovim instances
vim.opt.undofile = true

-- How many milliseconds must pass before neovim decides I was "idle".
-- Drives the swap file flush and the CursorHold event. Below ~100ms nothing
-- feels faster to a human, but every CursorHold consumer ( lsp document
-- highlight, code action signs ) fires another round of requests.
vim.opt.updatetime = 150
-- How long to wait between key sequences in order to chain them. e.g. <LEADER>b
vim.opt.timeoutlen = 250

-- allow commands like find, grep, ... to search for files recursively
vim.opt.path:append '**'
-- ignore some files from path
vim.opt.wildignore = {
	'*.o',
	'*.obj',
	'*.class',
	'*.jar',
	'*.zig-cache',
	'zig-out/*',
	'target/*',
	'output/*',
	'*.rlib',
	'*.dylib',
	'*.so',
	'*.a',
	'*.exe',
	'*.dll',
	'*.pdb',
	'*.mod',
	'*.sum',
	'*.swp',
	'*.swo',
	'*.tmp',
	'*.bak',
	'*/vendor/*',
	'*/node_modules/*',
	'*/.git/*',
}

-- wrap line movements, when start/end is reached
vim.opt.whichwrap:append '<'
vim.opt.whichwrap:append '>'
vim.opt.whichwrap:append '['
vim.opt.whichwrap:append ']'
vim.opt.whichwrap:append 'h'
vim.opt.whichwrap:append 'l'

-- treat words separated by a dash as one word. used in snail-case-convention
vim.opt.iskeyword:append '-'

-- Tabs and Spaces, i like 'em 2 spaces wide
local tab_size = 2
vim.opt.tabstop = tab_size
vim.opt.shiftwidth = tab_size
vim.opt.softtabstop = tab_size
vim.opt.shiftround = true

vim.opt.wrap = false
-- wrapped lines will continue on indentation
vim.opt.breakindent = true

-- try to guess indentation based on context
vim.opt.smartindent = true
vim.opt.copyindent = true

-- open splits to the right and below
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.splitkeep = 'screen'

-- enable mouse
vim.opt.mouse = 'a'

-- enable smart case in searches
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.showmatch = true

-- ask me to force failed commands
vim.opt.confirm = true

vim.opt.listchars = {
	space = icon.space,
	eol = icon.eol,
	tab = icon.tab .. icon.middle_ellipsis,
	-- tab = '  ',
	trail = icon.trail,
	extends = icon.extends,
	precedes = icon.precedes,
	nbsp = icon.nbsp,
}

-- do not spam the cmdline with every little input
vim.opt.showcmd = false

-- autocomplete menu in command buffer
vim.opt.wildignorecase = true
vim.opt.wildoptions = 'fuzzy,pum'

-- completion popup in buffer
vim.opt.completeopt:append 'menu'
vim.opt.completeopt:append 'menuone'
vim.opt.completeopt:append 'popup'
vim.opt.completeopt:append 'noinsert'

-- control completion options for <c-n> and <c-p>
vim.opt.complete:append 'kspell' -- scans spell dict, only used, when 'spell' is set

-- always display the signcolumn to avoid jitter
vim.opt.signcolumn = 'yes:2'

-- what is a ruler? me?
vim.opt.ruler = false

-- avoid jitter by keeping status area big
vim.opt.laststatus = 3

-- hide weird symbol at end of buffer
vim.opt.fillchars = {
	eob = ' ',
	lastline = ' ',
	diff = '╱',
	wbr = ' ',

	horiz = '─',
	horizup = '┴',
	horizdown = '┬',
	vert = '│',
	vertleft = '┤',
	vertright = '├',
	verthoriz = '┼',
}

vim.opt.winborder = 'shadow'

-- better have no syntax highlighting than regex based, treesitter will take over later
vim.opt.syntax = 'off'

-- hide output of insert completion popup in status
-- vim.opt.shortmess:append 'c'
-- hide vim intro screen
vim.opt.shortmess:append 'I'
-- truncate messages at end
-- vim.opt.shortmess:append 't'

-- I do not care for folding
vim.opt.foldenable = false

-- show visual indicators for lines too long
vim.opt.colorcolumn = { '80', '120', '140' }

-- pop up menu height
vim.opt.pumheight = 10

-- use this in various places for consistent border style.
-- plain box drawing ( U+2500 block ) on purpose: the prettier sextants from
-- "Symbols for Legacy Computing" ( U+1FBxx ) are in almost no font. wezterm
-- draws them itself, so they looked fine there, but every other frontend
-- ( neovide, most terminals ) renders them as tofu boxes.
vim.g.border_style = {
	{ '┌', 'FloatBorderCorner' }, -- top left
	{ '─', 'FloatBorder' }, -- top
	{ '┐', 'FloatBorderCorner' }, -- top right
	{ '│', 'FloatBorder' }, -- right
	{ '┘', 'FloatBorderCorner' }, -- bottom right
	{ '─', 'FloatBorder' }, -- bottom
	{ '└', 'FloatBorderCorner' }, -- bottom left
	{ '│', 'FloatBorder' }, -- left
}

-- hide the mode indicator in status
vim.opt.showmode = false

-- always show tabs, to avoid jitter UI
vim.opt.showtabline = 2

-- scroll by screen lines if buffer is wrapped
vim.opt.smoothscroll = true