Compare commits

...

1 Commits

Author SHA1 Message Date
1268abebfc Working config 2022-10-29 23:16:55 +02:00
2 changed files with 165 additions and 8 deletions

@ -55,9 +55,10 @@ local config = {
diagnostics_enabled = true, -- enable diagnostics at start diagnostics_enabled = true, -- enable diagnostics at start
status_diagnostics_enabled = true, -- enable diagnostics in statusline status_diagnostics_enabled = true, -- enable diagnostics in statusline
copilot_no_tab_map = true, -- copilot_no_tab_map = true,
copilot_assume_mapped = true, -- copilot_assume_mapped = true,
copilot_tab_fallback = "", -- copilot_tab_fallback = "",
vimspector_enable_mappings = 'VISUAL_STUDIO', vimspector_enable_mappings = 'VISUAL_STUDIO',
}, },
}, },
@ -266,13 +267,16 @@ local config = {
-- quick save -- quick save
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command -- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
}, },
i = {
-- ["<Tab>"] = { "copilot#Accept('<CR>')", silent = true, expr = true },
-- ["<Tab>"] = { "copilot#Accept('<CR>')" },
-- Oopen cmp menu
["<C-Space>"] = { "cmp#complete()", silent = true, expr = true },
},
t = { t = {
-- setting a mapping to false will disable it -- setting a mapping to false will disable it
-- ["<esc>"] = false, -- ["<esc>"] = false,
}, },
i = {
["<C-e>"] = { "copilot#Accept('<CR>')", silent = true, expr = true },
}
}, },
-- Configure plugins -- Configure plugins
@ -292,14 +296,43 @@ local config = {
-- end, -- end,
-- }, -- },
-- --
{ {
"folke/todo-comments.nvim", "folke/todo-comments.nvim",
event = "BufRead", event = "BufRead",
config = function() config = function()
require("todo-comments").setup() require("todo-comments").setup()
end, end,
}, },
{ "github/copilot.vim" }, {
"zbirenbaum/copilot.lua",
-- event = "VimEnter",
event = "BufRead",
-- after = "feline.nvim",
config = function()
vim.defer_fn(function()
require("copilot").setup()
end, 100)
end,
},
-- { "github/copilot.vim" },
{
"zbirenbaum/copilot-cmp",
-- after = "copilot.lua",
after = { "nvim-cmp", "copilot.lua" },
config = function()
-- astronvim.add_cmp_source("copilot_cmp")
astronvim.add_cmp_source({ name = "copilot", priority = 1050, keyword_length = -1, max_item_count = 4 })
require("copilot_cmp").setup {
method = "getCompletionsCycling",
-- method = "getPanelCompletions",
formatters = {
label = require("copilot_cmp.format").format_label_text,
insert_text = require("copilot_cmp.format").format_insert_text,
preview = require("copilot_cmp.format").deindent,
},
}
end,
},
{ "puremourning/vimspector" }, { "puremourning/vimspector" },
{ "lervag/vimtex" }, { "lervag/vimtex" },
{ "normen/vim-pio" }, { "normen/vim-pio" },
@ -383,6 +416,33 @@ local config = {
buffer = 500, buffer = 500,
path = 250, path = 250,
}, },
-- mappings = {
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if luasnip.expandable() then
-- luasnip.expand()
-- elseif luasnip.expand_or_jumpable() then
-- luasnip.expand_or_jump()
-- elseif has_words_before() then
-- cmp.complete()
-- else
-- fallback()
-- end
-- end, {
-- "i",
-- "s",
-- }),
-- ["<S-Tab>"] = cmp.mapping(function(fallback)
-- if luasnip.jumpable(-1) then
-- luasnip.jump(-1)
-- else
-- fallback()
-- end
-- end, {
-- "i",
-- "s",
-- }),
--
-- }
}, },
-- Modify which-key registration (Use this with mappings table in the above.) -- Modify which-key registration (Use this with mappings table in the above.)

97
plugins/cmp.lua Normal file

@ -0,0 +1,97 @@
local kind_icons = {
NONE = "",
Array = "",
Boolean = "",
Class = "",
Constructor = "",
Key = "",
Namespace = "",
Null = "NULL",
Number = "#",
Object = "⦿",
Package = "",
Property = "",
Reference = "",
Snippet = "",
String = "𝓐",
TypeParameter = "",
Unit = "",
Text = "",
Method = "",
Function = "",
Field = "",
Variable = "",
Interface = "",
Module = "",
Value = "",
Enum = "",
Keyword = "",
Color = "",
File = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
Copilot = "",
}
local cmp = require("cmp")
-- 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
-- end
return {
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(_, vim_item)
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
return vim_item
end,
},
-- completion = {
-- keyword_length = 0,
-- },
-- mapping = {
-- ["<Tab>"] = vim.schedule_wrap(function(fallback)
-- if cmp.visible() and has_words_before() then
-- cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
-- else
-- fallback()
-- end
-- end),
-- ['<Tab>'] = cmp.mapping(function(fallback)
-- if vim.fn['vsnip#jumpable'](1) == 1 then
-- feedkey('<Plug>(vsnip-jump-next)', '')
-- else
-- local copilot_keys = vim.fn['copilot#Accept']()
-- if copilot_keys ~= '' then
-- vim.api.nvim_feedkeys(copilot_keys, 'i', true)
-- else
-- fallback()
-- end
-- end
-- end, { 'i', 's' }),
-- },
}
-- local cmp = require "cmp"
-- local luasnip = require "luasnip"
-- return {
-- preselect = cmp.PreselectMode.None,
-- mapping = {
-- ["<CR>"] = cmp.mapping.confirm { select = false },
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if luasnip.expandable() then
-- luasnip.expand()
-- elseif luasnip.expand_or_jumpable() then
-- luasnip.expand_or_jump()
-- fallback()
-- end
-- end, {
-- "i",
-- "s",
-- }),
-- },
-- }