use treesitter to fold, disable treesitter indent for rust,

tell project.lua that Cargo.toml is a project root pattern
This commit is contained in:
Andy Teijelo 2022-11-03 11:09:12 -04:00
parent f577a76838
commit a681654ff2
3 changed files with 7 additions and 4 deletions

View file

@ -5,8 +5,8 @@ require "user.keymaps"
require "user.plugins" require "user.plugins"
--require "user.alpha" --require "user.alpha"
require "user.autocommands"
require "user.colorscheme" require "user.colorscheme"
require "user.autocommands"
require "user.cmp" require "user.cmp"
require "user.telescope" require "user.telescope"
require "user.gitsigns" require "user.gitsigns"

View file

@ -8,7 +8,7 @@ project.setup({
detection_methods = { "pattern" }, detection_methods = { "pattern" },
-- patterns used to detect root dir, when **"pattern"** is in detection_methods -- patterns used to detect root dir, when **"pattern"** is in detection_methods
patterns = { ".git", "Makefile", "package.json" }, patterns = { ".git", "Makefile", "package.json", "Cargo.toml" },
}) })
local tele_status_ok, telescope = pcall(require, "telescope") local tele_status_ok, telescope = pcall(require, "telescope")

View file

@ -3,6 +3,10 @@ if not status_ok then
return return
end end
vim.cmd("set foldmethod=expr")
vim.cmd("set foldexpr=nvim_treesitter#foldexpr()")
vim.cmd("set nofoldenable")
local configs local configs
status_ok, configs = pcall(require, "nvim-treesitter.configs") status_ok, configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then if not status_ok then
@ -22,13 +26,12 @@ configs.setup({
autopairs = { autopairs = {
enable = true, enable = true,
}, },
indent = { enable = true, disable = { "python", "css" } }, indent = { enable = true, disable = { "python", "css", "rust" } },
context_commentstring = { context_commentstring = {
enable = true, enable = true,
enable_autocmd = false, enable_autocmd = false,
}, },
}) })
local context local context