nvim/plugin/settings.lua

141 lines
4.6 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
vim.opt.listchars = {
-- Circled Reverse Solidus (U+29B8, utf-8: E2 A6 B8)
nbsp = '',
-- Middle Dot (U+00B7, utf-8: C2 B7)
trail = '·',
-- 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)
tab = '▹┄',
-- Right-Pointing Double Angle Quotation Mark (U+00BB, utf-8: C2 BB)
extends = '»',
-- Left-Pointing Double Angle Quotation Mark (U+00AB, utf-8: C2 AB)
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
-- Set fold level to something high
vim.opt.foldlevel = 20
vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
vim.opt.fillchars = 'fold: '
-- FIXME: Replace this with transparent fold text in 0.10
-- https://github.com/neovim/neovim/pull/20750
function _G.fold_text()
return vim.fn.getline(vim.v.foldstart)
end
vim.opt.foldtext = 'v:lua.fold_text()'
-- 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
vim.opt.diffopt:append('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'
-- Avoid prompts and short/remove messages
-- f use "(3 of 5)" instead of "(file 3 of 5)"
-- i use "[noeol]" instead of "[Incomplete last line]"
-- l use "999L, 888B" instead of "999 lines, 888 bytes"
-- n use "[New]" instead of "[New File]"
-- x use "[dos]" instead of "[dos format]", "[unix]" instead of
-- "[unix format]" and "[mac]" instead of "[mac format]"
-- o overwrite message for writing a file with subsequent message for reading
-- a file (useful for ":wn" or when 'autowrite' on)
-- O message for reading a file overwrites any previous message; also for
-- quickfix message (e.g., ":cn")
-- t truncate file message at the start if it is too long to fit on the
-- command-line, "<" will appear in the left most column; ignored in
-- Ex mode
-- T truncate other messages in the middle if they are too long to fit on
-- the command line; "..." will appear in the middle; ignored in Ex mode
-- I don't give the intro message when starting Vim, see :intro
-- F don't give the file info when editing a file, like `:silent` was used
-- for the command
vim.opt.shortmess = 'filnxoOtTIF'