parent
9a928f56a1
commit
c3d653c2c7
@ -1,37 +1,65 @@
|
||||
vim.cmd [[
|
||||
augroup _general_settings
|
||||
autocmd!
|
||||
autocmd FileType qf,help,man,lspinfo nnoremap <silent> <buffer> q :close<CR>
|
||||
autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200})
|
||||
autocmd BufWinEnter * :set formatoptions-=cro
|
||||
autocmd FileType qf set nobuflisted
|
||||
augroup end
|
||||
-- Autocommand that sources autocommands.lua whenever you save it
|
||||
local au_src = vim.api.nvim_create_augroup("autocommands_source", {clear = true})
|
||||
vim.api.nvim_create_autocmd(
|
||||
"BufWritePost",
|
||||
{group = au_src, pattern = "autocommands.lua", command = "luafile <afile>"}
|
||||
)
|
||||
|
||||
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
|
||||
augroup end
|
||||
local gen_opts = vim.api.nvim_create_augroup("_general_settings", {clear = true})
|
||||
vim.api.nvim_create_autocmd(
|
||||
"FileType", {group = gen_opts,
|
||||
pattern = {"qf","help","man","lspinfo"},
|
||||
command = "nnoremap <silent> <buffer> q <Cmd>close<CR>"}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
"TextYankPost", {group = gen_opts,
|
||||
command = "silent!lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})"}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
"FileType", {group = gen_opts,
|
||||
pattern = "qf",
|
||||
command = "set nobuflisted"}
|
||||
)
|
||||
|
||||
augroup _auto_resize
|
||||
autocmd!
|
||||
autocmd VimResized * tabdo wincmd =
|
||||
augroup end
|
||||
local au_git = vim.api.nvim_create_augroup("_git", {clear = true})
|
||||
vim.api.nvim_create_autocmd(
|
||||
"FileType", {group = au_git,
|
||||
pattern = "gitcommit",
|
||||
command = "setlocal wrap spell"}
|
||||
)
|
||||
|
||||
augroup _alpha
|
||||
autocmd!
|
||||
autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
|
||||
augroup end
|
||||
]]
|
||||
local au_mark = vim.api.nvim_create_augroup("_markdown", {clear = true})
|
||||
vim.api.nvim_create_autocmd(
|
||||
"FileType", {group = au_mark,
|
||||
pattern = "markdown",
|
||||
command = "setlocal wrap spell"}
|
||||
)
|
||||
|
||||
local au_res = vim.api.nvim_create_augroup("_auto_resize", {clear = true})
|
||||
vim.api.nvim_create_autocmd(
|
||||
"VimResized", {group = au_res, command = "tabdo wincmd ="}
|
||||
)
|
||||
|
||||
-- Autoformat
|
||||
-- augroup _lsp
|
||||
-- local au_lsp = vim.api.nvim_create_augroup("_lsp", {clear = true})
|
||||
-- vim.api.nvim_create_autocmd(
|
||||
-- "BufWritePre", {group = au_lsp, command = "lua vim.lsp.buf.formatting()"}
|
||||
-- )
|
||||
|
||||
-- Using <Bar> instead of | caused my neovim to either error out or remove tabline completely
|
||||
-- Which is really weird and must be a bug
|
||||
-- If it still happens to you anyways, use vim.cmd as a fallback
|
||||
local aulpha = vim.api.nvim_create_augroup("_alpha", {clear = true})
|
||||
vim.api.nvim_create_autocmd(
|
||||
"User", {group = aulpha, pattern = "AlphaReady",
|
||||
command = "set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2"
|
||||
}
|
||||
)
|
||||
-- autocmd! remove all autocommands, if entered under a group it will clear that group
|
||||
-- vim.cmd [[
|
||||
-- augroup _alpha
|
||||
-- autocmd!
|
||||
-- autocmd BufWritePre * lua vim.lsp.buf.formatting()
|
||||
-- autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
|
||||
-- augroup end
|
||||
-- ]]
|
||||
|
Loading…
Reference in new issue