Renamed autocmd to cmd and made a custom user cmd
This commit is contained in:
30
lua/taken/core/cmd.lua
Normal file
30
lua/taken/core/cmd.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local cmd = vim.api.nvim_create_user_command
|
||||
-- Groups
|
||||
local nvimhelp = augroup("help_window_right", {})
|
||||
local mkdirrun = augroup("MkdirRun", { clear = true })
|
||||
|
||||
cmd("ThemeSwitcher", function()
|
||||
require("taken.functions.themes").themeselector()
|
||||
end, {
|
||||
desc = "Select a theme",
|
||||
})
|
||||
|
||||
autocmd("BufWinEnter", {
|
||||
group = nvimhelp,
|
||||
pattern = { "*.txt" },
|
||||
callback = function()
|
||||
if vim.o.filetype == "help" then
|
||||
vim.cmd.wincmd("L")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd("BufWritePre", {
|
||||
group = mkdirrun,
|
||||
pattern = { "*" },
|
||||
callback = function()
|
||||
require("taken.functions.mkdir").run()
|
||||
end,
|
||||
})
|
||||
Reference in New Issue
Block a user