dotfiles/.config/nvim/lua/settings.lua

40 lines
1.1 KiB
Lua

vim.o.number = true -- line numbers
vim.o.list = true -- show whitespace
vim.o.colorcolumn = '80' -- line length marker (comma sep.)
vim.o.wrap = false
vim.o.expandtab = true -- indent using spaces
vim.o.tabstop = 4 -- 1 tab = 4 spaces
vim.o.shiftwidth = 4 -- 1 indentation = 4 spaces
vim.o.completeopt = 'menu,menuone,noselect' -- completion popup
-- theme
vim.o.termguicolors = true -- 24 bit colours
vim.o.background = 'dark'
packer.use {
'https://github.com/owozsh/amora',
config = function()
vim.cmd('colorscheme amora')
end
}
use 'https://github.com/tpope/vim-commentary' -- toggle comments
-- remove trailing whitespace
function remove_trailing_whitespace()
local curpos = vim.api.nvim_win_get_cursor(0)
vim.cmd([[keeppatterns %s/\s\+$//e]])
vim.api.nvim_win_set_cursor(0, curpos)
end
vim.api.nvim_create_autocmd(
{ "BufWritePre" },
{
pattern = {
"*.lua", "*.cpp", "*.hpp"
},
command = 'lua remove_trailing_whitespace()'
}
)