neovim-confs/lua/custom/init.lua

136 lines
4.2 KiB
Lua
Raw Normal View History

2024-01-19 22:34:37 +01:00
local opt = vim.opt
local g = vim.g
g.maplocalleader = ";"
2024-01-20 01:42:31 +01:00
2024-01-19 22:34:37 +01:00
opt.foldmethod = "indent"
opt.foldnestmax = 10
opt.foldlevel = 4
opt.signcolumn = "yes"
opt.spelllang = "en,de"
2024-01-20 01:03:01 +01:00
opt.clipboard = "" -- don't just use the system clipboard
2024-01-19 23:44:07 +01:00
opt.wrap = false
opt.breakindent = false
2024-01-20 01:03:01 +01:00
opt.spell = true
opt.list = true
2024-01-20 01:42:31 +01:00
opt.conceallevel = 2
opt.undofile = true
opt.undolevels = 10000
opt.writebackup = false
opt.history = 5000
opt.shada = { "'1000", "<50", "s10", "h" }
-- Tabs and Indents
-- ===
opt.textwidth = 80 -- Text width maximum chars before wrapping
opt.tabstop = 4 -- The number of spaces a tab is
opt.shiftwidth = 4 -- Number of spaces to use in auto(indent)
opt.smarttab = true -- Tab insert blanks according to 'shiftwidth'
opt.autoindent = true -- Use same indenting on new lines
opt.smartindent = true -- Smart autoindenting on new lines
opt.shiftround = true -- Round indent to multiple of 'shiftwidth'
-- Timing
-- ===
opt.ttimeout = true
opt.timeoutlen = 500 -- Time out on mappings
opt.ttimeoutlen = 10 -- Time out on key codes
opt.updatetime = 500 -- Idle time to write swap and trigger CursorHold
-- Searching
-- ===
opt.ignorecase = true -- Search ignoring case
opt.smartcase = true -- Keep case when searching with *
opt.infercase = true -- Adjust case in insert completion mode
opt.incsearch = true -- Incremental search
-- Formatting
-- ===
opt.wrap = false -- No wrap by default
opt.linebreak = true -- Break long lines at 'breakat'
opt.breakat = '\\ \\ ;:,!?' -- Long lines break chars
opt.startofline = false -- Cursor in same column for few commands
opt.splitbelow = true -- Splits open bottom right
opt.splitright = true
opt.breakindentopt = { shift = 2, min = 20 }
opt.formatoptions = "cqanlmBjp" -- see :h fo-table & :h formatoptions
-- Diff
-- ===
opt.diffopt:append({ 'iwhite', 'indent-heuristic', 'algorithm:patience' })
opt.wildmode = 'longest:full,full' -- Command-line completion mode
-- Editor UI
-- ===
opt.termguicolors = true
opt.shortmess = "xsTOInfFitloCaAs"
opt.showmode = true -- Show mode in cmd window
opt.scrolloff = 2 -- Keep at least n lines above/below
opt.sidescrolloff = 0 -- Keep at least n lines left/right
opt.numberwidth = 2 -- Minimum number of columns to use for the line number
opt.number = true -- Show line numbers
opt.ruler = false -- Default status ruler
opt.list = true -- Show hidden characters
if vim.g.started_by_firenvim == false then
opt.showtabline = 3 -- Always show the tabs line
opt.laststatus = 3 -- Always show laststatus
else
opt.showtabline = 1 -- Don't show tabline in firenvim, unless multitab
opt.laststatus = 3 -- Don't show laststatus in firenvim
end
opt.helpheight = 0 -- Disable help window resizing
opt.winwidth = 30 -- Minimum width for active window
opt.winminwidth = 1 -- Minimum width for inactive windows
opt.winheight = 1 -- Minimum height for active window
opt.winminheight = 1 -- Minimum height for inactive window
opt.showcmd = false -- show command in status line
opt.cmdheight = 0
opt.cmdwinheight = 5 -- Command-line lines
opt.equalalways = true -- Resize windows on split or close
opt.colorcolumn = '+0' -- Column highlight at textwidth's max character-limit
opt.cursorline = true
opt.cursorlineopt = { 'number', 'screenline' }
opt.pumheight = 10 -- Maximum number of items to show in the popup menu
opt.pumwidth = 10 -- Minimum width for the popup menu
opt.pumblend = 10 -- Popup blend
-- autocommands
-- ===
local function augroup(name)
return vim.api.nvim_create_augroup("plex_" .. name, {})
end
-- highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = augroup "highlight_yank",
callback = function()
vim.highlight.on_yank()
end,
})
-- Disable conceallevel for specific file-types.
vim.api.nvim_create_autocmd('FileType', {
group = augroup('fix_conceallevel'),
pattern = { 'latex', 'tex' },
callback = function()
vim.opt_local.conceallevel = 0
end,
})
-- Resize splits if window got resized
vim.api.nvim_create_autocmd('VimResized', {
group = augroup('resize_splits'),
callback = function()
vim.cmd('wincmd =')
end,
})