add and change settings. undo history not available through undofile

This commit is contained in:
2024-12-05 15:07:02 -05:00
parent 687a575192
commit 95bfc11404
+73 -60
View File
@@ -1,76 +1,55 @@
-- ──────────────────────────────────────────────────────── helpers ──
local o = vim.opt local o = vim.opt
local g = vim.g local g = vim.g
-- ──────────────────────────────────────────────────── environment ──
-- environment
o.showmode = false
g.netrw_liststyle = 3 g.netrw_liststyle = 3
g.netrw_banner = 0 g.netrw_banner = 0
o.clipboard:append('unnamedplus') -- use system clipboard as the default register
-- :cd shows cwd o.cdhome = false -- :cd shows cwd
o.cdhome = false o.backspace = 'indent,eol,start'
o.spelllang = 'en_us'
-- line numbers -- ───────────────────────────────────────────────────── appearance ──
o.showmode = false
o.termguicolors = true
o.background = 'dark'
vim.diagnostic.config({
float = {
border = 'rounded',
},
})
-- ─────────────────────────────────────────────────── line numbers ──
o.number = true o.number = true
o.relativenumber = true o.relativenumber = true
-- ──────────────────────────────────────────────────── sign column ──
-- tabs & indents o.signcolumn = 'yes'
-- ─────────────────────────────────────────────────────── markdown ──
vim.api.nvim_create_autocmd('BufWinEnter', {
pattern = { '*.md' },
callback = function()
o.colorcolumn = '+1,+2'
o.textwidth = 80
end,
})
-- ──────────────────────────────────────────────────── cursor line ──
o.cursorline = true
-- o.scrolloff = 999 -- keep cursor line centered
-- ───────────────────────────────────────────────── tabs & indents ──
o.tabstop = 3 o.tabstop = 3
o.softtabstop = 3 o.softtabstop = 3
o.shiftwidth = 3 o.shiftwidth = 3
o.expandtab = true o.expandtab = true
o.smartindent = true o.smartindent = true
o.autoindent = true o.autoindent = true
-- ────────────────────────────────────────────────── line wrapping ──
-- line wrapping
o.wrap = false o.wrap = false
o.breakindent = true o.breakindent = true
-- o.textwidth = 0
-- keep cursor line centered o.wrapmargin = 10
o.scrolloff = 999 -- ──────────────────────────────────────────────────────── conceal ──
o.conceallevel = 2
-- search -- ──────────────────────────────────────────────────────── folding ──
o.ignorecase = true
o.smartcase = true
o.iskeyword:append('-') -- consider string-string as a whole word
-- cursor line
o.cursorline = true
-- appearance
o.termguicolors = true
o.background = 'dark'
o.signcolumn = 'yes'
o.colorcolumn = '80'
vim.diagnostic.config({
float = {
border = 'rounded',
},
})
-- virtualedit
o.virtualedit = 'block'
-- backspace
o.backspace = 'indent,eol,start'
-- clipboard
o.clipboard:append('unnamedplus') -- use system clipboard as the default register
-- split windows
o.splitright = true
o.splitbelow = true
-- save me
-- o.undodir = { os.getenv("HOME") .. "/.undo/" }
-- set undo dir under nvim app folder
-- o.undodir = { vim.fn.stdpath('config') .. '/.undo/' }
-- undodir is in .local/state/nvim/undo (default)
o.undodir = { vim.fn.stdpath('state') .. '/undo/' }
o.undofile = true
-- folding
o.foldcolumn = '0' o.foldcolumn = '0'
o.foldlevel = 10 o.foldlevel = 15
o.foldmethod = 'expr' o.foldmethod = 'expr'
o.foldexpr = 'nvim_treesitter#foldexpr()' o.foldexpr = 'nvim_treesitter#foldexpr()'
o.fillchars = { o.fillchars = {
@@ -80,6 +59,40 @@ o.fillchars = {
foldsep = ' ', foldsep = ' ',
eob = ' ', eob = ' ',
} }
-- ──────────────────────────────────────────────────── virtualedit ──
o.virtualedit = 'block'
-- ─────────────────────────────────────────────────────────── undo ──
-- session management --
o.sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions' -- │
-- │ o.undodir = { os.getenv("HOME") .. "/.undo/" }
-- │ set undo dir under nvim app folder
-- │ o.undodir = { vim.fn.stdpath('config') .. '/.undo/' }
-- │ undodir is in .local/state/nvim/undo (default)
-- │
-- └
-- FIX: undofiles saving but always saying 'at latest
-- change' when trying to undo
o.undolevels = 10000
o.undofile = true
o.undodir = { vim.fn.stdpath('state') .. '/undo/' .. '/' }
-- ───────────────────────────────────────────── session management ──
-- ┌
-- │ can not include 'globals' or it breaks auto-session
-- │ because NvimTree
-- │ adds 2 variables to session file that prevents
-- │ NvimTree from working
-- │ after session is restored.
-- └
o.sessionoptions = 'buffers,curdir,folds,localoptions,help,tabpages,terminal,winsize,winpos'
-- ────────────────────────────────────────────────── split windows ──
o.splitright = true
o.splitbelow = true
-- ───────────────────────────────────────────────────────── search ──
o.ignorecase = true
o.smartcase = true
o.iskeyword:append('-') -- consider string-string as a whole word
-- ───────────────────────────────────────────────────── completion ──
o.completeopt = 'menu,preview,noselect'