mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-01 20:36:28 +00:00
4a042358f6
Similar to fish
23 lines
616 B
Lua
23 lines
616 B
Lua
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
|