From e582ebeab18a98b47c674e93f63a5f45c303ea01 Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Fri, 11 Aug 2023 18:12:35 -0700 Subject: [PATCH] updates --- init.vim | 2 +- lua/plugins.lua | 283 ++++++++++++++------------------ lua/settings.lua | 7 +- plugin-confs/null-ls.lua | 28 ++-- plugin-confs/nvim-cmp.lua | 261 +++++++++++++---------------- plugin-confs/nvim-colorizer.lua | 1 + plugin-confs/treesitter.lua | 48 ++++-- 7 files changed, 286 insertions(+), 344 deletions(-) create mode 100644 plugin-confs/nvim-colorizer.lua diff --git a/init.vim b/init.vim index 1b5574a..8c07fa2 100644 --- a/init.vim +++ b/init.vim @@ -36,6 +36,7 @@ source ~/.config/nvim/plugin-confs/nvim-cmp.lua source ~/.config/nvim/plugin-confs/fidget.lua source ~/.config/nvim/plugin-confs/symbols-outline.lua source ~/.config/nvim/plugin-confs/chatgpt.lua +source ~/.config/nvim/plugin-confs/nvim-colorizer.lua " source ~/.config/nvim/plugin-confs/copilot.lua " source ~/.config/nvim/plugin-confs/lsp-signature.lua " source ~/.config/nvim/plugin-confs/nvim-docs-view.lua @@ -75,7 +76,6 @@ command! Env execute ":Dotenv .env" command! MakeTags !ctags -R . command! Ovewrite execute ":w !sudo tee %" command! PS execute ":PackerSync" -command! Aniwrapper execute ":FloatermNew aniwrapper -qtdoomone -D 144" " set termguicolors " colorscheme doom-one diff --git a/lua/plugins.lua b/lua/plugins.lua index 1288ffe..f620b90 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -4,95 +4,94 @@ require('packer').startup(function(use) use 'nvim-lua/plenary.nvim' use { 'nvim-treesitter/nvim-treesitter', - run = function() require('nvim-treesitter.install').update({ with_sync = true }) end, + run = function() + require('nvim-treesitter.install').update({ with_sync = true }) + end } use { - 'nvim-lualine/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true } + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true } } + use { + "zbirenbaum/copilot.lua", + event = "VimEnter", + config = function() + vim.defer_fn(function() + require('copilot').setup({ + panel = { + enabled = false, + auto_refresh = false, + keymap = { + jump_prev = "[[", + jump_next = "]]", + accept = "", + refresh = "gr", + open = "" + }, + layout = { + position = "right", -- | top | left | right + ratio = 0.4 + } + }, + suggestion = { + enabled = false, + auto_trigger = true, + debounce = 75, + keymap = { + accept = "", + -- accept = "", + next = "", + prev = "", + dismiss = "" + } + }, + -- filetypes = { + -- yaml = false, + -- markdown = false, + -- help = false, + -- gitcommit = false, + -- gitrebase = false, + -- hgcommit = false, + -- svn = false, + -- cvs = false, + -- ["."] = false, + -- }, + copilot_node_command = 'node', -- Node version must be < 18 + plugin_manager_path = vim.fn.stdpath("data") .. + "/site/pack/packer", + server_opts_overrides = { + trace = "verbose", + settings = { + advanced = { + listCount = 10, -- #completions for panel + inlineSuggestCount = 4 -- #completions for getCompletions + } + } + } + }) + require("copilot.suggestion").toggle_auto_trigger() + end, 100) + end + } use { - "zbirenbaum/copilot.lua", - event = "VimEnter", - config = function () - vim.defer_fn(function() - require('copilot').setup({ - panel = { - enabled = false, - auto_refresh = false, - keymap = { - jump_prev = "[[", - jump_next = "]]", - accept = "", - refresh = "gr", - open = "" - }, - layout = { - position = "right", -- | top | left | right - ratio = 0.4 - }, - }, - suggestion = { - enabled = false, - auto_trigger = true, - debounce = 75, - keymap = { - accept = "", - -- accept = "", - next = "", - prev = "", - dismiss = "", - }, - }, - -- filetypes = { - -- yaml = false, - -- markdown = false, - -- help = false, - -- gitcommit = false, - -- gitrebase = false, - -- hgcommit = false, - -- svn = false, - -- cvs = false, - -- ["."] = false, - -- }, - copilot_node_command = 'node', -- Node version must be < 18 - plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer", - server_opts_overrides = { - trace = "verbose", - settings = { - advanced = { - listCount = 10, -- #completions for panel - inlineSuggestCount = 4, -- #completions for getCompletions - } - }, - } + "zbirenbaum/copilot-cmp", + -- after = { "copilot.lua" }, + config = function() + require("copilot_cmp").setup({ + suggestion = { enabled = false }, + panel = { enabled = false } + -- method = "getCompletionsCycling", + -- formatters = { + -- insert_text = require("copilot_cmp.format").remove_existing + -- } }) - require("copilot.suggestion").toggle_auto_trigger() - end, 100) - end, + end } - use { - "zbirenbaum/copilot-cmp", - -- after = { "copilot.lua" }, - config = function () - require("copilot_cmp").setup({ - suggestion = { enabled = false }, - panel = { enabled = false }, - -- method = "getCompletionsCycling", - -- formatters = { - -- insert_text = require("copilot_cmp.format").remove_existing - -- } - }) - end - } - - use { - 'junegunn/fzf', - run = function() vim.fn['fzf#install']() end - } + use { 'junegunn/fzf', run = function() vim.fn['fzf#install']() end } -- use { -- "lewis6991/hover.nvim", @@ -131,7 +130,7 @@ require('packer').startup(function(use) -- end -- } - use 'ap/vim-css-color' + use 'norcalli/nvim-colorizer.lua' use 'jiangmiao/auto-pairs' use 'junegunn/fzf.vim' use 'pechorin/any-jump.vim' @@ -140,91 +139,51 @@ require('packer').startup(function(use) use 'voldikss/vim-floaterm' use 'wakatime/vim-wakatime' - use { - 'akinsho/nvim-bufferline.lua' - } - use { - 'andweeb/presence.nvim' - } - use { - 'folke/which-key.nvim' - } - use { - 'glepnir/dashboard-nvim' - } - use { - 'kyazdani42/nvim-tree.lua' - } + use { 'akinsho/nvim-bufferline.lua' } + use { 'andweeb/presence.nvim' } + use { 'folke/which-key.nvim' } + use { 'glepnir/dashboard-nvim' } + use { 'kyazdani42/nvim-tree.lua' } use 'kyazdani42/nvim-web-devicons' - use { - 'lewis6991/gitsigns.nvim' - } - use { - 'nvim-telescope/telescope.nvim' - } - use { - 'nvim-telescope/telescope-file-browser.nvim' - } + use { 'lewis6991/gitsigns.nvim' } + use { 'nvim-telescope/telescope.nvim' } + use { 'nvim-telescope/telescope-file-browser.nvim' } - use { - 'ojroques/nvim-lspfuzzy' - } + use { 'ojroques/nvim-lspfuzzy' } use 'L3MON4D3/LuaSnip' -- use 'amrbashir/nvim-docs-view' + use { 'hrsh7th/nvim-cmp' } + use { 'hrsh7th/cmp-nvim-lsp' } + use { 'hrsh7th/cmp-nvim-lua' } + use { 'hrsh7th/cmp-nvim-lsp-signature-help' } + use { 'hrsh7th/cmp-path' } + use { 'hrsh7th/cmp-cmdline' } + use { 'hrsh7th/cmp-buffer' } + use { 'hrsh7th/cmp-nvim-lsp-document-symbol' } use { - 'hrsh7th/nvim-cmp' - } - use { - 'hrsh7th/cmp-nvim-lsp' - } - use { - 'hrsh7th/cmp-nvim-lua' - } - use { - 'hrsh7th/cmp-nvim-lsp-signature-help' - } - use { - 'hrsh7th/cmp-path' - } - use { - 'hrsh7th/cmp-cmdline' - } - use { - 'hrsh7th/cmp-buffer' - } - use { - 'hrsh7th/cmp-nvim-lsp-document-symbol' - } - use { - 'j-hui/fidget.nvim' - } - use { - 'jose-elias-alvarez/null-ls.nvim' - } - use { - 'ksyasuda/lsp_lines.nvim' - } - use { - 'neovim/nvim-lspconfig' - } - use { - 'onsails/lspkind-nvim' + 'j-hui/fidget.nvim', + tag = 'legacy', + config = function() + require("fidget").setup { + -- options + } + end } + use { 'jose-elias-alvarez/null-ls.nvim' } + use { 'ksyasuda/lsp_lines.nvim' } + use { 'neovim/nvim-lspconfig' } + use { 'onsails/lspkind-nvim' } -- use 'ray-x/lsp_signature.nvim' - use { - 'rmagatti/goto-preview' - } + use { 'rmagatti/goto-preview' } use 'saadparwaiz1/cmp_luasnip' use 'williamboman/nvim-lsp-installer' - use { - 'Mofiqul/dracula.nvim' - } + use { 'Mofiqul/dracula.nvim' } use { 'NTBBloodbath/doom-one.nvim', setup = function() - -- Add color to cursor + -- Add color to cursor vim.g.doom_one_cursor_coloring = false -- Set :terminal colors vim.g.doom_one_terminal_colors = false @@ -253,25 +212,25 @@ require('packer').startup(function(use) vim.g.doom_one_plugin_indent_blankline = true vim.g.doom_one_plugin_vim_illuminate = false vim.g.doom_one_plugin_lspsaga = true - end, - } - use { - 'olimorris/onedarkpro.nvim' - } - use { - 'projekt0n/github-nvim-theme' + end } + use { 'olimorris/onedarkpro.nvim' } + use { 'projekt0n/github-nvim-theme' } use({ - "jackMort/ChatGPT.nvim", + "jackMort/ChatGPT.nvim", requires = { - "MunifTanjim/nui.nvim", - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim" + "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim" } }) use 'khaveesh/vim-fish-syntax' use { "catppuccin/nvim", as = "catppuccin" } + + use({ + "iamcco/markdown-preview.nvim", + run = function() vim.fn["mkdp#util#install"]() end + }) end) diff --git a/lua/settings.lua b/lua/settings.lua index 7ff3eee..fdcab4d 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -6,7 +6,7 @@ local l = vim.lsp g.mapleader = " " g.maplocalleader = ',' g.fzf_command = 'fzf --height 90% --width=85% --layout=reverse --preview "bat --color=always {}"' -o.completeopt="menu,menuone,noselect" +o.completeopt = "menu,menuone,noselect" o.showmode = false o.termguicolors = true o.background = 'dark' @@ -30,7 +30,7 @@ o.cursorline = true o.scrolloff = 8 o.sidescrolloff = 8 o.wildmenu = true -o.wildignore= '.git,.hg,.svn,CVS,.DS_Store,.idea,.vscode,.vscode-test,node_modules' +o.wildignore = '.git,.hg,.svn,CVS,.DS_Store,.idea,.vscode,.vscode-test,node_modules' o.showmatch = true o.list = true o.listchars = 'tab:»·,trail:·,nbsp:·,extends:>,precedes:<' @@ -41,7 +41,8 @@ o.hidden = true o.cmdheight = 1 o.updatetime = 300 o.timeoutlen = 500 -o.pumwidth=35 +o.pumwidth = 35 +o.foldmethod = 'marker' local border = { { "╭", "FloatBorder" }, diff --git a/plugin-confs/null-ls.lua b/plugin-confs/null-ls.lua index 599403a..ed00ddf 100644 --- a/plugin-confs/null-ls.lua +++ b/plugin-confs/null-ls.lua @@ -15,12 +15,12 @@ require("null-ls").setup({ sources = { -- null_ls.builtins.completion.spell, null_ls.builtins.completion.luasnip, - null_ls.builtins.code_actions.gitsigns, + -- null_ls.builtins.code_actions.gitsigns, null_ls.builtins.code_actions.shellcheck, null_ls.builtins.diagnostics.cppcheck, null_ls.builtins.diagnostics.gitlint, null_ls.builtins.diagnostics.jsonlint, - -- require("null-ls").builtins.diagnostics.luacheck, + require("null-ls").builtins.diagnostics.luacheck, null_ls.builtins.diagnostics.markdownlint, -- null_ls.builtins.diagnostics.sqlfluff.with({ -- extra_args = { @@ -31,28 +31,26 @@ require("null-ls").setup({ null_ls.builtins.diagnostics.pylint, null_ls.builtins.diagnostics.pydocstyle.with({ extra_args = { "--config=$ROOT/setup.cfg" } - }), - null_ls.builtins.diagnostics.vint, + }), null_ls.builtins.diagnostics.vint, null_ls.builtins.diagnostics.shellcheck.with({ - extra_args = { "-s", "bash", "-o", "add-default-case, check-set-e-suppressed, check-unassigned-uppercase, deprecate-which, quote-safe-variables" } - }), - null_ls.builtins.diagnostics.ansiblelint, + extra_args = { + "-s", "bash", "-o", + "add-default-case, check-set-e-suppressed, check-unassigned-uppercase, deprecate-which, quote-safe-variables" + } + }), null_ls.builtins.diagnostics.ansiblelint, null_ls.builtins.formatting.json_tool, - -- require("null-ls").builtins.formatting.lua_format, + require("null-ls").builtins.formatting.lua_format, null_ls.builtins.formatting.markdownlint, - null_ls.builtins.formatting.prettier, - -- handled by lsp server + null_ls.builtins.formatting.prettier, -- handled by lsp server -- require("null-ls").builtins.formatting.rustfmt, null_ls.builtins.formatting.shfmt.with({ filetypes = { "sh", "bash" }, extra_args = { "-i", "0", "-ci", "-sr" } - }), - null_ls.builtins.formatting.black, - null_ls.builtins.formatting.isort, - null_ls.builtins.formatting.djlint, + }), null_ls.builtins.formatting.black, + null_ls.builtins.formatting.isort, null_ls.builtins.formatting.djlint -- null_ls.builtins.hover.printenv -- null_ls.builtins.formatting.tidy - }, + } }) -- local markdownlint = { diff --git a/plugin-confs/nvim-cmp.lua b/plugin-confs/nvim-cmp.lua index 962825f..653c8d2 100644 --- a/plugin-confs/nvim-cmp.lua +++ b/plugin-confs/nvim-cmp.lua @@ -7,18 +7,18 @@ local luasnip = require 'luasnip' local highlight = require('cmp.utils.highlight') local has_words_before = function() - if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil + if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then + return false + end + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and + vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match( + "^%s*$") == nil end -lspkind.init({ - symbol_map = { - Copilot = "", - }, -}) +lspkind.init({ symbol_map = { Copilot = "" } }) -vim.api.nvim_set_hl(0, "CmpItemKindCopilot", {fg ="#6CC644"}) +vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) cmp.setup({ snippet = { @@ -27,7 +27,7 @@ cmp.setup({ require('luasnip').lsp_expand(args.body) -- For `luasnip` users. -- require('snippy').expand_snippet(args.body) -- For `snippy` users. -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - end, + end }, capabilities = capabilities, mapping = { @@ -59,7 +59,7 @@ cmp.setup({ [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, - select = false, + select = false }, -- [""] = cmp.mapping(function(fallback) -- if cmp.visible() then @@ -69,52 +69,36 @@ cmp.setup({ -- else -- fallback() -- end - -- end, { "i", "s" }), + -- end, { "i", "s" }), [""] = vim.schedule_wrap(function(fallback) - if cmp.visible() and has_words_before() then - cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end + if cmp.visible() and has_words_before() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end end), [''] = cmp.mapping(function() - if cmp.visible() then - cmp.select_prev_item() - end - end, { "i", "s"}), + if cmp.visible() then cmp.select_prev_item() end + end, { "i", "s" }) }, window = { completion = { - winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", - col_offset = -3, - side_padding = 0, - border = "rounded", - borderchars = { - "─", - "│", - "─", - "│", - "╭", - "╮", - "╯", - "╰", - }, + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", + col_offset = -3, + side_padding = 0, + border = "rounded", + borderchars = { + "─", "│", "─", "│", "╭", "╮", "╯", "╰" + } }, documentation = { - border = "rounded", - borderchars = { - "─", - "│", - "─", - "│", - "╭", - "╮", - "╯", - "╰", - }, - -- padding = 15, + border = "rounded", + borderchars = { + "─", "│", "─", "│", "╭", "╮", "╯", "╰" + } + -- padding = 15, } }, formatting = { @@ -122,43 +106,43 @@ cmp.setup({ -- mode = 'symbol_text', fields = { "kind", "abbr", "menu" }, format = function(entry, vim_item) - local kind = require("lspkind").cmp_format({ - mode = "symbol_text", - maxwidth = 75, - symbol_map = { - Copilot = "", - Function = "󰊕", - Text = "󰊄", - Method = "󰆧", - Operator = "󰆕", - Keyword = "󰌋", - Variable = "󰂡", - Field = "󰇽", - Class = "󰠱", - Interface = "", - Module = "", - Property = "󰜢", - Unit = "", - Value = "󰎠", - Enum = "", - Snippet = "", - Color = "󰏘", - File = "󰈙", - Reference = "", - Folder = "󰉋", - EnumMember = "", - Constant = "󰏿", - Struct = "", - Event = "", - TypeParameter = "󰅲", - }, - })(entry, vim_item) - local strings = vim.split(kind.kind, "%s", { trimempty = true }) - kind.kind = " " .. strings[1] .. " " - kind.menu = " (" .. strings[2] .. ")" + local kind = require("lspkind").cmp_format({ + mode = "symbol_text", + maxwidth = 75, + symbol_map = { + Copilot = "", + Function = "󰊕", + Text = "󰊄", + Method = "󰆧", + Operator = "󰆕", + Keyword = "󰌋", + Variable = "󰂡", + Field = "󰇽", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "", + Value = "󰎠", + Enum = "", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "", + Event = "", + TypeParameter = "󰅲" + } + })(entry, vim_item) + local strings = vim.split(kind.kind, "%s", { trimempty = true }) + kind.kind = " " .. strings[1] .. " " + kind.menu = " (" .. strings[2] .. ")" - return kind - end, + return kind + end -- format = lspkind.cmp_format({ -- mode = 'symbol_text', -- show only symbol annotations -- menu = ({ @@ -171,89 +155,74 @@ cmp.setup({ -- }) }, sources = cmp.config.sources({ - { name = "copilot", group_index = 2 }, - { name = "path", group_index = 2 }, - { name = 'nvim_lsp', group_index = 2 }, - { name = 'nvim_lsp_signature_help', group_index = 2 }, + { name = "copilot", group_index = 2 }, { name = "path", group_index = 2 }, + { name = 'nvim_lsp', group_index = 2 }, + { name = 'nvim_lsp_signature_help', group_index = 2 }, { name = 'nvim_lsp_document_symbol', group_index = 2 }, - { name = 'luasnip', group_index = 2 }, -- For luasnip users. + { name = 'luasnip', group_index = 2 }, -- For luasnip users. { - name = 'buffer', - option = { - get_bufnrs = function() - local bufs = {} - for _, win in ipairs(vim.api.nvim_list_wins()) do - bufs[vim.api.nvim_win_get_buf(win)] = true - end - return vim.tbl_keys(bufs) - end - } + name = 'buffer', + option = { + get_bufnrs = function() + local bufs = {} + for _, win in ipairs(vim.api.nvim_list_wins()) do + bufs[vim.api.nvim_win_get_buf(win)] = true + end + return vim.tbl_keys(bufs) + end + } } -- { name = 'ultisnips' }, -- For ultisnips users. -- { name = 'snippy' }, -- For snippy users. - }, { - { name = 'buffer' }, - }), + }, { { name = 'buffer' } }), sorting = { priority_weight = 2, comparators = { - require("copilot_cmp.comparators").prioritize, - require("copilot_cmp.comparators").score, - require("copilot_cmp.comparators").recently_used, - require("copilot_cmp.comparators").kind, - require("copilot_cmp.comparators").sort_text, - require("copilot_cmp.comparators").length, - require("copilot_cmp.comparators").order, + require("copilot_cmp.comparators").prioritize, + require("copilot_cmp.comparators").score, + require("copilot_cmp.comparators").recently_used, + require("copilot_cmp.comparators").kind, + require("copilot_cmp.comparators").sort_text, + require("copilot_cmp.comparators").length, + require("copilot_cmp.comparators").order, - -- Below is the default comparitor list and order for nvim-cmp - cmp.config.compare.offset, - -- cmp.config.compare.scopes, --this is commented in nvim-cmp too - cmp.config.compare.exact, - cmp.config.compare.score, - cmp.config.compare.recently_used, - cmp.config.compare.locality, - cmp.config.compare.kind, - cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order, - }, - }, + -- Below is the default comparitor list and order for nvim-cmp + cmp.config.compare.offset, + -- cmp.config.compare.scopes, --this is commented in nvim-cmp too + cmp.config.compare.exact, cmp.config.compare.score, + cmp.config.compare.recently_used, cmp.config.compare.locality, + cmp.config.compare.kind, cmp.config.compare.sort_text, + cmp.config.compare.length, cmp.config.compare.order + } + } }) cmp.setup.cmdline('/', { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } + mapping = cmp.mapping.preset.cmdline(), + sources = { { name = 'buffer' } } }) cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { - name = 'cmdline', - option = { - ignore_cmds = { 'Man', '!' } - } - } - }) + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ { name = 'path' } }, { + { name = 'cmdline', option = { ignore_cmds = { 'Man', '!' } } } + }) }) local capabilities = require('cmp_nvim_lsp').default_capabilities() -local servers = { 'bashls', 'jedi_language_server', 'sqlls', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls', 'html', 'cssls', 'lua_ls' } +local servers = { + 'bashls', 'jedi_language_server', 'sqlls', 'jsonls', 'yamlls', 'vimls', + 'dotls', 'dockerls', 'html', 'cssls', 'lua_ls' +} for _, lsp in ipairs(servers) do lspconfig[lsp].setup { -- on_attach = my_custom_on_attach, - capabilities = capabilities, + capabilities = capabilities } end -cmp.event:on("menu_opened", function() - vim.b.copilot_suggestion_hidden = true -end) -cmp.event:on("menu_closed", function() - vim.b.copilot_suggestion_hidden = false -end) +cmp.event:on("menu_opened", + function() vim.b.copilot_suggestion_hidden = true end) +cmp.event:on("menu_closed", + function() vim.b.copilot_suggestion_hidden = false end) diff --git a/plugin-confs/nvim-colorizer.lua b/plugin-confs/nvim-colorizer.lua new file mode 100644 index 0000000..39e91bb --- /dev/null +++ b/plugin-confs/nvim-colorizer.lua @@ -0,0 +1 @@ +require 'colorizer'.setup() diff --git a/plugin-confs/treesitter.lua b/plugin-confs/treesitter.lua index 5d4778a..83e6226 100644 --- a/plugin-confs/treesitter.lua +++ b/plugin-confs/treesitter.lua @@ -1,34 +1,48 @@ require 'nvim-treesitter.configs'.setup { - -- One of "all", "maintained" (parsers with maintainers), or a list of languages - -- ensure_installed = "maintained", + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { + "c", "lua", "vim", "vimdoc", "query", "cpp", "python", "bash", "sql", + "yaml", "toml", "dockerfile", "gitcommit", "gitignore", "html", "css", + "javascript", "typescript", "rust", "go", "json", "regex", "latex", + "comment", "cmake", "graphql", "haskell", "java", "php", "ruby", + "sparql", "vue" + }, - -- Install languages synchronously (only applied to `ensure_installed`) + -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, - -- List of parsers to ignore installing + -- 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 (for "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 = { - -- `false` will disable the whole extension 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, - }, - - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - }, - }, + additional_vim_regex_highlighting = false + } }