nvim/lua/config/settings.lua

93 lines
2.5 KiB
Lua

local g = vim.g
local opt = vim.opt
local function add(value, str, sep)
sep = sep or ','
str = str or ''
value = type(value) == 'table' and table.concat(value, sep) or value
return str ~= '' and table.concat({ value, str }, sep) or value
end
-- local disabled_built_ins = {
-- -- 'netrw',
-- -- 'netrwPlugin',
-- -- 'netrwSettings',
-- -- 'netrwFileHandlers',
-- -- 'getscript',
-- -- 'getscriptPlugin',
-- 'vimball',
-- 'vimballPlugin',
-- '2html_plugin',
-- 'logipat',
-- 'rrhelper',
-- -- 'spellfile_plugin',
-- 'matchit',
-- }
-- for _, plugin in pairs(disabled_built_ins) do
-- g['loaded_' .. plugin] = 1
-- end
-- Globals {{{
-- g.do_filetype_lua = 1
-- g.did_load_filetypes = 0
g.netrw_liststyle = 1
g.netrw_banner = 0
g.mapleader = ' '
g.tex_flavor = 'latex'
-- }}}
-- Opts {{{
-- opt.formatoptions = ""
opt.termguicolors = true
opt.guifont = 'JetBrainsMono Nerd Font'
opt.guicursor = 'n-v-c-sm:hor20,i-ci-ve:ver20,r-cr-o:Block'
opt.mouse = 'vn'
opt.path = '.,,**h'
opt.pumheight = 10
opt.fileencoding = 'utf-8'
opt.splitbelow = true
opt.splitright = true
opt.ts = 4
opt.sw = 4
opt.smartindent = true
--opt.expandtab " Converts tabs to spaces
opt.showmode = false
opt.undofile = true
opt.updatetime = 300
opt.backup = false
opt.clipboard:prepend { 'unnamedplus' }
opt.smartcase = true
opt.cursorline = true
opt.viewoptions = 'folds,cursor'
opt.sessionoptions = 'folds'
opt.foldmethod = 'marker'
opt.foldlevel = 0
opt.number = true
opt.hidden = true
-- opt.shortmess = add { 'I' } -- Don't pass messages to ins-completion-menu.
opt.shortmess = {
I = true,
o = true,
}
opt.cmdheight = 0
opt.scrolloff = 15
opt.iskeyword:prepend { '-' }
opt.inccommand = 'nosplit'
opt.completeopt = { 'menu', 'menuone', 'noselect' }
opt.timeoutlen = 300
opt.conceallevel = 0
opt.concealcursor = 'n'
opt['foldenable'] = false
-- opt.fillchars = 'vert:▏'
opt.fillchars.eob = ' '
-- opt.fillchars.vert="▏"
opt.sessionoptions = add { 'options', 'resize', 'winpos', 'terminal' }
opt.autochdir = false
-- }}}
-- Commands and autocommands {{{
vim.api.nvim_create_user_command('Pdf', '!pandoc % -o %:r.pdf', { nargs = 0 })
vim.api.nvim_create_user_command('Slide', '!pandoc -t beamer % -o %:r.pdf', { nargs = 0 })
vim.api.nvim_create_user_command('Cd', 'lcd %:p:h', { nargs = 0 })
vim.api.nvim_create_autocmd({ 'BufReadPost' }, { pattern = { '*' }, command = 'silent! g`"zz' })
vim.api.nvim_create_autocmd({ 'BufWinLeave' }, { pattern = { '?*' }, command = 'mkview' })
vim.api.nvim_create_autocmd({ 'BufReadPost' }, { pattern = { '?*' }, command = 'silent! loadview' })
-- }}}