fix indentation
This commit is contained in:
@@ -75,10 +75,6 @@ vim.opt.shiftwidth = 4
|
|||||||
-- Recommendation: Use true (spaces) for better portability across systems
|
-- Recommendation: Use true (spaces) for better portability across systems
|
||||||
vim.opt.expandtab = true
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
-- Smartindent: Auto-indent based on file type and syntax
|
|
||||||
-- Automatically adds indent after lines ending with specific characters
|
|
||||||
vim.opt.smartindent = true
|
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- UI/UX SETTINGS
|
-- UI/UX SETTINGS
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|||||||
@@ -17,6 +17,26 @@ return {
|
|||||||
install_dir = vim.fn.stdpath("data") .. "/site",
|
install_dir = vim.fn.stdpath("data") .. "/site",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Enable Treesitter-based indenting (selective)
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "*",
|
||||||
|
callback = function()
|
||||||
|
local exclude = { "python" }
|
||||||
|
for _, lang in ipairs(exclude) do
|
||||||
|
if vim.bo.filetype == lang then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if vim.bo.buftype == "" and vim.bo.filetype ~= "" then
|
||||||
|
pcall(function()
|
||||||
|
vim.bo.indentexpr = "v:lua.vim.treesitter.indentexpr()"
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Enable Treesitter indenting (selective)",
|
||||||
|
})
|
||||||
|
|
||||||
-- Auto-install parsers for these languages when opening a file
|
-- Auto-install parsers for these languages when opening a file
|
||||||
local ensure_installed = {
|
local ensure_installed = {
|
||||||
"python",
|
"python",
|
||||||
@@ -43,16 +63,5 @@ return {
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Enable Treesitter-based indenting (natively supported by Neovim)
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = "*",
|
|
||||||
callback = function()
|
|
||||||
if vim.bo.buftype == "" and vim.bo.filetype ~= "" then
|
|
||||||
vim.bo.indentexpr = "v:lua.vim.treesitter.indentexpr()"
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
desc = "Enable Treesitter indenting",
|
|
||||||
})
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user