formatting/linting added for lua/ts

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-05-02 12:33:00 -05:00
parent e54f6ee975
commit 61d3aec608
18 changed files with 338 additions and 710 deletions

View file

@ -1,9 +1,10 @@
local group = vim.api.nvim_create_augroup("myconfig-autocommands-group", { clear = true });
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd("TextYankPost", {
group = group,
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("config-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank({ timeout = 300 })
end,
@ -11,24 +12,29 @@ vim.api.nvim_create_autocmd("TextYankPost", {
-- TODO is there a better way for these?
vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = ".env*",
command = "set filetype=sh",
})
vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = ".*rc",
command = "set filetype=sh",
})
vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = "Dockerfile.*",
command = "set filetype=dockerfile",
})
vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = "*.http",
command = "set filetype=http",
})
-- Auto exit insert mode whenever we switch screens
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
group = group,
callback = function()
if vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then
vim.api.nvim_command("stopinsert")
@ -37,12 +43,14 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
})
vim.api.nvim_create_autocmd("VimLeavePre", {
group = group,
callback = function()
vim.cmd("NvimTreeClose")
-- Close all buffers with the 'httpResult' type
local close_types = { "httpResult", "noice", "help" }
local buffers = vim.api.nvim_list_bufs()
for _, bufnr in ipairs(buffers) do
if vim.bo[bufnr].filetype == "httpResult" then
if U.table_contains(close_types, vim.bo[bufnr].filetype) then
vim.api.nvim_buf_delete(bufnr, { force = true })
end
end