use lua api to set commands

This commit is contained in:
siduck 2022-12-03 10:31:44 +05:30
parent d1e6b664e1
commit 8db69224ba
2 changed files with 28 additions and 11 deletions

View file

@ -34,6 +34,9 @@ if fn.empty(fn.glob(install_path)) > 0 then
vim.cmd "bw | silent! MasonInstallAll" -- close packer window vim.cmd "bw | silent! MasonInstallAll" -- close packer window
require("packer").loader "nvim-treesitter" require("packer").loader "nvim-treesitter"
local statusline_theme = require("core.utils").load_config().ui.statusline.theme
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. statusline_theme .. "').run()"
end, end,
}) })
end end

View file

@ -2,11 +2,31 @@
local is_windows = vim.loop.os_uname().sysname == "Windows_NT" local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "data" .. "/mason/bin" vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "data" .. "/mason/bin"
-- commands local new_cmd = vim.api.nvim_create_user_command
vim.cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
vim.cmd "silent! command! NvChadSnapshotCreate lua require('nvchad').snap_create()" new_cmd("CompileNvTheme", function()
vim.cmd "silent! command! NvChadSnapshotDelete lua require('nvchad').snap_delete()" require("base46").load_all_highlights()
vim.cmd "silent! command! NvChadSnapshotCheckout lua require('nvchad').snap_checkout()" end, {})
new_cmd("NvChadUpdate", function()
require("nvchad").update_nvchad()
end, {})
new_cmd("NvChadSnapshotCreate", function()
require("nvchad").snap_create()
end, {})
new_cmd("NvChadSnapshotDelete", function()
require("nvchad").snap_delete()
end, {})
new_cmd("NvChadSnapshotCheckout", function()
require("nvchad").snap_checkout()
end, {})
new_cmd("NvChadUpdate", function()
require("nvchad").update_nvchad()
end, {})
-- autocmds -- autocmds
local autocmd = vim.api.nvim_create_autocmd local autocmd = vim.api.nvim_create_autocmd
@ -25,9 +45,3 @@ autocmd("VimEnter", {
vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('plugins') require('core.utils').packer_sync(<f-args>)" vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('plugins') require('core.utils').packer_sync(<f-args>)"
end, end,
}) })
local new_cmd = vim.api.nvim_create_user_command
new_cmd("CompileNvTheme", function()
require("base46").load_all_highlights()
end, {})