added copilot

added copilot
deleted auto format on save
This commit is contained in:
Simon Ayoub 2024-10-17 18:53:50 +11:00
parent 094f58bfe3
commit 144cd01fdf
2 changed files with 37 additions and 11 deletions

View file

@ -98,6 +98,9 @@ vim.g.have_nerd_font = true
-- NOTE: You can change these options as you wish! -- NOTE: You can change these options as you wish!
-- For more options, you can see `:help option-list` -- For more options, you can see `:help option-list`
-- make line wrap disabled
vim.opt.wrap = false
-- Make line numbers default -- Make line numbers default
vim.opt.number = true vim.opt.number = true
-- You can also add relative line numbers, to help with jumping. -- You can also add relative line numbers, to help with jumping.
@ -655,19 +658,21 @@ require('lazy').setup({
}, },
}, },
opts = { opts = {
autoformat = true,
notify_on_error = false, notify_on_error = false,
format_on_save = function(bufnr) -- format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't -- -- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional -- -- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones. -- -- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true } -- local disable_filetypes = { c = true, cpp = true, cxx = true }
return { -- return {
timeout_ms = 500, -- timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], -- lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
} -- }
end, -- end,
formatters_by_ft = { formatters_by_ft = {
lua = { 'stylua' }, lua = { 'stylua' },
cpp = { 'clang-format' },
-- Conform can also run multiple formatters sequentially -- Conform can also run multiple formatters sequentially
python = { 'isort', 'black' }, python = { 'isort', 'black' },
-- --
@ -858,7 +863,23 @@ require('lazy').setup({
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate', build = ':TSUpdate',
opts = { opts = {
ensure_installed = { 'python', 'cmake', 'bash', 'cpp', 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, ensure_installed = {
'python',
'cmake',
'bash',
'cpp',
'bash',
'c',
'diff',
'html',
'lua',
'luadoc',
'markdown',
'markdown_inline',
'query',
'vim',
'vimdoc',
},
-- Autoinstall languages that are not installed -- Autoinstall languages that are not installed
auto_install = true, auto_install = true,
highlight = { highlight = {

View file

@ -0,0 +1,5 @@
return {
{
'github/copilot.vim',
},
}