turn off different tab sizes for each language
uxfion opened this issue · comments
Lecter commented
-- 缩进4个空格等于一个Tab
vim.o.tabstop = 4
vim.bo.tabstop = 4
vim.o.softtabstop = 4
vim.o.shiftround = true
-- 空格替代tab
vim.o.expandtab = true
vim.bo.expandtab = true
-- 新行对齐当前行
vim.o.autoindent = true
vim.bo.autoindent = true
vim.o.smartindent = true
基础设置如上所示,但是发现对于不同文件类型,比如yaml
,一个tab就变成了2
请问,对于所有文件,我该如何设置,才能使tab size = 4
Xin Chen commented
研究了一下,应该是被tabstop应该是被插件覆盖了,在 autocmds.lua 里添加一个自动命令可行
autocmd("FileType", {
group = myAutoGroup,
callback = function()
-- print(vim.o.filetype) 根据类型设置
vim.o.tabstop = 4
vim.o.shiftwidth = 4
vim.o.expandtab = true
end,
})