nvim/lua/editor.lua
2025-04-14 15:25:52 -04:00

93 lines
1.9 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

local cmd = vim.cmd
local opt = vim.opt
local g = vim.g
local indent = 2
cmd([[
filetype plugin indent on
]])
local augroup_name = 'CosmicNvimEditor'
local group = vim.api.nvim_create_augroup(augroup_name, { clear = true })
vim.api.nvim_create_autocmd('BufWritePre', {
command = [[%s/\s\+$//e]],
group = group,
})
g.mapleader = ' '
-- misc
opt.backspace = { 'eol', 'start', 'indent' }
opt.clipboard = 'unnamedplus'
opt.encoding = 'utf-8'
opt.matchpairs = { '(:)', '{:}', '[:]', '<:>' }
opt.syntax = 'enable'
opt.sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions'
-- indention
opt.autoindent = true
opt.expandtab = true
opt.shiftwidth = indent
opt.smartindent = true
opt.softtabstop = indent
opt.tabstop = indent
-- search
opt.hlsearch = true
opt.ignorecase = true
opt.smartcase = true
opt.wildignore = opt.wildignore + { '*/node_modules/*', '*/.git/*', '*/vendor/*' }
opt.wildmenu = true
-- ui
opt.cursorline = true
opt.laststatus = 2
--[[ opt.lazyredraw = true ]]
opt.list = true
opt.listchars = {
tab = '❘-',
trail = '·',
lead = '·',
extends = '»',
precedes = '«',
nbsp = '×',
}
opt.mouse = 'a'
opt.number = true
opt.rnu = true
opt.scrolloff = 18
opt.showmode = false
opt.sidescrolloff = 3 -- Lines to scroll horizontally
opt.signcolumn = 'yes'
opt.splitbelow = true -- Open new split below
opt.splitright = true -- Open new split to the right
opt.wrap = false
-- backups
opt.backup = false
opt.swapfile = false
opt.writebackup = false
-- autocomplete
opt.completeopt = { 'menu', 'menuone', 'noselect' }
opt.shortmess = opt.shortmess + { c = true }
-- perfomance
opt.redrawtime = 1500
opt.ttimeoutlen = 10
opt.updatetime = 100
-- theme
opt.termguicolors = true
-- filetypes
vim.filetype.add({
extension = {
vert = 'glsl',
frag = 'glsl',
xrl = 'erlang',
yrl = 'erlang',
src = 'erlang',
config = 'erlang',
},
})