81 lines
2.7 KiB
Lua
81 lines
2.7 KiB
Lua
-- reduce boilerplate by defining some shortcuts
|
||
local opt = vim.opt
|
||
local cmd = vim.cmd
|
||
local autocmd = vim.api.nvim_create_autocmd
|
||
|
||
--------------------
|
||
-- General
|
||
--------------------
|
||
opt.mouse = 'n' -- enable mouse support in normal mode
|
||
opt.clipboard = 'unnamedplus' -- copy/paste to and from system clipboard
|
||
|
||
opt.wildmode = 'list:longest,full'
|
||
opt.wildignorecase = true
|
||
-- ignore C/C++ objects and other build files
|
||
opt.wildignore = '*.o,*.so,*.out'
|
||
-- ignore java classes
|
||
opt.wildignore:append '*.class'
|
||
-- ignore python cache files
|
||
opt.wildignore:append '*.pyc'
|
||
-- ignore tex-related build files
|
||
opt.wildignore:append '*.aux,*.bcf,*.lof,*.lol,*.lot,*.rubbercache,*.toc,*.pdf'
|
||
|
||
opt.fileformats = 'unix,dos' -- use identical lineendings for all platforms
|
||
opt.secure = true -- disable autocmd for security reasons
|
||
|
||
--------------------
|
||
-- Tabs
|
||
--------------------
|
||
opt.tabstop = 4 -- 1 tab == N spaces
|
||
opt.shiftwidth = 4 -- shift N spaces when pressing tab
|
||
opt.smartindent = true -- take syntax into account for applying indentation
|
||
|
||
--------------------
|
||
-- Search
|
||
--------------------
|
||
opt.ignorecase = true -- ignore capitalization on search
|
||
opt.smartcase = true -- ignore capitalication unless word contains a capital
|
||
|
||
opt.iskeyword:append '-' -- treat hyphenated words as a single word
|
||
|
||
--------------------
|
||
-- Neovim UI
|
||
--------------------
|
||
opt.number = true -- line numbers
|
||
opt.ruler = true -- cursor position in statusbar
|
||
opt.showtabline = 2 -- always show vim tabs
|
||
opt.showcmd = true -- display currently typed command
|
||
opt.termguicolors = true -- enable 24-bit RGB color
|
||
|
||
-- highlight line at which the cursor is positioned
|
||
opt.cursorline = true
|
||
cmd 'highlight CursorLine term=bold cterm=bold'
|
||
cmd 'highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey'
|
||
|
||
-- display warning column at 81 and 121
|
||
opt.colorcolumn = '81,121'
|
||
cmd 'highlight ColorColumn ctermbg=235 guibg=#2d2d2d'
|
||
|
||
opt.splitright = true -- horizontal split to the right
|
||
opt.splitbelow = true -- vertical split to the bottom
|
||
|
||
-- define characters to display when using 'set list'
|
||
opt.listchars = 'tab:→ ,trail:∙,eol:¬,extends:❯,precedes:❮,nbsp:␣'
|
||
|
||
--------------------
|
||
-- Performance
|
||
--------------------
|
||
opt.hidden = true -- allow buffers with changes to be hidden
|
||
opt.updatetime = 300 -- delay (in ms) to wait before triggering event
|
||
opt.timeoutlen = 500 -- time (in ms) to wait for event to complete
|
||
opt.history = 10000 -- remember N lines of history
|
||
|
||
--------------------
|
||
-- Misc
|
||
--------------------
|
||
|
||
-- remove redundant whitespaces on save
|
||
autocmd('BufWritePre', {
|
||
pattern = '*',
|
||
command = ':%s/\\s\\+$//e'
|
||
})
|