This directory contains the foundational Neovim settings that configure editor behavior, performance optimizations, and basic functionality. These are loaded first before any plugins or custom configurations.
core/
โโโ init.lua # Module loader (364B)
โโโ options.lua # Editor options (2.5KB)
โโโ performance.lua # Speed optimizations (1.9KB)
โโโ backup.lua # Backup/swap settings (641B)
โโโ folding.lua # Code folding config (386B)
โโโ indentation.lua # Tab/space settings (310B)
โโโ search.lua # Search behavior (325B)
-- These are automatically loaded by config/init.lua
require('core') -- Loads all core modules
-- Or load individually
require('config.core.options')
require('config.core.performance')
-- Check current settings
:set option? -- View option value
:verbose set option? -- See where it was set
Core settings form the foundation that everything else builds upon. Wrong settings here can break plugins, slow down the editor, or cause unexpected behavior.
-- Simple loader that requires all core modules
require('config.core.performance') -- Must be first!
require('config.core.options')
require('config.core.backup')
-- etc...
Key settings:
Critical optimizations:
-- Disable unused providers (saves ~50ms)
g.loaded_python_provider = 0
g.loaded_ruby_provider = 0
g.loaded_node_provider = 0
g.loaded_perl_provider = 0
-- Disable built-in plugins (saves ~20ms)
g.loaded_gzip = 1
g.loaded_tarPlugin = 1
g.loaded_zipPlugin = 1
-- Large file optimizations
opt.synmaxcol = 1000 -- Syntax highlighting column limit
opt.maxmempattern = 2000 -- Pattern memory limit
-- LSP logging
vim.lsp.set_log_level("ERROR") -- Reduce log spam
opt.backup = false -- No backup files
opt.writebackup = false -- No backup during write
opt.swapfile = false -- No swap files
opt.undofile = true -- Persistent undo
opt.undodir = vim.fn.stdpath('data') .. '/undo'
opt.foldenable = true
opt.foldlevelstart = 99 -- Start unfolded
opt.foldmethod = 'expr' -- Use treesitter
opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
opt.expandtab = true -- Spaces instead of tabs
opt.shiftwidth = 2 -- 2-space indents
opt.tabstop = 2 -- Tab width
opt.smartindent = true -- Auto-indent
opt.ignorecase = true -- Case-insensitive
opt.smartcase = true -- Unless uppercase used
opt.hlsearch = true -- Highlight matches
opt.incsearch = true -- Show matches while typing
When modifying core settings, understand:
-- Always document why
-- WRONG: Just set the option
opt.something = true
-- RIGHT: Explain the reasoning
-- Enable something because it improves X by Y%
-- This fixes issue Z that occurs when...
opt.something = true
# Profile startup time
nvim --startuptime /tmp/startup.log
# Check specific module
nvim -c "lua require('config.core.performance')" -c "q"
# Verify no errors
nvim --headless -c "checkhealth" -c "q"
-- Conditional settings
if vim.fn.has('mac') == 1 then
-- macOS-specific settings
end
-- Safe provider detection
local python3_path = vim.fn.exepath('python3')
if python3_path ~= '' then
g.python3_host_prog = python3_path
else
g.loaded_python3_provider = 1 -- Disable if not found
end
-- Defer non-critical settings
vim.defer_fn(function()
-- Settings that can wait
end, 100)
-- BAD - These conflict
opt.compatible = true -- Vi compatible mode
opt.nocompatible = true -- Modern Vim mode
-- GOOD - Neovim is always nocompatible
-- Don't set either, it's the default
-- BAD - Checking providers that aren't used
g.python3_host_prog = '/usr/bin/python3'
-- This causes a 30ms delay even if not using Python plugins
-- GOOD - Disable if not needed
g.loaded_python3_provider = 1
-- BAD - Slows down scrolling
opt.cursorcolumn = true -- Highlights column
opt.relativenumber = true -- Without lazy redraw
opt.cursorline = true -- With complex syntax
-- GOOD - Be selective
opt.cursorline = true -- Only horizontal
opt.lazyredraw = false -- Don't use, causes issues
Symptom: Slow Neovim launch Cause: Providers being checked Fix: Disable unused providers
-- Add to performance.lua
g.loaded_python_provider = 0 -- Python 2
g.loaded_ruby_provider = 0
g.loaded_node_provider = 0
g.loaded_perl_provider = 0
Symptom: โMatchit.vim already loadedโ errors Cause: Trying to manually load built-in plugin Fix: Donโt load it, Neovim includes it
-- REMOVED: vim.cmd('runtime macros/matchit.vim')
-- It's built-in since Neovim 0.8
Symptom: Security warning about rm command Cause: netrw uses shell commands for file operations Fix: Use safe, explicit command
-- Safe version with proper flags
g.netrw_localrmdir = "rm -rf"
-- The -f prevents prompts, -r for recursive
-- Netrw validates paths, but we use safest form
Symptom: Unexpected vimlog.txt file appears Cause: Verbose mode accidentally enabled Fix: Reset verbose settings
-- Only reset if not explicitly set via command line
if vim.v.verbose == 0 then
vim.opt.verbose = 0
vim.opt.verbosefile = ""
end
unnamedplus IS enabled today
(options.lua), with an OSC 52 copy-only provider over SSH (nvim 0.10+)Provider detection order matters
-- Fast: Check executable first
if vim.fn.exepath('python3') ~= '' then
-- Slow: Let Neovim search
g.python3_host_prog = 'python3'
Defer non-critical autocmds
vim.defer_fn(function()
-- Clear messages after startup
end, 100) -- 100ms delay doesn't affect UX
Built-in plugins add 70ms
Profile everything
nvim --startuptime startup.log
grep "core" startup.log # Check core module times
Document provider requirements
-- Python3 needed for:
-- - Ultisnips (if used)
-- - Some LSP servers
-- Disable if not using these
Use has() for compatibility
if vim.fn.has('nvim-0.9') == 1 then
-- 0.9+ only features
end
Group related settings
-- Window behavior
opt.splitbelow = true
opt.splitright = true
opt.equalalways = false
" Check where option was set
:verbose set option?
" View all changed options
:set
" Profile startup
:StartupTime
" Check module load time
:lua print(vim.inspect(require('core')))
:checkhealth provider:StartupTime:verbose set option?