diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-10-03 00:28:19 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-10-03 00:28:19 +0200 |
| commit | 3c6ddc925cc3494cd5c19b2b6fac43fd9eb67656 (patch) | |
| tree | e0af22c7a55ced9c92085ac19086f0dc23ac2e87 /config/nvim/lua | |
| parent | c2715eb55fdcdbec5742edd18f3317336ad13683 (diff) | |
Use treesitter in neovim
Diffstat (limited to 'config/nvim/lua')
| -rw-r--r-- | config/nvim/lua/lsp.lua | 6 | ||||
| -rw-r--r-- | config/nvim/lua/plugins.lua | 15 | ||||
| -rw-r--r-- | config/nvim/lua/treesitter_config.lua | 48 |
3 files changed, 51 insertions, 18 deletions
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, + }, +} |