Comments (5)
@starptr sure. When using the preset lsp-compe
you can configure nvim-cmp anywhere you like.
About the mappings... You can technically "delete" a mapping before it gets to the setup function.
local cmp_config = lsp.defaults.cmp_config({
window = {
completion = cmp.config.window.bordered()
}
})
cmp_config.mapping['<Tab>'] = nil
cmp_config.mapping['<S-Tab>'] = nil
cmp.setup(cmp_config)
If you want to override it, you can do it right inside .defaults.cmp_config
. This has the advantage of keeping the other defaults.
local cmp_config = lsp.defaults.cmp_config({
window = {
completion = cmp.config.window.bordered()
},
mapping = {
['<C-e>'] = cmp.mapping.abort(),
}
})
If you want to delete all default keybindings and make your own, override the mapping
option outside .defaults.cmp_config
.
local cmp_config = lsp.defaults.cmp_config({
window = {
completion = cmp.config.window.bordered()
},
})
cmp_config.mapping = {
---
-- add your own mappings here...
---
}
from lsp-zero.nvim.
@kiryl I mention the avaible options of .setup_nvim_cmp
on the readme (also the help page). I also try to explain how to customize nvim-cmp in the Advance usage page. And there is also Under the hood section of the wiki, which shows everything lsp-zero configures with the recommended
preset.
from lsp-zero.nvim.
The window.completion
option didn't exists when lsp-zero was created, that's why it isnt part of the defaults. So now the role of setup_nvim_cmp
is just to allow the user to change some defaults, instead of being a mirror of the setup function for nvim-cmp.
If you want to extend your config for nvim-cmp use the lsp-compe
preset. You can use the function .defaults.cmp_config
to expose the default config and then extend it however you like.
local lsp = require('lsp-zero')
lsp.preset('lsp-compe')
lsp.setup()
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
local cmp = require('cmp')
local cmp_config = lsp.defaults.cmp_config({
window = {
completion = cmp.config.window.bordered()
}
})
cmp.setup(cmp_config)
from lsp-zero.nvim.
Is it possible to remove a default mapping (added by lsp-zero) using this strategy? I'd like to customize <C-e>
but in a different configuration file
from lsp-zero.nvim.
@VonHeikemen , okay it works. Looks like setup_nvim_cmp()
doesn't not mix with the proposed fix. Any configuration that is done with setup_nvim_cmp()
will be ignored.
It is okay with me. But maybe expose somewhere what config lsp-zero
constructed and passed to cmp.setup()
, including changes made with setup_nvim_cmp()
?
from lsp-zero.nvim.
Related Issues (20)
- Prettierd as formatter HOT 2
- `on_attach` "global hook" not working, but individual lspconfig setup `on_attach` is working HOT 8
- Autostart tsserver with default settings HOT 5
- Inlay hint and error/warning display HOT 1
- Cannot reuse lsp HOT 2
- Documentation is outdated HOT 1
- question: how can i format some text selection? HOT 3
- [feature] helper functions for efm language server
- grey foldcolumn when after installing lsp-zero.nvim HOT 2
- Client 1 quit with exit code 1 and signal 15 HOT 4
- What if I don't find my LSP in MASON HOT 3
- Bug: Formatting resets some content of a file
- Cannot add laravel-dev-tools HOT 2
- Highlight symbol under cursor HOT 3
- ThePrimeagen Config doesn't ensure lua lsp install. HOT 6
- add file paths to tutorial examples HOT 9
- Diagnostic signs in Neovim v0.10.0 and `vim.diagnostic.config()` HOT 2
- suggestions overlap with each other HOT 3
- Add 'linewidth' parameter to 'formatting_options' HOT 2
- Bug: use_fallback = true causing single-repeat issues HOT 3
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 lsp-zero.nvim.