marleyvim/nvim/lua/options.lua

135 lines
2.9 KiB
Lua

local g = vim.g
local opt = vim.opt
-- Root dir detection options.
-- Each entry can be a pattern `.git` or `package.json`
g.root_spec = { '.git', 'package.json' }
-- Only set clipboard if not in SSH, to make sure the OSC 52 integration works
-- automatically. Requires Neovim >= 0.10.0.
-- `unnamedplus` is the system clipboard.
opt.clipboard = vim.env.SSH_TTY and '' or 'unnamedplus'
-- Relative line numbers.
opt.number = true
opt.relativenumber = true
-- Set <Tab> to 2 spaces.
opt.expandtab = true
opt.shiftwidth = 2
opt.tabstop = 2
-- Smart/auto indenting.
opt.shiftround = true
opt.smartindent = true
opt.breakindent = true
-- Show matches in real time while searching.
opt.hlsearch = true
opt.incsearch = true
-- Disable text wrap.
opt.wrap = false
-- Better splitting.
opt.splitbelow = true
opt.splitright = true
-- Enable mouse mode.
opt.mouse = 'a'
-- Smart handling of case when searching.
opt.ignorecase = true
opt.smartcase = true
-- Use Ripgrep for searching.
opt.grepprg = 'rg --vimgrep'
opt.grepformat = '%f:%l:%c:%m'
-- More frequent swap file saving.
opt.updatetime = 200
-- Completion options.
opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' }
-- Persistant & bigger undo history.
opt.undofile = true
opt.undolevels = 10000
-- Enable 24-bit colors.
opt.termguicolors = true
-- Always show the signcolumn to keep the text from jumping.
opt.signcolumn = 'yes'
-- Highlight the current line.
opt.cursorline = true
-- Fold settings.
opt.foldcolumn = '1'
opt.foldlevel = 99
opt.foldenable = true
opt.foldmethod = 'expr'
opt.foldexpr = 'nvim_treesitter#foldexpr()'
opt.foldtext = ''
-- Always keep 4 lines above/below cursor.
opt.scrolloff = 4
-- Max width.
opt.textwidth = 80
opt.colorcolumn = '+1'
-- Show some invisible chars.
opt.list = true
opt.listchars = { tab = '->', trail = '·' }
-- Only show a single statusline instead of one for each window.
opt.laststatus = 3
-- Preview subsitutions as you type.
opt.inccommand = 'split'
-- Ask to save changes before exiting modified buffer.
opt.confirm = true
-- I don't understand this but LazyVim sets it and it seems like a good idea.
opt.jumpoptions = 'view'
-- Enable a little transparency for pop-ups.
opt.pumblend = 10
-- Disable default line/col numbers in statusline.
opt.ruler = false
-- What to save when calling :mksession.
opt.sessionoptions = {
'buffers',
'curdir',
'tabpages',
'winsize',
'help',
'globals',
'skiprtp',
'folds',
}
-- Scrolling.
opt.smoothscroll = true
opt.sidescroll = 1
opt.sidescrolloff = 8
-- Spelling suggestions language.
opt.spelllang = { 'en' }
-- Allow cursor to move where there is no text in visual block mode.
opt.virtualedit = 'block'
-- Command mode completion mode.
opt.wildmode = { 'longest:full', 'full' }
-- Min window width when splitting.
opt.winminwidth = 5
-- Disable some messages.
opt.shortmess:append({ W = true, I = true, c = true, C = true })