diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-03-19 14:27:18 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-03-19 14:27:18 -0500 |
commit | 209c15c008251cd96f0d4ae6a4c797a1ccb1e9bd (patch) | |
tree | e4bc0a7e2a0aea5c1901423910d88ebc72e35d82 /nvim/lua/autocommands.lua | |
parent | 95d6897c7ae05074a4c034d180c834c8534a2582 (diff) |
feat: nvim working mostly
Diffstat (limited to 'nvim/lua/autocommands.lua')
-rw-r--r-- | nvim/lua/autocommands.lua | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/nvim/lua/autocommands.lua b/nvim/lua/autocommands.lua new file mode 100644 index 0000000..c87fb70 --- /dev/null +++ b/nvim/lua/autocommands.lua @@ -0,0 +1,55 @@ +-- to Show whitespace, MUST be inserted BEFORE the colorscheme command +vim.cmd [[ + augroup _general_settings + autocmd! + autocmd FileType qf,help,man,lspinfo,spectre_panel nnoremap <silent> <buffer> q :close<CR> + autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200}) + autocmd BufWritePre * :%s/\s\+$//e + autocmd BufWinEnter * :set formatoptions-=cro + autocmd BufEnter * set fo-=c fo-=r fo-=o + autocmd FileType qf set nobuflisted + autocmd CmdWinEnter * quit + autocmd FileType xml,html,xhtml,css,scss,javascript,lua,dart setlocal shiftwidth=2 tabstop=2 + autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + augroup end + + augroup format_on_save + autocmd! + autocmd BufWritePre * lua vim.lsp.buf.formatting() + augroup end + + augroup _git + autocmd! + autocmd FileType gitcommit setlocal wrap + autocmd FileType gitcommit setlocal spell + augroup end + + augroup _markdown + autocmd! + autocmd FileType markdown setlocal wrap + autocmd FileType markdown setlocal spell + autocmd BufNewFile,BufRead *.mdx set filetype=markdown + augroup end + + augroup _latex + autocmd! + autocmd FileType latex,tex,plaintex setlocal wrap + autocmd FileType latex,tex,plaintex setlocal spell + autocmd FileType latex,tex,plaintex setlocal linebreak + augroup end + + augroup _json + autocmd! + autocmd BufEnter *.json set ai expandtab shiftwidth=2 tabstop=2 sta fo=croql + augroup end + + augroup _auto_resize + autocmd! + autocmd VimResized * tabdo wincmd = + augroup end + + augroup _alpha + autocmd! + autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2 + augroup end +]] |