Skip to main content
Share Your Experience: Take the 2024 Developer Survey
19 votes
Accepted

How to format files on save using black with neovim and coc

This is a coc.nvim setup procedure that works for Neovim, which aims to: Use coc-pyright as language server. Provide static type checking from a Python virtualenv (e.g. I have created a venv called ...
Gordon Bai's user avatar
19 votes
Accepted

Change color of CoC suggestion box

I don't use coc, so I will just share my vision on how you can try to fix this. I assume that by suggestion box you mean regular vim Pmenu. Try to make sure if it is actually Pmenu: run :hi Pmenu ...
Maxim Kim's user avatar
  • 13.5k
11 votes

open coc-definition in new split in coc

You can call the action jumpDefinition with a command as argument: nmap <silent> gs :call CocAction('jumpDefinition', 'split')<CR> nmap <silent> gd :call CocAction('jumpDefinition', '...
Mateus C's user avatar
  • 111
7 votes

nvim (plugged with coc, coc-clangd) is showing parameters for every function. How do disable it?

I propose you set: { "inlayHint.enable": false } in your coc-settings.json. You can get to this config by running the command :CocConfig in a vim/neovim buffer. See doc.
Johan Chane's user avatar
6 votes
Accepted

open coc-definition in new split in coc

I inject my own way of opening files in CoC with: let g:coc_user_config = {} let g:coc_user_config['coc.preferences.jumpCommand'] = ':SplitIfNotOpen4COC' Then the command is defined in my lh-vim-lib ...
Luc Hermitte's user avatar
  • 17.4k
6 votes
Accepted

Configuring CoC -- open suggestion-box with shortcut only

According to coc readme you can trigger completion manually with: " Use <c-space> to trigger completion. inoremap <silent><expr> <c-space> coc#refresh() NOTE that not every ...
Maxim Kim's user avatar
  • 13.5k
6 votes
Accepted

How can I hide and scroll popup window in coc.nvim in Vim?

This is a general way to scroll popup window above or under around cursor, it first get winid by test :h popup_locate() with screen cursor position, then update firstline of the found window. I didn't ...
dedowsdi's user avatar
  • 6,268
5 votes

Is there a way to toggle coc's linting?

Based on :help coc, I would use :CocDisable and :CocEnable. If you can find a way to detect if coc is enabled (b:coc_enabled I think was mentioned in the documentation and looks helpful), you could ...
D. Ben Knoble's user avatar
  • 26.4k
5 votes
Accepted

Changing colour of pop-up coc.nvim lint warning in custom colourscheme

Answer via this Reddit commenter: these floating boxes are controlled by coc itself. In this case the box is called CocHintFloat and can be seen with :hi CocHintFloat. In general :hi Co<tab> ...
Josh Friedlander's user avatar
5 votes

How to get emoji completion in markdown with `:<emoji>`, using neovim and coc

One way to get this feature is by using coc and coc-emoji. Coc is a plugin which allows you to get the same Language Server Protocol (autocompletion, linting, go to definition, etc...) as VSCode ...
statox's user avatar
  • 50.1k
5 votes
Accepted

why does COC extension changes the displayed name of vim windows

A friendly commenter suggested using :verbose set statusline?, so that I can find what line of my .vimrc was making this change. The response from vim was statusline=%{coc#status()}%{get(b:, '...
B1LLP4RK's user avatar
  • 105
4 votes

How to scroll down the output of coc help without using the mouse?

coc#util#float_scroll has been replaced by coc#float#scroll() The example keymapping has been given in the documentation. if has('nvim-0.4.3') || has('patch-8.2.0750') nnoremap <nowait>...
Yuki Yoshimine's user avatar
3 votes

How to format files on save using black with neovim and coc

I had the exact same issue. I solved it as below: Don't use black and isort from inside coc. Coc timeout issue mentioned by @Gorden Bai seems unresolved. My coc-settings.json: { "python....
Ashwin Mahantha's user avatar
3 votes
Accepted

Why use coc and not only the single plugins providing code completion for a language?

The advantage of generic plugins such as CoC is that they work for a wide range of filetypes; for example I normally write most of my code in Go and use the Go Language Server for this (via vim-lsc, ...
Martin Tournoij's user avatar
3 votes

Change color of CoC suggestion box

Example of black text on white background for Haskell files autocmd FileType haskell hi Pmenu ctermfg=Black ctermbg=White autocmd FileType haskell hi PmenuSel ctermfg=Black ctermbg=White autocmd ...
Eugene's user avatar
  • 131
3 votes
Accepted

On opening a .js file, auto completion is working but an error message is showing on startup

As Tae pointed, that's not really about vim, nor CoC. This message is displayed (most probably) because you have no .eslint nor .eslint.json, which are needed for CoC to use the linter. First, you'...
Biggybi's user avatar
  • 2,760
3 votes
Accepted

How to remap command based on buffer type?

You can use the <buffer> argument to restrict a map to a certain filetype, see :help :map-local for details. Fugitive's status filetype is fugitive, so you can try: augroup FugitiveMappings ...
Tae's user avatar
  • 2,135
3 votes

(coc-)vimtex .bib completion strange suggstions

The problem here is that you are mixing two types of completion "backends": The built-in omni completion and the automatic completion by coc.nvim. VimTeX provides an omni-complete function ...
Karl Yngve Lervåg's user avatar
3 votes

Create highlight group that modifies an existing one

There's no way to do this directly with highlight! since links and groups are fundamentally different. You can have a highlight that is a link or a highlight with properties, you can't have both. ...
Mass's user avatar
  • 14.1k
3 votes
Accepted

Automatically add parentheses to functions on Tab using coc.nvim autocompletion

To have Tab trigger completion like Enter, bind it to coc#_select_confirm()(CoC's accept completion function): inoremap <expr> <Tab> pumvisible() ? coc#_select_confirm() : "\<Tab&...
unrealapex's user avatar
3 votes
Accepted

Neovim keep html tags indented in react/jsx files

I just found an solution after a lot more searching on google. using treesiter and adding this into the treesitter config got my desired behaviour: require'nvim-treesitter.configs'.setup { indent =...
user44767's user avatar
3 votes
Accepted

What is the meaning of [LS] and other symbols in Vim completion menu?

I believe it provides you hint about the source of the suggestion: [A] the word is used in this buffer [B] the word is used in another buffer [F] the suggestion comes from the file system [S] the ...
Vivian De Smedt's user avatar
3 votes
Accepted

What is the arrow notation in the start of some lines in Vim?

They are column signs set by Coc to highlight warnings or errors detected by the language server. You can control their appearance using the :CocConfig command that let you edit the ~\vimfiles\coc-...
Vivian De Smedt's user avatar
2 votes
Accepted

Set CoC nodejs path dynamically

Perhaps I should have searched the internet more before I asked this question. I was able to accomplish what I needed using the system function. So here I needed to do: let g:coc_node_path = ...
hyde's user avatar
  • 155
2 votes

Multiple plugin managers

Plug-in managers are largely interoperable in Vim, all modern plug-in managers work by updating 'runtimepath' to include the root of the plug-in in the list of paths, which is how Pathogen works (you ...
filbranden's user avatar
  • 28.9k
2 votes
Accepted

How to press ESC only once to close suggestions list and exit insert mode

It turns out it was another plugin causing the interference: townk/vim-autoclose. After uninstalling it, the issue went away. I am now using jiangmiao/auto-pairs without problems.
Christian's user avatar
2 votes

What is the "stuck text" that happens on my screen as a byproduct of a plugin? How can I remove it?

I was breaking my head trying to debug this. It turns out it was a problem with my vim colorscheme. I was using Monokai from vim-colorschemes. In the definition for PMenu it specifies all colours as ...
revelationnow's user avatar
2 votes

CoC Python reports unresolved import in git subfolder

CoC assumes that a directory containing .git/ is the root of your project. According to the CoC docs: Unlike VSCode vim doesn't have workspace support. The solution is resolve workspace folders ...
LondonRob's user avatar
2 votes

Unmap <c-n> / <c-p> in completion menu to use as previous / next snippet placeholder with Coc

Hey not a long time ago I was also looking to have the same setup as yours and ended up with this config. Although I ended up using <c-j> and <c-k> for navigating the completion list and ...
mackarelfish's user avatar
2 votes
Accepted

Sending two keys in series during autocompletion confirmation

One can use a timer to prevent keys from being pressed simultaneously. For example, inoremap <C-a> <C-y><Esc>:call timer_start(100, {-> feedkeys("a ")})<CR> will ...
husB's user avatar
  • 2,113

Only top scored, non community-wiki answers of a minimum length are eligible