jones-nvim-config/lua/custom/options.lua

35 lines
688 B
Lua
Raw Normal View History

2024-07-29 18:22:28 +00:00
local opt = vim.opt
local api = vim.api
-- line numbers
opt.number = true
-- tabs & indentation
opt.tabstop = 4
opt.shiftwidth = 4
opt.expandtab = true
opt.autoindent = true
opt.softtabstop = 2
-- lne wrapping
opt.wrap = false
-- search settings
opt.ignorecase = true
opt.smartcase = true
-- cursor line
opt.cursorline = true
-- backspace
opt.backspace = "indent,eol,start"
-- Show trailing whitespace
api.nvim_set_option("list", true)
api.nvim_set_option("listchars", "eol:$,nbsp:_,tab:>-,trail:~,extends:>,precedes:<")
-- remove whitespace on save
api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = { "*" },
command = [[if &filetype !~# 'lsp' | %s/\s\+$//e | endif]],
})