mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-17 16:26:27 +00:00
Use ctrl+f for copilot complete
Similar to fish
This commit is contained in:
parent
46baaf7c1e
commit
4a042358f6
@ -622,6 +622,10 @@ use({
|
||||
use({
|
||||
"https://github.com/github/copilot.vim",
|
||||
disable = not vim.g.install_copilot,
|
||||
config = function()
|
||||
require("plugins.copilot")
|
||||
end,
|
||||
after = "vim-rsi",
|
||||
})
|
||||
|
||||
use({
|
||||
|
@ -23,8 +23,8 @@ function M.config_cmp()
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- Scroll docs with readline back - forward
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-U>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-D>"] = cmp.mapping.scroll_docs(4),
|
||||
-- Expand snippets with Tab
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if luasnip.expand_or_jumpable() then
|
||||
|
22
neovim/lua/plugins/copilot.lua
Normal file
22
neovim/lua/plugins/copilot.lua
Normal file
@ -0,0 +1,22 @@
|
||||
local utils = require("utils")
|
||||
local M = {}
|
||||
|
||||
function M.copilot_accept()
|
||||
local suggest = vim.fn["copilot#GetDisplayedSuggestion"]()
|
||||
if next(suggest.item) ~= nil then
|
||||
print("accept cp")
|
||||
return vim.fn["copilot#Accept"]("\\<CR>")
|
||||
else
|
||||
return utils.t("<Right>")
|
||||
end
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
vim.g.copilot_no_tab_map = false
|
||||
utils.keymap_set("i", "<C-F>", M.copilot_accept, { expr = true, replace_keycodes = false, noremap = true })
|
||||
utils.keymap_set("i", "<Right>", M.copilot_accept, { expr = true, replace_keycodes = false, noremap = true })
|
||||
end
|
||||
|
||||
M.setup()
|
||||
|
||||
return M
|
Loading…
Reference in New Issue
Block a user