repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

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

-- Keep track of file changes outside of vim
vim.opt.autoread = true

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

-- do not make a backup before writing to a file
vim.opt.writebackup = true

-- save a swap file after every 100 typed characters.
vim.opt.swapfile = true
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"
vim.opt.updatetime = 50
-- 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
-- only insert spaces for tabs if language configuration explicitly declares so
vim.opt.expandtab = false
local tab_size = 2
vim.opt.tabstop = tab_size
vim.opt.shiftwidth = tab_size
vim.opt.softtabstop = tab_size
vim.opt.shiftround = true
-- insert whitespace type based on whitespace on previous line
vim.opt.smarttab = true

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

-- do not keep distance to borders while scrolling
vim.opt.scrolloff = 0
vim.opt.sidescrolloff = 0

-- try to guess indentation based on context
vim.opt.smartindent = true
-- Keep indentation of new lines in line with previous lines
vim.opt.autoindent = 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'
-- disable popup menu on right click
vim.opt.mousemodel = 'popup_setpos'

-- highlight all search matches
vim.opt.hlsearch = true
-- enable smart case in searches
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.incsearch = true
vim.opt.showmatch = true
vim.opt.hidden = true

-- Show the effects of substitutions incrementally
vim.opt.inccommand = 'nosplit'

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

-- show trailing whitespace
vim.opt.list = false
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.wildmode = 'full'
vim.opt.wildignorecase = true
vim.opt.wildoptions = 'fuzzy,pum'

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

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

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

-- show cmd window to prevent jitter UI
vim.opt.cmdheight = 1

-- do not conceal special characters by default. ftplugin can enable this on demand.
vim.opt.conceallevel = 0

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

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

-- highlight the current line
vim.opt.cursorline = false

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

-- no transparent popups and floating windows
vim.opt.pumblend = 0
vim.opt.winblend = 0

-- use this in various places for consistent border style
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