laarmen / vim-coc-settings

My Vim settings for setting it up like an IDE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rico's Neovim + Coc settings

πŸ‘‹ Hey there, here's my setup on how I use coc.nvim to make my Vim work like an IDE.

I've been VSCode, Atom, Sublime, and other modern editors. They are fantastic! I love how I get automatic type hints, amazing auto-complete, inline documentation, and many things that Vim users may consider to be frivolous luxuries.

They're no Vim, though. VSCode's Vim emulation can be a bit slow (try doing 9j on vscode-vim, and try it on Vim itself). They also take a lot of memory, which can be too much for 4GB/8GB laptops.

Since coc.nvim came around, there's no need to compromise anymore. You can get IDE-like features in Vim, and here's how I did it!

Install Vim (and friends)

You need neovim (or vim 8.1+), nodejs and yarn. Coc's internals runs on Node.js.

Platform Command
macOS (via Homebrew) brew install nodejs neovim yarn
Arch Linux sudo pacman -Syu nodejs neovim yarn

I suggest using vim-plug to manage your dependencies.

Copy from the files here

The files in this repo are things you can merge into your Vim/Neovim configuration.

File Desrcpition
~/.config/nvim/init.vim List of plugins to load
~/.config/nvim/coc-settings.json Settings for coc-nvim
~/.config/nvim/after/plugin/coc.vim Key bindings and other Coc settings

If you're using Vim instead of Neovim, take what's in init.vim and place it in ~/.vimrc, and the config folder is ~/.vim instead of ~/.config/nvim.

Also see

Many of the configuration are lifted from almost-verbatim from Coc documentation. I highly recommend checking those out too.

Key bindings

See after/plugin/coc.vim for a full list of key bindings. Below are some of the features that I find to be most useful:

Key Description
gh β€” Show hint/documentation
Shows a hint for whatever's on the cursor. This means type definitions, JSDoc comments, and documentation (when available). Similar to VSCode's mouse over functionality.
space c r β€” Rename symbol
Rename whatever is on the cursor. Similar to VSCode's Rename Symbol command (F2).
ctrl-n β€” Code completion
Code completion just happens. ctrl-n and ctrl-p are default Vim key bindings for browsing through code completions.
space-cc-prettier β€” Prettier
Prettier formatting happens on every save, automatically! You can also trigger it manually via invoking Coc commands via space-c-c.
space c c β€” Show available commands
Fix tslint problems automatically, run Prettier manually, auto-fix eslint, and more.
-
space c x β€” Enable/disable extensions
If you don't need tsserver in your current project, you can temporarily disable them.
-
space c l β€” List errors
When you find errors, use this to shown them all
-

References

About

My Vim settings for setting it up like an IDE


Languages

Language:Vim Script 100.0%