all repos — dotfiles @ 826344a94263393b2ef9defdccc9c3c12c080baf

linux dotfiles

nvim: add treesitter
Prithu Goswami pg@prithu.dev
Fri, 09 Sep 2022 21:52:42 +0530
commit

826344a94263393b2ef9defdccc9c3c12c080baf

parent

571243a787640c266f6d9afd387263346f4976f4

2 files changed, 37 insertions(+), 6 deletions(-)

jump to
M config/nvim/init.luaconfig/nvim/init.lua

@@ -4,6 +4,8 @@ require 'keymaps'

require 'completion' require 'lsp' +-- TODO move each plugin setup to own file + require("nvim-tree").setup({ sort_by = "case_sensitive", filters = {

@@ -77,8 +79,30 @@ }

} require('telescope').load_extension('fzf') +require'nvim-treesitter.configs'.setup { + ensure_installed = { "python", "hcl", "json", "go", "lua", "javascript", "typescript", "html", "css", "c", "cpp", "rust" }, + sync_install = false, + auto_install = true, + -- ignore_install = { "javascript" }, + highlight = { + enable = true, + -- disable = { "c", "rust" }, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = true, + }, + indent = { + enable = true, + disable = {"hcl"} + } +} + -- TODO move to seperate autocmd file vim.cmd ([[ autocmd FileType html,javascript,lua,typescript,yaml setlocal ts=2 sts=2 sw=2 autocmd BufRead *jsx setlocal sw=2 + autocmd BufRead *tsx setlocal sw=2 ]])
M config/nvim/lua/plugins.luaconfig/nvim/lua/plugins.lua

@@ -34,6 +34,19 @@ use 'tpope/vim-fugitive'

use 'tpope/vim-surround' use 'tpope/vim-commentary' + -- telescope + use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.0', + requires = { {'nvim-lua/plenary.nvim'} } + } + + -- treesitter + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate' + } + use 'simeji/winresizer' use 'rstacruz/vim-closer' use {'iamcco/markdown-preview.nvim', run = 'cd app && npm install', cmd = 'MarkdownPreview'}

@@ -44,10 +57,4 @@ 'kyazdani42/nvim-web-devicons',

} } - use 'nvim-lua/plenary.nvim' - use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.0', - requires = { {'nvim-lua/plenary.nvim'} } - } end)