Refactor configuration.
This commit is contained in:
25
lua/core/autocmds.lua
Normal file
25
lua/core/autocmds.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.cmd [[
|
||||
hi Normal guibg=none ctermbg=none
|
||||
hi NonText guibg=none ctermbg=none
|
||||
hi NormalFloat guibg=none ctermbg=none
|
||||
]]
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*.ts", "*.tsx" },
|
||||
command = "compiler tsc"
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = "*.go",
|
||||
command = "Tabs 4"
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = "*.rs",
|
||||
command = "compiler cargo"
|
||||
})
|
||||
26
lua/core/commands.lua
Normal file
26
lua/core/commands.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
local function indent(n, expand)
|
||||
local size = 4
|
||||
if n ~= "" then size = n end
|
||||
|
||||
local num = tonumber(size)
|
||||
if num then
|
||||
size = num
|
||||
end
|
||||
|
||||
vim.o.expandtab = expand
|
||||
vim.o.shiftwidth = size
|
||||
vim.o.tabstop = size
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("Tabs", function(v)
|
||||
indent(v.args, false)
|
||||
end, { nargs = "?" })
|
||||
|
||||
vim.api.nvim_create_user_command("Spaces", function(v)
|
||||
indent(v.args, true)
|
||||
end, { nargs = "?" })
|
||||
|
||||
vim.api.nvim_create_user_command("TE", function(v)
|
||||
vim.cmd("split")
|
||||
vim.cmd("term " .. v.args)
|
||||
end, { nargs = "*", force = true })
|
||||
Reference in New Issue
Block a user