change indentation based on filetype better
This commit is contained in:
@@ -444,8 +444,14 @@ function setup_plugins()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function config_vim()
|
function config_vim()
|
||||||
vim.opt.tabstop = 2
|
local default_tabwidth = 2
|
||||||
vim.opt.shiftwidth = 2
|
local override_tabwidth = {
|
||||||
|
cpp = 4,
|
||||||
|
go = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.opt.tabstop = default_tabwidth
|
||||||
|
vim.opt.shiftwidth = default_tabwidth
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
vim.opt.laststatus = 3
|
vim.opt.laststatus = 3
|
||||||
@@ -498,9 +504,9 @@ function config_vim()
|
|||||||
group = "__indentation__",
|
group = "__indentation__",
|
||||||
callback = function(opts)
|
callback = function(opts)
|
||||||
local filetype = vim.bo[opts.buf].filetype
|
local filetype = vim.bo[opts.buf].filetype
|
||||||
if filetype == "go" then
|
if override_tabwidth[filetype] ~= nil then
|
||||||
vim.opt.tabstop = 4
|
vim.opt.tabstop = override_tabwidth[filetype]
|
||||||
vim.opt.shiftwidth = 4
|
vim.opt.shiftwidth = override_tabwidth[filetype]
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user