From 70e29843db591b6382a7725179b614293cf94dce Mon Sep 17 00:00:00 2001 From: c Date: Fri, 23 Jun 2023 21:11:53 -0500 Subject: [PATCH] aaaa --- nvim/.config/nvim/lua/plugins/init.lua | 2 - nvim/.config/nvim/lua/plugins/treesitter.lua | 52 ++++++++++++++++++++ nvim/.config/nvim/test.py | 2 +- 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 nvim/.config/nvim/lua/plugins/treesitter.lua diff --git a/nvim/.config/nvim/lua/plugins/init.lua b/nvim/.config/nvim/lua/plugins/init.lua index 3dda59c..6e318e0 100644 --- a/nvim/.config/nvim/lua/plugins/init.lua +++ b/nvim/.config/nvim/lua/plugins/init.lua @@ -94,8 +94,6 @@ return { { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, { "nvim-telescope/telescope-file-browser.nvim" }, - -- Treesitter - { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, -- Registry history { diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..be7a845 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,52 @@ +local M = { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + event = "BufReadPost", + dependencies = { + "nvim-treesitter/nvim-treesitter-refactor", + }, + opts = { + 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, + }, + autopairs = { enable = true }, + autotag = { enable = true }, + indent = { enable = true }, + ensure_installed = { + "json", + "yaml", + "html", + "css", + "markdown", + "bash", + "lua", + "vim", + "dockerfile", + "gitignore", + "python" + }, + sync_install = true, + ignore_install = {}, -- List of parsers to ignore installation + refactor = { + highlight_definitions = { + enable = true, + -- Set to false if you have an `updatetime` of ~100. + clear_on_cursor_move = true, + }, + highlight_current_scope = { enable = false }, + }, + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, +} + +return M diff --git a/nvim/.config/nvim/test.py b/nvim/.config/nvim/test.py index e9805a1..7a4f95f 100644 --- a/nvim/.config/nvim/test.py +++ b/nvim/.config/nvim/test.py @@ -11,7 +11,7 @@ def add(x, y): print(f"{x} + {y} = {x+y}\n") -def subtract(x, y) -> int: +def subtract(x: int, y: int) -> int: """ Very cool function that will subtract two ints return: int