52 lines
1.3 KiB
Lua
52 lines
1.3 KiB
Lua
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = '#282828' })
|
|
vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'NONE' })
|
|
vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'NONE' })
|
|
|
|
-- Use 'q' to quit from common plugins
|
|
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
|
pattern = { 'qf', 'help', 'man', 'lspinfo', 'spectre_panel', 'lir' },
|
|
callback = function()
|
|
vim.cmd [[
|
|
nnoremap <silent> <buffer> q :close<CR>
|
|
set nobuflisted
|
|
]]
|
|
end,
|
|
})
|
|
|
|
-- use 2 spaces for cpp
|
|
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
|
pattern = { 'cpp', 'cc', 'hpp', 'hh', 'md', 'markdown' },
|
|
callback = function()
|
|
vim.opt.ts = 2
|
|
vim.opt.sw = 2
|
|
vim.opt.expandtab = true
|
|
end,
|
|
})
|
|
|
|
vim.cmd "autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"
|
|
|
|
-- Fixes Autocomment
|
|
vim.api.nvim_create_autocmd({ 'BufWinEnter' }, {
|
|
callback = function()
|
|
vim.cmd 'set formatoptions-=cro'
|
|
end,
|
|
})
|
|
|
|
-- Highlight Yanked Text
|
|
vim.api.nvim_create_autocmd({ 'TextYankPost' }, {
|
|
callback = function()
|
|
vim.highlight.on_yank { higroup = 'Visual', timeout = 200 }
|
|
end,
|
|
})
|
|
|
|
vim.api.nvim_create_augroup('diagnostics', { clear = true })
|
|
|
|
vim.api.nvim_create_autocmd({ 'DiagnosticChanged' }, {
|
|
group = 'diagnostics',
|
|
callback = function()
|
|
vim.diagnostic.setloclist { open = false }
|
|
end,
|
|
})
|
|
|
|
vim.cmd [[autocmd BufWinEnter quickfix silent :lua ToggleTroubleAuto()]]
|