mirror of https://github.com/LazyVim/starter
[add] c-t for tabs or spaces control
parent
c42b20750a
commit
982064ea20
|
@ -1,3 +1,31 @@
|
|||
-- 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
|
||||
|
||||
function ToggleExpandTab()
|
||||
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
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<C-t>', ':lua ToggleExpandTab()<CR>', { noremap = true, silent = true })
|
||||
|
||||
function ShowExpandTabStatus()
|
||||
if vim.opt.expandtab:get() then
|
||||
print("<C-t>: Spaces Enabled")
|
||||
else
|
||||
print("<C-t>: Tabs Enabled")
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- Startup
|
||||
-----------------------------------------------------------
|
||||
-- Delay the function call by 1000 milliseconds (1 second)
|
||||
vim.defer_fn(ShowExpandTabStatus, 1000)
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ opt.laststatus=3 -- Set global statusline
|
|||
-----------------------------------------------------------
|
||||
-- Tabs, indent
|
||||
-----------------------------------------------------------
|
||||
opt.expandtab = true -- Use spaces instead of tabs
|
||||
opt.expandtab = false -- Use spaces instead of tabs
|
||||
opt.shiftwidth = 4 -- Shift 4 spaces when tab
|
||||
opt.tabstop = 4 -- 1 tab == 4 spaces
|
||||
opt.smartindent = true -- Autoindent new lines
|
||||
|
@ -56,38 +56,3 @@ opt.updatetime = 250 -- ms to wait for trigger an event
|
|||
-----------------------------------------------------------
|
||||
-- Startup
|
||||
-----------------------------------------------------------
|
||||
-- Disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
|
||||
-- -- Disable builtin plugins
|
||||
local disabled_built_ins = {
|
||||
"2html_plugin",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"gzip",
|
||||
"logipat",
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"matchit",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tutor",
|
||||
"rplugin",
|
||||
"synmenu",
|
||||
"optwin",
|
||||
"compiler",
|
||||
"bugreport",
|
||||
"ftplugin",
|
||||
}
|
||||
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue