Comments (1)
In my setup, snippet and completion have separate keymaps.
That said, maybe this could help you get started.
local opts = { noremap = true, expr = true, silent = true }
-- because or opts.expr we gotta return something
vim.keymap.set("i", "<Tab>", function()
if vim.fn["coc#pum#visible"]() == 1 then
return vim.fn["coc#pum#next"](1)
elseif vim.fn["coc#expandableOrJumpable"]() then
return "<Plug>(coc-snippets-expand-jump)"
else
return "<C-i>"
end
end, opts)
vim.keymap.set("i", "<S-Tab>", function()
if vim.fn["coc#pum#visible"]() == 1 then
return vim.fn["coc#pum#prev"](1)
elseif vim.fn["coc#jumpable"]() then
return vim.fn["coc#snippet#prev"]() --> this turns into <Ignore> when the keymap runs
elseif vim.fn.indent(vim.fn.line(".")) == vim.fn.col(".") - 1 then
return "<C-d>"
else
return "<C-w>"
end
end, opts)
vim.keymap.set("i", "<CR>", function()
if vim.fn["coc#pum#visible"]() == 1 then
vim.fn["coc#pum#close"]("confirm")
else
vim.api.nvim_feedkeys(vim.keycode("<C-m>"), "n", false)
vim.fn["coc#on_enter"]()
end
end, { noremap = true, silent = true })
-- This might be useful since some snippets sometimes add text before the
-- cursor and that might influence completion
vim.keymap.set("i", "<C-Space>", function()
if vim.fn["coc#pum#visible"]() == 1 then
vim.fn["coc#pum#close"]()
else
vim.fn["coc#start"]()
end
end, { noremap = true, silent = true })
from coc.nvim.
Related Issues (20)
- Failed open exsit file with list in vim HOT 5
- The text above get seleted automatically HOT 2
- The documentation has incorrect installation instructions for NeoBundle HOT 1
- How to remove the highlights when using go references HOT 3
- LinkedEditing not work in vim HOT 1
- help: completion of variables from dotenv files in shell scripts HOT 9
- <CR> can not confirm in vimwiki and folding codes failed HOT 4
- coc.nvim takes up two shortcut keys that I prefer to use. HOT 1
- Error on notification "codeAction": code action without data HOT 4
- Asynchronous Completion for `isIncomplete` Items in coc.nvim
- FEAT: Disable all formatting and linting except for what is output by the `languageservers` in coc-settings.json HOT 2
- organizeImport stopped working for months HOT 10
- 执行`rust-analyzer.reload`后报错 HOT 1
- Incorrect cwd when call vim with '-c cd xxx'
- Cannot confirm autocomplete from non-LSP sources HOT 3
- Using Arduino Language Server
- Make `:CocUpdate` can use tab
- Change timeout value of CocTagFunc HOT 2
- Programmatical cancel/abort of cursors/range session through editor.action.cancelRanges
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coc.nvim.