From: Ruben Beltran del Rio Date: Mon, 2 Oct 2023 22:28:19 +0000 (+0200) Subject: Use treesitter in neovim X-Git-Url: https://git.r.bdr.sh/rbdr/dotfiles/commitdiff_plain/3c6ddc925cc3494cd5c19b2b6fac43fd9eb67656?ds=sidebyside;hp=--cc Use treesitter in neovim --- 3c6ddc925cc3494cd5c19b2b6fac43fd9eb67656 diff --git a/config/nvim/coc-settings.json b/config/nvim/coc-settings.json deleted file mode 100644 index 9be6d48..0000000 --- a/config/nvim/coc-settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "svelte.enable-ts-plugin": true, - "suggest.noselect": true -} diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 1b5fda9..e3e6427 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -86,5 +86,6 @@ vim.g.vim_svelte_plugin_use_typescript = true -- Plugins require('plugins') +require('treesitter_config') require('lsp') require('dap_config') diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 0502bd4..a32d9a5 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -1,29 +1,18 @@ { "LargeFile": { "branch": "master", "commit": "3941a37b2b0288524300348a39521a46539bf9f6" }, "api-notation.vim": { "branch": "master", "commit": "b6f0708fb9f009b7051db514423e9ebf86bc9af4" }, - "dart-vim-plugin": { "branch": "master", "commit": "928302ec931caf0dcf21835cca284ccd2b192f7b" }, - "fzf-lua": { "branch": "main", "commit": "335f908b912504015fefeeccacb4c325029d2bfc" }, + "fzf-lua": { "branch": "main", "commit": "1ff0278882db9786fef6f77cbcea7d8fa4b9ccee" }, "gemini.vim": { "branch": "master", "commit": "c9efb59c97b71c28d4678c79fd21fbdd3a69d196" }, - "kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" }, - "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, - "neodev.nvim": { "branch": "main", "commit": "ddf29935af5a510307850919d6772ea6a4e2c008" }, + "lazy.nvim": { "branch": "main", "commit": "59335c5b9d116f5d3948f833288a89e2a829a005" }, + "neodev.nvim": { "branch": "main", "commit": "5147640bc8435ca3557a105ebd1143bc20420b60" }, "nvim-dap": { "branch": "master", "commit": "b3d4408e29d924fe130c9397a7c3b3630b3ea671" }, "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, - "nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" }, - "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac478757efcde1ac346f7044ab774e7cbb482533" }, + "nvim-treesitter": { "branch": "master", "commit": "d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1" }, "snes-syntax-vim": { "branch": "master", "commit": "a6a699c8905f7b6119bf91e44f960667d9f03d59" }, - "typescript-vim": { "branch": "master", "commit": "31ede5ad905ce4159a5e285073a391daa3bf83fa" }, "vim-closer": { "branch": "master", "commit": "6007d9db0a35e983af246b667282606612076b07" }, "vim-endwise": { "branch": "master", "commit": "e714ac3bcfd5a90038de49c3254eded7c70ae3c3" }, "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, - "vim-glsl": { "branch": "master", "commit": "bfd330a271933c3372fcfa8ce052970746c8e9dd" }, - "vim-graphql": { "branch": "master", "commit": "6089a44e89e76f9eba138fb68bfd132420404ff7" }, "vim-indent-object": { "branch": "master", "commit": "5c5b24c959478929b54a9e831a8e2e651a465965" }, - "vim-javascript": { "branch": "master", "commit": "c470ce1399a544fe587eab950f571c83cccfbbdc" }, - "vim-json": { "branch": "master", "commit": "3727f089410e23ae113be6222e8a08dd2613ecf2" }, - "vim-pug": { "branch": "master", "commit": "ea39cd942cf3194230cf72bfb838901a5344d3b3" }, - "vim-svelte-plugin": { "branch": "master", "commit": "612b34640919c29b5cf2d85289dbc762b099858a" }, - "vim-swift": { "branch": "master", "commit": "76dd8b90aec0e934e5a9c524bba9327436d54348" }, - "vim-togglelist": { "branch": "master", "commit": "48f0d30292efdf20edc883e61b121e6123e03df7" }, - "zig.vim": { "branch": "master", "commit": "15841fc4fecfb1b6c02da9b4cc17ced135edbf8e" } + "vim-togglelist": { "branch": "master", "commit": "48f0d30292efdf20edc883e61b121e6123e03df7" } } \ No newline at end of file diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index eb8b98f..dc90a7b 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -13,12 +13,6 @@ lspconfig.rust_analyzer.setup { ['rust-analyzer'] = {}, }, } -lspconfig.cssls.setup { - capabilities = capabilities, -} -lspconfig.html.setup { - capabilities = capabilities, -} lspconfig.lua_ls.setup{} -- Global mappings. diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 27d1c32..0a43a3e 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -45,20 +45,8 @@ require('lazy').setup({ -- Syntaxes 'https://git.sr.ht/~rbdr/api-notation.vim', - 'elzr/vim-json', - 'pangloss/vim-javascript', 'ARM9/snes-syntax-vim', - 'leafgarland/typescript-vim', - 'leafOfTree/vim-svelte-plugin', - 'bumaociyuan/vim-swift', - 'udalov/kotlin-vim', - 'tikhomirov/vim-glsl', - 'jparise/vim-graphql', - 'digitaltoad/vim-pug', 'https://git.sr.ht/~torresjrjr/gemini.vim', - 'rust-lang/rust.vim', - 'dart-lang/dart-vim-plugin', - 'ziglang/zig.vim', -- Debugging 'mfussenegger/nvim-dap', @@ -69,6 +57,9 @@ require('lazy').setup({ 'rstacruz/vim-closer', 'michaeljsmith/vim-indent-object', + -- Treesitter + 'nvim-treesitter/nvim-treesitter', + -- LSP 'neovim/nvim-lspconfig', 'folke/neodev.nvim', diff --git a/config/nvim/lua/treesitter_config.lua b/config/nvim/lua/treesitter_config.lua new file mode 100644 index 0000000..fc4a4a7 --- /dev/null +++ b/config/nvim/lua/treesitter_config.lua @@ -0,0 +1,48 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { + 'bash', + 'css', + 'dart', + 'diff', + 'dockerfile', + 'gitcommit', + 'graphql', + 'html', + 'htmldjango', + 'javascript', + 'jsdoc', + 'json', + 'kotlin', + 'lua', + 'make', + 'markdown', + 'python', + 'ruby', + 'rust', + 'sql', + 'svelte', + 'swift', + 'toml', + 'tsx', + 'typescript', + 'yaml' + }, + + sync_install = false, + auto_install = true, + + highlight = { + enable = true, + + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + + additional_vim_regex_highlighting = false, + }, +} diff --git a/provisioning/brew_essential b/provisioning/brew_essential index 613e2b2..60148bc 100644 --- a/provisioning/brew_essential +++ b/provisioning/brew_essential @@ -20,3 +20,4 @@ zsh koekeishiya/formulae/yabai koekeishiya/formulae/skhd pass +tree-sitter diff --git a/provisioning/pacman_essential b/provisioning/pacman_essential index 7eecca0..e30d610 100644 --- a/provisioning/pacman_essential +++ b/provisioning/pacman_essential @@ -20,3 +20,4 @@ zsh inetutils z pass +tree-sitter