kandi background
Explore Kits

coc.nvim | Nodejs extension host for vim & neovim , load extensions | Code Editor library

 by   neoclide TypeScript Version: v0.0.80 License: Non-SPDX

 by   neoclide TypeScript Version: v0.0.80 License: Non-SPDX

Download this library from

kandi X-RAY | coc.nvim Summary

coc.nvim is a TypeScript library typically used in Editor, Code Editor, Visual Studio Code applications. coc.nvim has no bugs, it has no vulnerabilities and it has medium support. However coc.nvim has a Non-SPDX License. You can download it from GitHub.
Make your Vim/Neovim as smart as VSCode.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • coc.nvim has a medium active ecosystem.
  • It has 19503 star(s) with 786 fork(s). There are 136 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 15 open issues and 2630 have been closed. On average issues are closed in 2 days. There are 5 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of coc.nvim is v0.0.80
coc.nvim Support
Best in #Code Editor
Average in #Code Editor
coc.nvim Support
Best in #Code Editor
Average in #Code Editor

quality kandi Quality

  • coc.nvim has 0 bugs and 0 code smells.
coc.nvim Quality
Best in #Code Editor
Average in #Code Editor
coc.nvim Quality
Best in #Code Editor
Average in #Code Editor

securitySecurity

  • coc.nvim has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • coc.nvim code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
coc.nvim Security
Best in #Code Editor
Average in #Code Editor
coc.nvim Security
Best in #Code Editor
Average in #Code Editor

license License

  • coc.nvim has a Non-SPDX License.
  • Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.
coc.nvim License
Best in #Code Editor
Average in #Code Editor
coc.nvim License
Best in #Code Editor
Average in #Code Editor

buildReuse

  • coc.nvim releases are available to install and integrate.
  • Installation instructions, examples and code snippets are available.
coc.nvim Reuse
Best in #Code Editor
Average in #Code Editor
coc.nvim Reuse
Best in #Code Editor
Average in #Code Editor
Top functions reviewed by kandi - BETA

kandi has reviewed coc.nvim and discovered the below as its top functions. This is intended to give you an instant insight into coc.nvim implemented functionality, and help decide if they suit your requirements.

  • Gets a key from a key .
  • Watch build .
  • creates a sequence of sequences
  • Send the command callback

coc.nvim Key Features

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.

Quick Start

copy iconCopydownload iconDownload
curl -sL install-node.vercel.app/lts | bash

Example vim configuration

copy iconCopydownload iconDownload
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
" unicode characters in the file autoload/float.vim
set encoding=utf-8

" TextEdit might fail if hidden is not set.
set hidden

" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup

" Give more space for displaying messages.
set cmdheight=2

" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300

" Don't pass messages to |ins-completion-menu|.
set shortmess+=c

" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("nvim-0.5.0") || has("patch-8.1.1564")
  " Recently vim can merge signcolumn and number column into one
  set signcolumn=number
else
  set signcolumn=yes
endif

" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Use <c-space> to trigger completion.
if has('nvim')
  inoremap <silent><expr> <c-space> coc#refresh()
else
  inoremap <silent><expr> <c-@> coc#refresh()
endif

" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>

function! s:show_documentation()
  if (index(['vim','help'], &filetype) >= 0)
    execute 'h '.expand('<cword>')
  elseif (coc#rpc#ready())
    call CocActionAsync('doHover')
  else
    execute '!' . &keywordprg . " " . expand('<cword>')
  endif
endfunction

" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')

" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)

" Formatting selected code.
xmap <leader>f  <Plug>(coc-format-selected)
nmap <leader>f  <Plug>(coc-format-selected)

augroup mygroup
  autocmd!
  " Setup formatexpr specified filetype(s).
  autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  " Update signature help on jump placeholder.
  autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end

" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a  <Plug>(coc-codeaction-selected)
nmap <leader>a  <Plug>(coc-codeaction-selected)

" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac  <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf  <Plug>(coc-fix-current)

" Run the Code Lens action on the current line.
nmap <leader>cl  <Plug>(coc-codelens-action)

" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)

" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
  nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
  inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
  inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
  vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif

" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)

" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')

" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call     CocAction('fold', <f-args>)

" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR   :call     CocActionAsync('runCommand', 'editor.action.organizeImport')

" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a  :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e  :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c  :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o  :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s  :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j  :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k  :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p  :<C-u>CocListResume<CR>

How do I persistently change coc.nvim colours from my ~/.config/nvim/init.vim?

copy iconCopydownload iconDownload
func! s:my_colors_setup() abort
  highlight CocFloating ctermbg=color " For background color
  highlight CocErrorFloat ctermfg=color " For text color
endfunc

augroup colorscheme_coc_setup | au!
  au VimEnter * call s:my_colors_setup()
augroup END

Open file with new tab but [no name] is always there in vim

copy iconCopydownload iconDownload
ESC gt :tabclose

Trying to Configure pyls through nvim-lspconfig

copy iconCopydownload iconDownload
pip install 'python-lsp-server[all]'
lua require('lspconfig').pyls.setup{}
lua require('lspconfig').pylsp.setup{}
-----------------------
pip install 'python-lsp-server[all]'
lua require('lspconfig').pyls.setup{}
lua require('lspconfig').pylsp.setup{}
-----------------------
pip install 'python-lsp-server[all]'
lua require('lspconfig').pyls.setup{}
lua require('lspconfig').pylsp.setup{}

How to remap coc.nvim autocomplete key?

copy iconCopydownload iconDownload
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<CR>"
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> [the key that you want to autocomplete] pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<cr>"
inoremap <silent><expr> [this is the current autocompletion key] "\<c-g>u\[this is the bind that I am giving to the key]"
-----------------------
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<CR>"
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> [the key that you want to autocomplete] pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<cr>"
inoremap <silent><expr> [this is the current autocompletion key] "\<c-g>u\[this is the bind that I am giving to the key]"
-----------------------
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<CR>"
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> [the key that you want to autocomplete] pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<cr>"
inoremap <silent><expr> [this is the current autocompletion key] "\<c-g>u\[this is the bind that I am giving to the key]"
-----------------------
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<CR>"
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> [the key that you want to autocomplete] pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<cr>"
inoremap <silent><expr> [this is the current autocompletion key] "\<c-g>u\[this is the bind that I am giving to the key]"
-----------------------
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<CR>"
inoremap <silent><expr> <tab> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> [the key that you want to autocomplete] pumvisible() ? coc#_select_confirm() : "\<C-g>u\<TAB>"
inoremap <silent><expr> <cr> "\<c-g>u\<cr>"
inoremap <silent><expr> [this is the current autocompletion key] "\<c-g>u\[this is the bind that I am giving to the key]"

Unable to see color in vim after upgrade

copy iconCopydownload iconDownload
highlight Comment ctermfg=240 guifg=#585858

What improvements can I do to my .vimrc to improve my experience in NeoVim?

copy iconCopydownload iconDownload
"==== PLUGINS =================================================================
set nocompatible " don't try to be compatible with Vi
filetype plugin indent on " use default plugins

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

" plugins I would put in a new vimrc
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'vim-scripts/ReplaceWithRegister'
Plugin 'flazz/vim-colorschemes'

"==== CUSTOM CONFIGURATIONS ===================================================
"- general settings -----------------------------------------------------------
set encoding=utf-8
set linebreak " wrap long lines at char in 'breakat' (default " ^I!@*-+;:,./?")
set nowrap " don't wrap lines by default
set expandtab " expand tabs into spaces
set tabstop=4 " a tab is the same as 4 spaces
set softtabstop=4 " when I hit <tab> in insert mode, put 4 spaces
set shiftwidth=4 " when auto-indenting, use 4 spaces per tab
set autoindent " when creating a new line, copy indent from line above
set incsearch " show matches for patterns while they are being typed
set smartcase " with both on, searches with no capitals are case insensitive...
set ignorecase " ...while searches with capital characters are case sensitive.
set spell spelllang=en
set nospell " don't hightlight misspellings unles I say so
set lazyredraw " don't redraw screen during macros (let them complete faster)
set t_Co=256 " use full colours
syntax enable " highlight special words to aid readability

colorscheme zenburn
 


" THIS NEXT BIT I DEBATED INCLUDING - IT'S MY PERSONAL PREFERENCE AND BY
NO MEANS 'NECESSARY' AND COULD SAFELY BE EXCLUDED... BUT I JUST HATED THE
BLOCK CURSOR IN INSERT MODE SO MUCH...

"- cursor behaviour (make cursor blink for insert mode, block for normal mode)
augroup cursor_behaviour
    autocmd!
    " reset cursor on start:
    autocmd VimEnter * silent !echo -ne "\e[2 q"
    " cursor blinking bar on insert mode
    let &t_SI = "\e[5 q"
    " cursor steady block on command mode
    let &t_EI = "\e[2 q"
    " highlight current line when in insert mode
    autocmd InsertEnter * set cursorline
    " turn off current line hightlighting when leaving insert mode
    autocmd InsertLeave * set nocursorline
augroup END

CoC: Diagnostic window takes over screen

copy iconCopydownload iconDownload
" Auto adjust window sizes when they become current {{{2
set winwidth=84
set winheight=5
set winminheight=5
set winheight=999
" }}} End section

How to make `coc-python` complete virtual environment's module with `jedi`

copy iconCopydownload iconDownload
"python.pythonPath": "python",

Neovim: How do I fix indentation for JavaScript inside HTML?

copy iconCopydownload iconDownload
{
  "coc.preferences.formatOnSaveFiletypes": [
    "javascript"
  ]
}
-----------------------
augroup Indentation
    autocmd!
    autocmd FileType javascript set shiftwidth=2
augroup END

Custom Nix derivation for vim plugin fails

copy iconCopydownload iconDownload
{ pkgs, fetchFromGitHub }:

pkgs.vimUtils.buildVimPlugin {
  pname = "coc-nvim";
  version = "v0.80";

  src = fetchFromGitHub {
    owner = "neoclide";
    repo = "coc.nvim";
    rev = "v0.0.80";
    sha256 = "1c2spdx4jvv7j52f37lxk64m3rx7003whjnra3y1c7m2d7ljs6rb";
  };
}

with import <nixpkgs> {};
let coc = callPackage ./coc-plugin.nix { };
in
{
  enable = true;
  viAlias = true;
  vimAlias = true;
  withNodeJs = false;
  plugins =  with pkgs.vimPlugins;[
    coc
    fzf-vim
    more-plugins
  ];
  extraConfig = ''
    unlet! skip_defaults_vim
    " ... more config
  '';
}

-----------------------
{ pkgs, fetchFromGitHub }:

pkgs.vimUtils.buildVimPlugin {
  pname = "coc-nvim";
  version = "v0.80";

  src = fetchFromGitHub {
    owner = "neoclide";
    repo = "coc.nvim";
    rev = "v0.0.80";
    sha256 = "1c2spdx4jvv7j52f37lxk64m3rx7003whjnra3y1c7m2d7ljs6rb";
  };
}

with import <nixpkgs> {};
let coc = callPackage ./coc-plugin.nix { };
in
{
  enable = true;
  viAlias = true;
  vimAlias = true;
  withNodeJs = false;
  plugins =  with pkgs.vimPlugins;[
    coc
    fzf-vim
    more-plugins
  ];
  extraConfig = ''
    unlet! skip_defaults_vim
    " ... more config
  '';
}

Community Discussions

Trending Discussions on coc.nvim
  • How do I persistently change coc.nvim colours from my ~/.config/nvim/init.vim?
  • coc.nvim doesn't work when I split a window in vim
  • Neovim CoC Popup overflow with dashes
  • Open file with new tab but [no name] is always there in vim
  • How to get Pylint to display code smells in coc.nvim ? (Refactor issues)
  • Trying to Configure pyls through nvim-lspconfig
  • nvim with coc and formatting for python
  • vim-go with coc.nvim: how to rename a package?
  • coc.nvim: 'self', numbers([0-9]) and strings don't show in CocAction(doHover) show_documentation(?)
  • How to remap coc.nvim autocomplete key?
Trending Discussions on coc.nvim

QUESTION

How do I persistently change coc.nvim colours from my ~/.config/nvim/init.vim?

Asked 2022-Mar-14 at 14:51

I understand that I can change my coc.nvim colours from inside neovim, but how do I do so permanently from the init.vim file (or otherwise), so that they're changed automatically every time I open the editor?

Default colours poor for legibility:

enter image description here

ANSWER

Answered 2022-Mar-14 at 14:51

My solution comes from the stackoverflow post you shared, this vi stackexchange post and learning a bit of vimscript with learning vimscript the hard way.

On your init.vim file you can write the following:

func! s:my_colors_setup() abort
  highlight CocFloating ctermbg=color " For background color
  highlight CocErrorFloat ctermfg=color " For text color
endfunc

augroup colorscheme_coc_setup | au!
  au VimEnter * call s:my_colors_setup()
augroup END

This works by calling the highlight command on a function that gets called when vim starts.

CocErrorFloat changes the text color for error popups, you could also change warnings, infos and hints with CocWarningFloat, CocInfoFloat and CocHintFloat respectively.

Source https://stackoverflow.com/questions/71429087

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install coc.nvim

Install nodejs >= 12.12:. in your .vimrc or init.vim, then restart Vim and run :PlugInstall. Checkout Install coc.nvim for more info. You have to install coc extension or configure language servers for LSP support.
Completion with sources
Using the configuration file
Using coc extensions
Configure language servers
F.A.Q

Support

If you think Coc is useful, consider giving it a star.If you have a question, ask on gitter中文用户请到 中文 gitter 讨论If something is not working, create an issue.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Compare Code Editor Libraries with Highest Support
Compare Code Editor Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.