feat(nvim): add autocmds to disable mini plugins

chezmoi
sgoudham 2 years ago
parent 43fbfae7d6
commit 96d3be500b
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -1,8 +1,8 @@
-- set this early so plugins etc can all use it -- set this early so plugins etc can all use it
vim.g.mapleader = " " vim.g.mapleader = " "
-- disable netrw at the very start of your init.lua (strongly advised) -- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1 -- vim.g.loaded_netrw = 0
vim.g.loaded_netrwPlugin = 1 -- vim.g.loaded_netrwPlugin = 0
-- bootstrap & set up lazy -- bootstrap & set up lazy
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
@ -39,6 +39,24 @@ require("lazy").setup("plugins", {
require("options") require("options")
require("binds") require("binds")
vim.api.nvim_create_augroup("disable_mini", {})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
group = "disable_mini",
pattern = { "NvimTr*" },
callback = function()
vim.b.miniindentscope_disable = true
vim.b.minicursorword_disable = true
end,
})
vim.api.nvim_create_autocmd({ "User" }, {
group = "disable_mini",
pattern = "AlphaReady",
callback = function()
vim.b.miniindentscope_disable = true
vim.b.minicursorword_disable = true
end,
})
-- highlight yank -- highlight yank
vim.api.nvim_create_augroup("highlight_yank", {}) vim.api.nvim_create_augroup("highlight_yank", {})
vim.api.nvim_create_autocmd({ "TextYankPost" }, { vim.api.nvim_create_autocmd({ "TextYankPost" }, {
@ -51,7 +69,6 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, {
}) })
end, end,
}) })
-- Disable semantic highlights -- Disable semantic highlights
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args) callback = function(args)
@ -59,7 +76,6 @@ vim.api.nvim_create_autocmd("LspAttach", {
client.server_capabilities.semanticTokensProvider = nil client.server_capabilities.semanticTokensProvider = nil
end, end,
}) })
-- Stop comments on new lines when pressing 'o' -- Stop comments on new lines when pressing 'o'
vim.api.nvim_create_augroup("stop_comments_on_o", {}) vim.api.nvim_create_augroup("stop_comments_on_o", {})
vim.api.nvim_create_autocmd("BufEnter", { vim.api.nvim_create_autocmd("BufEnter", {
@ -68,3 +84,14 @@ vim.api.nvim_create_autocmd("BufEnter", {
vim.opt.formatoptions:remove("o") vim.opt.formatoptions:remove("o")
end, end,
}) })
vim.api.nvim_create_augroup("last_loc", {})
vim.api.nvim_create_autocmd("BufReadPost", {
group = "last_loc",
callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})

Loading…
Cancel
Save