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 bundled vimscript runtime plugins.
-- none of these are used, each one sources a .vim file at startup.
-- the guard variable differs from the plugin name in several cases
-- ( netrw needs loaded_netrwPlugin, not loaded_netrw ), so set the
-- full set explicitly.
for _, plugin in ipairs {
	'gzip',
	'matchit',
	'matchparen',
	'netrw',
	'netrwPlugin',
	'netrwSettings',
	'netrwFileHandlers',
	'tar',
	'tarPlugin',
	'zip',
	'zipPlugin',
	'tutor',
	'tutor_mode_plugin',
	'remote_plugins',
	'2html_plugin',
	'logipat',
	'rrhelper',
	'vimball',
	'vimballPlugin',
	'spellfile_plugin',
} do
	vim.g['loaded_' .. plugin] = 1
end

-- disable the builtin vim regex syntax engine. treesitter only.
-- this stops per-filetype syntax/*.vim files from sourcing.
-- consequence: any filetype without a treesitter parser gets no
-- highlighting at all. accepted tradeoff.
vim.cmd.syntax 'off'

-- drop the system vim directory from the runtime and pack paths.
-- it leaks vimscript into neovim: fzf.vim, skim.vim and package ftdetect
-- files ( PKGBUILD, SRCINFO, ghostty ) all live here.
vim.opt.runtimepath:remove '/usr/share/vim/vimfiles'
vim.opt.runtimepath:remove '/usr/share/vim/vimfiles/after'
vim.opt.packpath:remove '/usr/share/vim/vimfiles'
vim.opt.packpath:remove '/usr/share/vim/vimfiles/after'

-- 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

-- keep the structure of the existing indentation when copying lines.
-- note: 'smartindent' is intentionally absent, our global treesitter
-- 'indentexpr' overrides it anyway.
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.
-- set explicitly instead of appending to the default ( menu,popup ) to avoid
-- relying on + duplicating defaults.
vim.opt.completeopt = { 'menu', 'menuone', 'popup', 'noinsert' }


-- 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 = '┼',
}



-- 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

-- consistent, simple float borders everywhere ( lsp hover, pickers, my own
-- popups ). single source of truth: the global 'winborder'. every float that
-- does not pass an explicit border inherits this one.
-- plain box drawing ( U+2500 ) on purpose: the sextants from "Symbols for
-- Legacy Computing" ( U+1FBxx ) render as tofu in almost every font/frontend
-- except wezterm, which draws them itself.
vim.o.winborder = '┌,─,┐,│,┘,─,└,│'

-- 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