zk-org / zk

A plain text note-taking assistant
https://zk-org.github.io/zk/
GNU General Public License v3.0
1.68k stars 126 forks source link

Share working minimal config for auto-completion #205

Closed VolkovIlia closed 2 years ago

VolkovIlia commented 2 years ago

Please add some working config examples for popular auto-completion plugins: coq_nvim, nvim_cmp, mb etc...

Spent hours around playing with instructions on github pages but auto-completion in zk still not working (pyright works well for example).

P.S. I use lspconfig, not zk-nvim, but tried both.

VolkovIlia commented 2 years ago

Somehow plugin lexima.vim breaks auto-completion with nvim_cmp. After [[ was not completion at all.

I know that it is bug, but truthfully don't understand whom I should to report it((

mickael-menu commented 2 years ago

zk is editor agnostic and even though I added some minimal setup in the docs, I don't intend to maintain it for every specific cases.

You are not the first to mention conflicting plugins with the Neovim built-in LSP, but it's out of scope for zk. Unless there's something wrong in the LSP implementation, but I'm not interested in debugging all these plugins myself.

That being said, here's a minimal config that works for me with nvim-cmp:

call plug#begin('~/.vim/plugged')

Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'

call plug#end()

lua << EOF

local lspconfig = require'lspconfig'
local cmp = require'cmp'

cmp.setup({
  sources = cmp.config.sources({
    { name = 'nvim_lsp' },
  }, {
    { name = 'buffer' },
  })
})

local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())

lspconfig.zk.setup {
  capabilities = capabilities
}
EOF