refactored plugins and configurations
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
-- General UX
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
-- Highlight on yank
|
||||
augroup("YankHighlight", { clear = true })
|
||||
autocmd("TextYankPost", {
|
||||
@@ -72,13 +76,17 @@ autocmd("BufWritePre", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
-- Filetype-specific settings
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
-- Set specific options for certain filetypes
|
||||
augroup("FileTypeSettings", { clear = false })
|
||||
augroup("FileTypeSettings", { clear = true })
|
||||
|
||||
-- Go files: use tabs
|
||||
-- Go + Makefile files: use tabs
|
||||
autocmd("FileType", {
|
||||
group = "FileTypeSettings",
|
||||
pattern = "go",
|
||||
pattern = { "go", "make" },
|
||||
callback = function()
|
||||
vim.opt_local.expandtab = false
|
||||
vim.opt_local.tabstop = 4
|
||||
@@ -86,18 +94,7 @@ autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Makefile: use tabs
|
||||
autocmd("FileType", {
|
||||
group = "FileTypeSettings",
|
||||
pattern = "make",
|
||||
callback = function()
|
||||
vim.opt_local.expandtab = false
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
end,
|
||||
})
|
||||
|
||||
-- Markdown: enable wrap
|
||||
-- Markdown: soft wrap + spell
|
||||
autocmd("FileType", {
|
||||
group = "FileTypeSettings",
|
||||
pattern = "markdown",
|
||||
@@ -107,6 +104,19 @@ autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- SQL family: skip autoformat-on-save (LazyVim's pipeline respects vim.b.autoformat)
|
||||
autocmd("FileType", {
|
||||
group = "FileTypeSettings",
|
||||
pattern = { "sql", "mysql", "plsql" },
|
||||
callback = function()
|
||||
vim.b.autoformat = false
|
||||
end,
|
||||
})
|
||||
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
-- Project / tooling hints
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
autocmd("DirChanged", {
|
||||
callback = function()
|
||||
if vim.fn.filereadable(".devcontainer/devcontainer.json") == 1 then
|
||||
@@ -122,21 +132,7 @@ autocmd("BufRead", {
|
||||
local name = vim.fn.fnamemodify(args.file, ":t")
|
||||
vim.notify(
|
||||
"Generated " .. name .. ". Use: `go tool pprof -http=:0 " .. name .. "` or `go tool trace " .. name .. "`",
|
||||
vim.log.levels.INFO)
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
end,
|
||||
})
|
||||
|
||||
-- SQL files
|
||||
-- autocmd("FileType", {
|
||||
-- pattern = { "sql", "mysql", "plsql" },
|
||||
-- callback = function()
|
||||
-- local cmp = require("cmp")
|
||||
-- cmp.setup.buffer({
|
||||
-- sources = {
|
||||
-- { name = "vim-dadbod" },
|
||||
-- { name = "nvim_lsp" },
|
||||
-- { name = "buffer" },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
Reference in New Issue
Block a user