nvim-config/lua/config/options.lua
2025-10-22 17:57:07 +03:00

109 lines
2.8 KiB
Lua

-- Map Leader
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Disable built-in plugins
vim.loader.enable()
vim.g.loaded_gzip = 1
vim.g.loaded_tar = 1
vim.g.loaded_tarPlugin = 1
vim.g.loaded_zip = 1
vim.g.loaded_zipPlugin = 1
vim.g.loaded_getscript = 1
vim.g.loaded_getscriptPlugin = 1
vim.g.loaded_vimball = 1
vim.g.loaded_vimballPlugin = 1
vim.g.loaded_matchit = 1
vim.g.loaded_2html_plugin = 1
vim.g.loaded_rrhelper = 1
vim.g.loaded_netrw = 1 -- use nvim-tree instead
vim.g.loaded_netrwPlugin = 1
-- UI
vim.g.health = { style = 'float' }
vim.g.have_nerd_font = true
vim.opt.termguicolors = false
vim.opt.textwidth = 100
vim.opt.colorcolumn = '+0'
vim.opt.signcolumn = 'no'
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.winborder = 'rounded'
vim.opt.guicursor = 'n-v-i-c:block'
vim.opt.ruler = false
vim.opt.laststatus = 3
vim.opt.statusline = '── %f %h%w%m%r %= [%l,%c-%L] ──'
vim.opt.fillchars = {
stl = '',
stlnc = '',
horiz = '',
horizdown = '',
horizup = '',
vert = '',
vertleft = '',
vertright = '',
verthoriz = '',
}
-- Wrap
vim.opt.wrap = false
vim.opt.linebreak = true
vim.opt.breakindent = true
-- Indent
vim.opt.shiftwidth = 2 -- Number of spaces to use for (auto)indent
vim.opt.tabstop = 2 -- Number of spaces that a <Tab> in file counts for
vim.opt.softtabstop = 2 -- Number of spaces when pressing <Tab> in insert mode
vim.opt.expandtab = true -- Use spaces instead of literal tab characters
vim.opt.autoindent = true -- Copy indent from the current line when starting a new one
vim.opt.smartindent = true -- Automatically inserts indents in code blocks (for C-like languages)
-- Scroll and mouse
vim.opt.scrolloff = 10
vim.opt.sidescrolloff = 5
vim.opt.mousescroll = 'hor:1,ver:5'
vim.opt.mouse = 'a' -- Enable mouse support
-- Search
vim.opt.ignorecase = true
vim.opt.smartcase = true -- Override ignorecase if search contains upper case chars
vim.opt.inccommand = 'split' -- Live substitution preview
vim.opt.completeopt = { 'menu,menuone,noselect' }
-- Splits
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Persistence
vim.opt.undofile = true
vim.opt.swapfile = false
-- Tweaks
vim.opt.updatetime = 1000
vim.opt.timeout = true
vim.opt.ttimeout = true
vim.opt.timeoutlen = 500
vim.opt.ttimeoutlen = 10
vim.keymap.set('n', '<leader>d', vim.diagnostic.open_float, { noremap = true, silent = true })
vim.diagnostic.config({
update_in_insert = false,
virtual_text = {
prefix = '', -- remove annoying ▎ etc
format = function(diagnostic)
if diagnostic.source then
return string.format('[%s] %s', diagnostic.source, diagnostic.message)
end
return diagnostic.message
end,
},
float = {
border = 'rounded',
source = true, -- show source in floating window too
},
severity_sort = true,
})