Created
September 21, 2024 07:38
-
-
Save haandol/c2ff89706fa8af6edf1bb2bb0c1fe3ba to your computer and use it in GitHub Desktop.
copilot on lazyvim use tab to accept suggestion instead of enter, just like vscode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- ~/.config/nvim/lua/plugins/cmp.lua | |
| return { | |
| { | |
| "hrsh7th/nvim-cmp", | |
| opts = function(_, opts) | |
| local cmp = require("cmp") | |
| opts.mapping = vim.tbl_extend("force", opts.mapping, { | |
| ["<Tab>"] = cmp.mapping(function(fallback) | |
| if cmp.visible() then | |
| cmp.confirm({ select = true }) | |
| else | |
| fallback() | |
| end | |
| end, { "i", "s" }), | |
| ["<CR>"] = cmp.mapping.abort(), | |
| }) | |
| end, | |
| }, | |
| } | |
| -- ~/.config/nvim/lua/plugins/copilot.lua | |
| return { | |
| { | |
| "zbirenbaum/copilot.lua", | |
| opts = { | |
| suggestion = { | |
| keymap = { | |
| accept = "<Tab>", | |
| accept_word = false, | |
| accept_line = false, | |
| }, | |
| }, | |
| }, | |
| }, | |
| } | |
| -- ~/.config/nvim/config/keymaps.lua | |
| vim.keymap.set("i", "<CR>", "<CR>", { noremap = true, silent = true }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment