From 0c0ab0acec96454815b33fa186734ac380ea71f8 Mon Sep 17 00:00:00 2001 From: Mahesh Asolkar Date: Tue, 5 Aug 2025 17:51:43 -0700 Subject: [PATCH] Added treesitter and copilot to nvim config --- nvim.init.lazy.lua | 64 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/nvim.init.lazy.lua b/nvim.init.lazy.lua index 947fb78..60f5b0e 100644 --- a/nvim.init.lazy.lua +++ b/nvim.init.lazy.lua @@ -35,7 +35,7 @@ require("lazy").setup({ "nathanaelkane/vim-indent-guides", -- "https://github.com/intel-sandbox/vim-iosf.git", -- intel -- "https://github.com/intel-sandbox/vim-pcietrk", -- intel - "vhda/verilog_systemverilog.vim", + --"vhda/verilog_systemverilog.vim", { 'nvim-telescope/telescope.nvim', tag = '0.1.2', dependencies = { 'nvim-lua/plenary.nvim' } @@ -44,9 +44,66 @@ require("lazy").setup({ 'nvim-telescope/telescope-fzf-native.nvim', -- build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' build = 'make' - } + }, + { + 'nvim-treesitter/nvim-treesitter', + branch = 'master', + lazy = false, + build = ":TSUpdate" + }, + -- Copilot setup + "github/copilot.vim", + -- { + -- "zbirenbaum/copilot-cmp", + -- config = function () + -- require("copilot_cmp").setup() + -- end + -- } }) +-- Treesitter +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the listed parsers MUST always be installed) + ensure_installed = { "verilog", "rust" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + -- List of parsers to ignore installing (or "all") + --ignore_install = { "javascript" }, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + highlight = { + enable = true, + + -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to + -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is + -- the name of the parser) + -- list of language that will be disabled + --disable = { "c", "rust" }, + -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files + 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, + + -- 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 = false, + }, +} + -- LuaLine require('lualine').setup { options = { @@ -239,7 +296,8 @@ vim.g.NERDTreeKeepTreeInNewTab = 1 vim.g.nerdtree_tabs_open_on_gui_startup = 0 -- Filetype assignments - TODO: Is there an automatic way for this? -vim.cmd("au! BufRead,BufNewFile *.sv,*.svh set filetype=verilog_systemverilog") +-- vim.cmd("au! BufRead,BufNewFile *.sv,*.svh set filetype=verilog_systemverilog") +-- vim.cmd("au! BufRead,BufNewFile *.sv,*.svh set filetype=verilog") vim.cmd("au! BufRead,BufNewFile *iosfsb_trk.out set filetype=iosfsbtrk") vim.cmd("au! BufRead,BufNewFile *iosf_trk.out set filetype=iosftrk")