starter/lua/config/keymaps.lua

31 lines
935 B
Lua
Raw Normal View History

2023-01-07 17:52:40 +08:00
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
2023-11-30 14:09:05 +08:00
function ToggleExpandTab()
2024-10-03 12:02:00 +08:00
local current_setting = vim.opt.expandtab:get()
vim.opt.expandtab = not current_setting
if vim.opt.expandtab:get() then
print("<C-t>: Spaces Enabled")
else
print("<C-t>: Tabs Enabled")
end
2023-11-30 14:09:05 +08:00
end
2024-10-03 12:02:00 +08:00
vim.api.nvim_set_keymap("n", "<C-t>", ":lua ToggleExpandTab()<CR>", { noremap = true, silent = true })
2023-11-30 14:09:05 +08:00
function ShowExpandTabStatus()
2024-10-03 12:02:00 +08:00
if vim.opt.expandtab:get() then
print("<C-t>: Spaces Enabled")
else
print("<C-t>: Tabs Enabled")
end
2023-11-30 14:09:05 +08:00
end
-----------------------------------------------------------
-- Startup
-----------------------------------------------------------
2024-10-03 12:02:00 +08:00
2023-11-30 14:09:05 +08:00
-- Delay the function call by 1000 milliseconds (1 second)
vim.defer_fn(ShowExpandTabStatus, 1000)