mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-12-23 16:06:48 +00:00
46 lines
1.1 KiB
Lua
46 lines
1.1 KiB
Lua
|
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,
|
||
|
})
|
||
|
|
||
|
-- Set options by FileType
|
||
|
|
||
|
-- Set wrap and spell in markdown and gitcommit
|
||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||
|
pattern = { "gitcommit", "markdown" },
|
||
|
callback = function()
|
||
|
vim.opt_local.wrap = true
|
||
|
vim.opt_local.spell = true
|
||
|
end,
|
||
|
})
|
||
|
|
||
|
-- Set wrap and spell in markdown and gitcommit
|
||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||
|
pattern = { "go", "makefile", "lua" },
|
||
|
callback = function()
|
||
|
vim.opt_local.expandtab = false
|
||
|
end,
|
||
|
})
|
||
|
|
||
|
-- 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,
|
||
|
})
|