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
vim.g.mapleader = " "
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- vim.g.loaded_netrw = 0
-- vim.g.loaded_netrwPlugin = 0
-- bootstrap & set up lazy
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
@ -39,6 +39,24 @@ require("lazy").setup("plugins", {
require("options")
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
vim.api.nvim_create_augroup("highlight_yank", {})
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
@ -51,7 +69,6 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, {
})
end,
})
-- Disable semantic highlights
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
@ -59,7 +76,6 @@ vim.api.nvim_create_autocmd("LspAttach", {
client.server_capabilities.semanticTokensProvider = nil
end,
})
-- Stop comments on new lines when pressing 'o'
vim.api.nvim_create_augroup("stop_comments_on_o", {})
vim.api.nvim_create_autocmd("BufEnter", {
@ -68,3 +84,14 @@ vim.api.nvim_create_autocmd("BufEnter", {
vim.opt.formatoptions:remove("o")
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