From 89c8910845504b8e587483b7610bdfe59dcf9006 Mon Sep 17 00:00:00 2001 From: fugotakefusa Date: Mon, 27 Oct 2025 14:05:32 +1300 Subject: [PATCH] add copilot --- init.lua | 68 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/init.lua b/init.lua index 0ee191bb..127c1ef6 100644 --- a/init.lua +++ b/init.lua @@ -78,9 +78,7 @@ vim.o.scrolloff = 10 -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), -- instead raise a dialog asking if you wish to save the current file(s) -- See `:help 'confirm'` -vim.o.confirm = true - --- [[ Basic Keymaps ]] +vim.o.confirm = true -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -- Clear highlights on search when pressing in normal mode @@ -855,29 +853,49 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = { 'c', 'lua', 'vim', 'vimdoc', 'query' }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = 'gnn', -- set to `false` to disable one of the mappings + node_incremental = 'grn', + scope_incremental = 'grc', + node_decremental = 'grm', + }, + }, + } + end, + }, + { + 'CopilotC-Nvim/CopilotChat.nvim', + dependencies = { + { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + config = function() + require('copilot').setup {} + end, + }, + { 'nvim-lua/plenary.nvim', branch = 'master' }, + }, + build = 'make tiktoken', + opts = { + -- See Configuration section for options + }, }, - -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations.