nvim/lua/settings.lua

102 lines
3.1 KiB
Lua

-- Disable unused language providers
vim.g.loaded_node_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_ruby_provider = 0
-- Keep cursor from buffer edges
vim.opt.sidescrolloff = 5
-- Enable visually highlighting listchars
vim.opt.list = true
-- Customize the listchars display strings
-- nbsp: Circled Reverse Solidus (U+29B8, utf-8: E2 A6 B8)
-- trail: Middle Dot (U+00B7, utf-8: C2 B7)
-- tab: White Right-Pointing Small Triangle (U+25B9, utf-8: E2 96 B9)
-- Box Drawings Light Triple Dash Horizontal (U+2504, utf-8: E2 94 84)
-- extends: Right-Pointing Double Angle Quotation Mark (U+00BB, utf-8: C2 BB)
-- precedes: Left-Pointing Double Angle Quotation Mark (U+00AB, utf-8: C2 AB)
vim.opt.listchars = 'nbsp:⦸,trail:·,tab:▹┄,extends:»,precedes:«'
-- Wrap lines which are longer than screen width
vim.opt.wrap = true
-- Break wrapped lines at a character in breakat
vim.opt.linebreak = true
-- Downwards Arrow With Tip Rightwards (U+21B3, utf-8: E2 86 B3)
vim.opt.showbreak = ''
-- TODO: spellcapcheck
-- TODO: virtualedit=block
-- TODO: whichwrap=b,h,l,s,<,>,[,],~
-- Don't show completeopt preview buffer
vim.opt.completeopt = 'menu'
-- Set window title to titlestring
vim.opt.title = true
-- Don't show mode in command line
vim.opt.showmode = false
-- Enable line numbers & use relative line number for current line
vim.opt.number = true
vim.opt.relativenumber = true
-- Turn backup off
vim.opt.backup = false
vim.opt.swapfile = false
vim.opt.writebackup = false
-- Highlight search matches & show search matches while typing
vim.opt.hlsearch = true
vim.opt.incsearch = true
-- Set ignore search case unless mixed
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Don't ignore case in command line file completions
vim.opt.fileignorecase = false
-- Allow buffers with changes to be hidden
vim.opt.hidden = true
-- Open new splits on the other side of the axis
vim.opt.splitbelow = true
vim.opt.splitright = true
-- Use existing windows and tabs when jumping to errors
vim.opt.switchbuf = 'usetab'
-- Automatically write changes to files
vim.opt.autowrite = true
-- Don't add 2 spaces after end of sentence
vim.opt.joinspaces = false
-- Enable all mouse features
vim.opt.mouse = 'a'
-- Always display the sign column
vim.opt.signcolumn = 'yes'
-- When in diff mode, use the patience algorithm for more readable diffs
-- FIXME: vim.opt.diffopt = vim.opt.diffopt .. ',algorithm:patience'
-- Insert spaces when <Tab> is pressed in insert mode
vim.opt.expandtab = true
-- Use 2 space tabs by default
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
-- Do smart autoindenting when starting a new line
vim.opt.smartindent = true
-- Customize how re-indented lines behave a C language files
-- N-s - don't indent inside C++ namespace
-- E-s - don't indent inside C++ extern "C"
-- g1 - indent scope declarations {public,private,protected} 1 space
-- h1 - indent statements after scope declarations 1 space more
-- l1 - indent case statement scopes with the case label
-- (0,W4 - indent inside unclosed parenthesis
-- i2 - indent C++ class base declarations and constructor initializers
vim.opt.cinoptions = 'N-sE-sg1h1l1(0,W4i2'