Convert Figma logo to code with AI

neoclide logococ.nvim

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

24,306
954
24,306
37

Top Related Projects

33,891

:hibiscus: Minimalist Vim Plugin Manager

Vundle, the plug-in manager for Vim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config

13,952

💤 A modern plugin manager for Neovim

13,476

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support

3,103

async language server protocol plugin for vim and neovim

Quick Overview

coc.nvim is an Intellisense engine for Vim/Neovim, providing full language server protocol support and asynchronous completion. It aims to make your Vim/Neovim as smart as VSCode, offering features like auto-completion, diagnostics, and code actions.

Pros

  • Extensive language server protocol (LSP) support
  • Asynchronous completion for better performance
  • Highly customizable with a wide range of extensions
  • Active development and community support

Cons

  • Steeper learning curve compared to some other Vim plugins
  • Requires Node.js to be installed on the system
  • Can be resource-intensive, especially on older hardware
  • Some users report occasional stability issues

Getting Started

  1. Install Node.js (>= 14.14)
  2. Install coc.nvim using your preferred Vim plugin manager. For example, with vim-plug:
Plug 'neoclide/coc.nvim', {'branch': 'release'}
  1. Add basic configuration to your init.vim or .vimrc:
" Use tab for trigger completion with characters ahead and navigate
inoremap <silent><expr> <TAB>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"

" Make <CR> to accept selected completion item or notify coc.nvim to format
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

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

" Use `[g` and `]g` to navigate diagnostics
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)
  1. Install language servers for your preferred languages:
:CocInstall coc-json coc-tsserver coc-pyright
  1. Restart Vim and start coding with enhanced intelligence!

Competitor Comparisons

33,891

:hibiscus: Minimalist Vim Plugin Manager

Pros of vim-plug

  • Lightweight and fast plugin manager focused solely on plugin management
  • Simple and intuitive configuration syntax
  • Supports parallel installation and updating of plugins

Cons of vim-plug

  • Limited to plugin management, lacks advanced IDE-like features
  • Requires manual configuration for complex setups
  • No built-in language server protocol (LSP) support

Code Comparison

vim-plug:

call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'junegunn/seoul256.vim'
call plug#end()

coc.nvim:

let g:coc_global_extensions = [
  \ 'coc-tsserver',
  \ 'coc-json',
  \ 'coc-html',
  \ 'coc-css'
  \ ]

Summary

vim-plug is a lightweight, fast plugin manager for Vim/Neovim that excels at simplifying plugin installation and management. It offers a straightforward configuration syntax and parallel plugin operations. However, it focuses solely on plugin management and lacks advanced features like LSP support.

coc.nvim, on the other hand, is a comprehensive IDE-like layer for Vim/Neovim. It provides intelligent code completion, diagnostics, and language server protocol integration out of the box. While more complex to set up initially, coc.nvim offers a richer development environment with features similar to modern IDEs.

Choose vim-plug for a minimalist approach to plugin management, or opt for coc.nvim if you desire a more full-featured, IDE-like experience within Vim/Neovim.

Vundle, the plug-in manager for Vim

Pros of Vundle.vim

  • Lightweight and simple to use
  • Focuses solely on plugin management
  • Well-established and widely adopted in the Vim community

Cons of Vundle.vim

  • Limited functionality beyond plugin management
  • Lacks advanced features like code completion and diagnostics
  • Not actively maintained (last commit in 2019)

Code Comparison

Vundle.vim configuration:

set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Add other plugins here
call vundle#end()
filetype plugin indent on

coc.nvim configuration:

" Install extensions
:CocInstall coc-json coc-tsserver

" Configure language servers
let g:coc_global_extensions = ['coc-json', 'coc-tsserver']

" Use tab for trigger completion
inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()

While Vundle.vim focuses on plugin management with a straightforward configuration, coc.nvim offers more advanced features like code completion and diagnostics, requiring a more complex setup but providing enhanced functionality for modern development workflows.

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config

Pros of packer.nvim

  • Lightweight and fast plugin manager specifically designed for Neovim
  • Supports lazy loading and conditional loading of plugins
  • Written in Lua, aligning with Neovim's direction

Cons of packer.nvim

  • Limited to plugin management, lacks built-in LSP and completion features
  • Steeper learning curve for users new to Lua-based configuration

Code Comparison

packer.nvim configuration:

use {
  'nvim-treesitter/nvim-treesitter',
  run = ':TSUpdate'
}

coc.nvim configuration:

Plug 'neoclide/coc.nvim', {'branch': 'release'}

Summary

packer.nvim is a lightweight, Lua-based plugin manager for Neovim, offering efficient plugin management with lazy loading capabilities. It's ideal for users comfortable with Lua and seeking a minimalist approach. coc.nvim, on the other hand, is a comprehensive solution that includes LSP support and intelligent completion out of the box, making it more suitable for users who prefer an all-in-one package with easier setup. The choice between them depends on the user's preferences for configuration style and desired features.

13,952

💤 A modern plugin manager for Neovim

Pros of lazy.nvim

  • Faster startup time and better performance optimization
  • More modular and extensible plugin management system
  • Supports lazy-loading of plugins, reducing initial load time

Cons of lazy.nvim

  • Steeper learning curve for configuration compared to coc.nvim
  • Less comprehensive out-of-the-box language server support
  • May require more manual setup for certain features

Code Comparison

lazy.nvim configuration:

require("lazy").setup({
  "folke/which-key.nvim",
  { "folke/neoconf.nvim", cmd = "Neoconf" },
  "folke/neodev.nvim",
})

coc.nvim configuration:

let g:coc_global_extensions = [
  \ 'coc-json',
  \ 'coc-tsserver',
  \ 'coc-eslint',
  \ 'coc-prettier'
  \ ]

Both lazy.nvim and coc.nvim are popular Neovim plugins, but they serve different purposes. lazy.nvim focuses on efficient plugin management and performance optimization, while coc.nvim provides a more comprehensive language server protocol (LSP) integration and autocompletion framework. The choice between them depends on the user's specific needs and preferences for their Neovim setup.

13,476

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support

Pros of ALE

  • Lightweight and fast, with minimal impact on Vim/Neovim performance
  • Works out-of-the-box with many linters and fixers without additional configuration
  • Supports a wide range of programming languages and tools

Cons of ALE

  • Less comprehensive language server protocol (LSP) support compared to coc.nvim
  • Configuration can be more complex for advanced use cases
  • Limited autocompletion capabilities without additional plugins

Code Comparison

ALE configuration example:

let g:ale_linters = {
\   'javascript': ['eslint'],
\   'python': ['flake8'],
\}
let g:ale_fixers = {
\   '*': ['remove_trailing_lines', 'trim_whitespace'],
\   'javascript': ['eslint'],
\}

coc.nvim configuration example:

let g:coc_global_extensions = [
  \ 'coc-tsserver',
  \ 'coc-eslint',
  \ 'coc-prettier',
  \ 'coc-json',
  \ ]

Both ALE and coc.nvim are popular Vim/Neovim plugins for code checking and completion. ALE focuses on asynchronous linting and fixing, while coc.nvim provides a more comprehensive LSP client with advanced features like intelligent code completion and refactoring support.

3,103

async language server protocol plugin for vim and neovim

Pros of vim-lsp

  • Lightweight and minimalistic, with a smaller footprint
  • Easier to customize and integrate with existing Vim configurations
  • Better performance on older or resource-constrained systems

Cons of vim-lsp

  • Less extensive language server support out-of-the-box
  • Requires more manual configuration for advanced features
  • Smaller community and ecosystem compared to coc.nvim

Code Comparison

vim-lsp configuration:

let g:lsp_signs_enabled = 1
let g:lsp_diagnostics_echo_cursor = 1
if executable('pyls')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'pyls',
        \ 'cmd': {server_info->['pyls']},
        \ 'whitelist': ['python'],
        \ })
endif

coc.nvim configuration:

let g:coc_global_extensions = ['coc-pyright', 'coc-json', 'coc-tsserver']
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)

The code comparison shows that vim-lsp requires more manual configuration for language servers, while coc.nvim offers a more streamlined setup with global extensions and keybindings. vim-lsp's approach gives users more control over individual language server settings, whereas coc.nvim provides a more integrated and user-friendly experience out-of-the-box.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Logo

Make your Vim/Neovim as smart as VS Code

Software License Actions Codecov Coverage Status Doc Matrix


Custom coc popup menu with snippet support

Custom popup menu with snippet support

Why?

Quick Start

Make sure use Vim >= 9.0.0438 or Neovim >= 0.8.0.

Install nodejs >= 16.18.0:

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

For vim-plug users:

" Use release branch (recommended)
Plug 'neoclide/coc.nvim', {'branch': 'release'}

" Or build from source code by using npm
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'npm ci'}

in your .vimrc or init.vim, then restart Vim and run :PlugInstall.

Checkout Install coc.nvim for more info.

You have to install coc extensions or configure language servers for LSP support.

Install extensions like this:

:CocInstall coc-json coc-tsserver

Or you can configure a language server in your coc-settings.json(open it using :CocConfig) like this:

{
  "languageserver": {
    "go": {
      "command": "gopls",
      "rootPatterns": ["go.mod"],
      "trace.server": "verbose",
      "filetypes": ["go"]
    }
  }
}

Checkout the wiki for more details:

Checkout :h coc-nvim for Vim interface.

Example Vim configuration

Configuration is required to make coc.nvim easier to work with, since it doesn't change your key-mappings or Vim options. This is done as much as possible to avoid conflict with your other plugins.

❗️Important: Some Vim plugins can change your key mappings. Please use command like:verbose imap <tab> to make sure that your keymap has taken effect.

" https://raw.githubusercontent.com/neoclide/coc.nvim/master/doc/coc-example-config.vim

" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count
" utf-8 byte sequence
set encoding=utf-8
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup

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

" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved
set signcolumn=yes

" Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" 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>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"

" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

function! CheckBackspace() 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

" 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 ShowDocumentation()<CR>

function! ShowDocumentation()
  if CocAction('hasProvider', 'hover')
    call CocActionAsync('doHover')
  else
    call feedkeys('K', 'in')
  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 code actions to the selected code block
" Example: `<leader>aap` for current paragraph
xmap <leader>a  <Plug>(coc-codeaction-selected)
nmap <leader>a  <Plug>(coc-codeaction-selected)

" Remap keys for applying code actions at the cursor position
nmap <leader>ac  <Plug>(coc-codeaction-cursor)
" Remap keys for apply code actions affect whole buffer
nmap <leader>as  <Plug>(coc-codeaction-source)
" Apply the most preferred quickfix action to fix diagnostic on the current line
nmap <leader>qf  <Plug>(coc-fix-current)

" Remap keys for applying refactor code actions
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
xmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)
nmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)

" 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> to 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>

Example Lua configuration

NOTE: This only works in Neovim 0.7.0dev+.

-- https://raw.githubusercontent.com/neoclide/coc.nvim/master/doc/coc-example-config.lua

-- Some servers have issues with backup files, see #649
vim.opt.backup = false
vim.opt.writebackup = false

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

-- Always show the signcolumn, otherwise it would shift the text each time
-- diagnostics appeared/became resolved
vim.opt.signcolumn = "yes"

local keyset = vim.keymap.set
-- Autocomplete
function _G.check_back_space()
    local col = vim.fn.col('.') - 1
    return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
end

-- Use Tab for trigger completion with characters ahead and navigate
-- NOTE: There's always a completion item selected by default, you may want to enable
-- no select by setting `"suggest.noselect": true` in your configuration file
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
-- other plugins before putting this into your config
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)

-- Make <CR> to accept selected completion item or notify coc.nvim to format
-- <C-g>u breaks current undo, please make your own choice
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)

-- Use <c-j> to trigger snippets
keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)")
-- Use <c-space> to trigger completion
keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})

-- Use `[g` and `]g` to navigate diagnostics
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})

-- GoTo code navigation
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})


-- Use K to show documentation in preview window
function _G.show_docs()
    local cw = vim.fn.expand('<cword>')
    if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
        vim.api.nvim_command('h ' .. cw)
    elseif vim.api.nvim_eval('coc#rpc#ready()') then
        vim.fn.CocActionAsync('doHover')
    else
        vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
    end
end
keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})


-- Highlight the symbol and its references on a CursorHold event(cursor is idle)
vim.api.nvim_create_augroup("CocGroup", {})
vim.api.nvim_create_autocmd("CursorHold", {
    group = "CocGroup",
    command = "silent call CocActionAsync('highlight')",
    desc = "Highlight symbol under cursor on CursorHold"
})


-- Symbol renaming
keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})


-- Formatting selected code
keyset("x", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
keyset("n", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})


-- Setup formatexpr specified filetype(s)
vim.api.nvim_create_autocmd("FileType", {
    group = "CocGroup",
    pattern = "typescript,json",
    command = "setl formatexpr=CocAction('formatSelected')",
    desc = "Setup formatexpr specified filetype(s)."
})

-- Update signature help on jump placeholder
vim.api.nvim_create_autocmd("User", {
    group = "CocGroup",
    pattern = "CocJumpPlaceholder",
    command = "call CocActionAsync('showSignatureHelp')",
    desc = "Update signature help on jump placeholder"
})

-- Apply codeAction to the selected region
-- Example: `<leader>aap` for current paragraph
local opts = {silent = true, nowait = true}
keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)

-- Remap keys for apply code actions at the cursor position.
keyset("n", "<leader>ac", "<Plug>(coc-codeaction-cursor)", opts)
-- Remap keys for apply source code actions for current file.
keyset("n", "<leader>as", "<Plug>(coc-codeaction-source)", opts)
-- Apply the most preferred quickfix action on the current line.
keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts)

-- Remap keys for apply refactor code actions.
keyset("n", "<leader>re", "<Plug>(coc-codeaction-refactor)", { silent = true })
keyset("x", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
keyset("n", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })

-- Run the Code Lens actions on the current line
keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts)


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


-- Remap <C-f> and <C-b> to scroll float windows/popups
---@diagnostic disable-next-line: redefined-local
local opts = {silent = true, nowait = true, expr = true}
keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
keyset("i", "<C-f>",
       'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
keyset("i", "<C-b>",
       'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)


-- Use CTRL-S for selections ranges
-- Requires 'textDocument/selectionRange' support of language server
keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true})


-- Add `:Format` command to format current buffer
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})

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

-- Add `:OR` command for organize imports of the current buffer
vim.api.nvim_create_user_command("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
vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")

-- Mappings for CoCList
-- code actions and coc stuff
---@diagnostic disable-next-line: redefined-local
local opts = {silent = true, nowait = true}
-- Show all diagnostics
keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts)
-- Manage extensions
keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts)
-- Show commands
keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts)
-- Find symbol of current document
keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts)
-- Search workspace symbols
keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts)
-- Do default action for next item
keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts)
-- Do default action for previous item
keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts)
-- Resume latest coc list
keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts)

Articles

Troubleshooting

Try these steps if you experience problems with coc.nvim:

  • Ensure your Vim version >= 8.0 using :version
  • If a service failed to start, use :CocInfo or :checkhealth if you use Neovim
  • Checkout the log of coc.nvim with :CocOpenLog
  • If you have issues with the language server, it's recommended to checkout the language server output

Feedback

Backers

Become a backer and get your image on our README on GitHub with a link to your site.

Contributors

Qiming zhao
Qiming zhao

💻
Heyward Fann
Heyward Fann

💻
Raidou
Raidou

💻
kevinhwang91
kevinhwang91

💻
年糕小豆汤
年糕小豆汤

💻
Avi Dessauer
Avi Dessauer

💻
最上川
最上川

💻
Yatao Li
Yatao Li

💻
wongxy
wongxy

💻
Sam McCall
Sam McCall

💻
Samuel Roeca
Samuel Roeca

💻
Amirali Esmaeili
Amirali Esmaeili

💻
Jack Rowlingson
Jack Rowlingson

💻
Jaehwang Jung
Jaehwang Jung

💻
Antoine
Antoine

💻
Cosmin Popescu
Cosmin Popescu

💻
Duc Nghiem Xuan
Duc Nghiem Xuan

💻
Francisco Lopes
Francisco Lopes

💻
daquexian
daquexian

💻
dependabot[bot]
dependabot[bot]

💻
greenkeeper[bot]
greenkeeper[bot]

💻
Chris Kipp
Chris Kipp

💻
Dmytro Meleshko
Dmytro Meleshko

💻
Kirill Bobyrev
Kirill Bobyrev

💻
Gontran Baerts
Gontran Baerts

💻
Andy
Andy

💻
Cheng JIANG
Cheng JIANG

💻
Corin
Corin

💻
Daniel Zhang
Daniel Zhang

💻
Ferdinand Bachmann
Ferdinand Bachmann

💻
Guangqing Chen
Guangqing Chen

💻
Jade Meskill
Jade Meskill

💻
Jasper Poppe
Jasper Poppe

💻
Jean Jordaan
Jean Jordaan

💻
Kid
Kid

💻
Pieter van Loon
Pieter van Loon

💻
Robert Liebowitz
Robert Liebowitz

💻
Seth Messer
Seth Messer

💻
UncleBill
UncleBill

💻
ZERO
ZERO

💻
fsouza
fsouza

💻
XiaoZhang
XiaoZhang

💻
whyreal
whyreal

💻
yehuohan
yehuohan

💻
バクダンくん
バクダンくん

💻
Raphael
Raphael

💻
tbodt
tbodt

💻
Aaron McDaid
Aaron McDaid

💻
Aasif Versi
Aasif Versi

💻
Abner Silva
Abner Silva

💻
Adam Stankiewicz
Adam Stankiewicz

💻
Adamansky Anton
Adamansky Anton

💻
Ahmed El Gabri
Ahmed El Gabri

💻
Alexandr Kondratev
Alexandr Kondratev

💻
Andrew Shim
Andrew Shim

💻
Andy Lindeman
Andy Lindeman

💻
Augustin
Augustin

💻
Bastien Orivel
Bastien Orivel

💻
Ben Lu
Ben Lu

💻
Ben
Ben

💻
Brendan Roy
Brendan Roy

💻
brianembry
brianembry

💻
br
br

💻
Cason Adams
Cason Adams

💻
Chang Y
Chang Y

💻
Chayoung You
Chayoung You

💻
Chen Lijun
Chen Lijun

💻
Chen Mulong
Chen Mulong

💻
Chris Weyl
Chris Weyl

💻
dezza
dezza

💻
Cody Allen
Cody Allen

💻
Damien Rajon
Damien Rajon

💻
Daniel Eriksson
Daniel Eriksson

💻
Daniel Jenson
Daniel Jenson

💻
David Mejorado
David Mejorado

💻
Deric Pang
Deric Pang

💻
Ding Tao
Ding Tao

💻
Doron Behar
Doron Behar

💻
Egor Kovetskiy
Egor Kovetskiy

💻
ElKowar
ElKowar

💻
Emeliov Dmitrii
Emeliov Dmitrii

💻
Fabian Becker
Fabian Becker

💻
FallenWarrior2k
FallenWarrior2k

💻
Fausto Núñez Alberro
Fausto Núñez Alberro

💻
Felipe Ramos
Felipe Ramos

💻
Fredrik Borg
Fredrik Borg

💻
Gavin Sim
Gavin Sim

💻
Gibson Fahnestock
Gibson Fahnestock

💻
Giovanni Giordano
Giovanni Giordano

💻
Gopal Adhikari
Gopal Adhikari

💻
Hanh Le
Hanh Le

💻
hedy
hedy

💻
Hendrik Lammers
Hendrik Lammers

💻
Henry Barreto
Henry Barreto

💻
Hugo
Hugo

💻
Jackie Li
Jackie Li

💻
Jakub Nowak
Jakub Nowak

💻
James Pickard
James Pickard

💻
Jia Sui
Jia Sui

💻
Ellie Hermaszewska
Ellie Hermaszewska

💻
Joel Bradshaw
Joel Bradshaw

💻
John Carlo Roberto
John Carlo Roberto

💻
Jonas Holst Damtoft
Jonas Holst Damtoft

💻
Jonathan Lehman
Jonathan Lehman

💻
Joosep Alviste
Joosep Alviste

💻
Josa Gesell
Josa Gesell

💻
Joshua Rubin
Joshua Rubin

💻
Julian Grinblat
Julian Grinblat

💻
Julian Valentin
Julian Valentin

💻
KabbAmine
KabbAmine

💻
Kay Gosho
Kay Gosho

💻
Kenny Huynh
Kenny Huynh

💻
Kevin Rambaud
Kevin Rambaud

💻
Kian Cross
Kian Cross

💻
Kristijan Husak
Kristijan Husak

💻
NullVoxPopuli
NullVoxPopuli

💻
Lasse Peters
Lasse Peters

💻
Noel Errenil
Noel Errenil

💻
LinArcX
LinArcX

💻
Liu-Cheng Xu
Liu-Cheng Xu

💻
Marc
Marc

💻
Marius Gawrisch
Marius Gawrisch

💻
Mark Hintz
Mark Hintz

💻
Mathieu Le Tiec
Mathieu Le Tiec

💻
Matt White
Matt White

💻
Matthew Evans
Matthew Evans

💻
Me1onRind
Me1onRind

💻
Qyriad
Qyriad

💻
Narcis B.
Narcis B.

💻
Neur1n
Neur1n

💻
Nicolas Dermine
Nicolas Dermine

💻
Noah
Noah

💻
PENG Rui
PENG Rui

💻
Paco
Paco

💻
Peng Guanwen
Peng Guanwen

💻
Petter Wahlman
Petter Wahlman

💻
Pooya Moradi
Pooya Moradi

💻
Quade Morrison
Quade Morrison

💻
Ralf Vogler
Ralf Vogler

💻
Ran Chen
Ran Chen

💻
Ricardo García Vega
Ricardo García Vega

💻
Rick Jones
Rick Jones

💻
Ryan Christian
Ryan Christian

💻
Salo
Salo

💻
Sam Nolan
Sam Nolan

💻
Saurav
Saurav

💻
Sean Mackesey
Sean Mackesey

💻
Sheel Patel
Sheel Patel

💻
Solomon Ng
Solomon Ng

💻
Sri Kadimisetty
Sri Kadimisetty

💻
Stephen Prater
Stephen Prater

💻
Sune Kibsgaard
Sune Kibsgaard

💻
Aquaakuma
Aquaakuma

💻
Takumi Kawase
Takumi Kawase

💻
The Blob SCP
The Blob SCP

💻
Tomasz N
Tomasz N

💻
Tomoyuki Harada
Tomoyuki Harada

💻
Tony Fettes
Tony Fettes

💻
Tony Narlock
Tony Narlock

💻
Tony Wang
Tony Wang

💻
Victor Quach
Victor Quach

💻
Whisperity
Whisperity

💻
William Turner
William Turner

💻
Xiaochao Dong
Xiaochao Dong

💻
Hugh Hou
Hugh Hou

💻
Jackie Li
Jackie Li

💻
Zachary Freed
Zachary Freed

💻
akiyosi
akiyosi

💻
alexjg
alexjg

💻
aste4
aste4

💻
clyfish
clyfish

💻
dev7ba
dev7ba

💻
diartyz
diartyz

💻
doza-daniel
doza-daniel

💻
equal-l2
equal-l2

💻
fong
fong

💻
hexh
hexh

💻
hhiraba
hhiraba

💻
ic-768
ic-768

💻
javiertury
javiertury

💻
karasu
karasu

💻
kevineato
kevineato

💻
Eduardo Costa
Eduardo Costa

💻
micchy326
micchy326

💻
midchildan
midchildan

💻
minefuto
minefuto

💻
miyanokomiya
miyanokomiya

💻
miyaviee
miyaviee

💻
monkoose
monkoose

💻 🐛
mujx
mujx

💻
mvilim
mvilim

💻
naruaway
naruaway

💻
piersy
piersy

💻
ryantig
ryantig

💻
rydesun
rydesun

💻
sc00ter
sc00ter

💻
smhc
smhc

💻
Sam Kaplan
Sam Kaplan

💻
tasuten
tasuten

💻
todesking
todesking

💻
typicode
typicode

💻
李鸣飞
李鸣飞

💻
Ikko Ashimine
Ikko Ashimine

📖
Rammiah
Rammiah

🐛
Alisue
Alisue

🐛
bigshans
bigshans

📖
Robert Boyd III
Robert Boyd III

🐛
Yuki Iwanaga
Yuki Iwanaga

💻
SpringHack
SpringHack

🐛
Lucas Burns
Lucas Burns

📖
qiqiboy
qiqiboy

💻
timsu92
timsu92

📖
Shawn M Moore
Shawn M Moore

💻
Aaron U'Ren
Aaron U'Ren

🐛
SeniorMars
SeniorMars

📖
牧羊犬真Q
牧羊犬真Q

📖
geraldspreer
geraldspreer

📖
Fabio
Fabio

📖
Li Yunting
Li Yunting

🐛
Jeff L.
Jeff L.

💻
Elliot Winkler
Elliot Winkler

💻

This project follows the all-contributors specification. Contributions of any kind are welcome!

License

Anti 996

NPM DownloadsLast 30 Days