Skip to content

Cocophotos/vim-cocophotos-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description

Vim config used for programming notably in:

  • TypeScript
  • CSS
  • HTML
  • VueJS
  • Python
  • Rust

Installation

You need a fairly recent version of NeoVim (0.3.x) to work. It is possible to make it work on Vim 8+ but it is not supported as is.

Just move the .vimrc into your $HOME and create the .vim directory

#Create the .vim directory
mkdir $HOME/.vim

#Move the config file .vimrc
# WARNING : this may erase an old .vimrc 
mv .vimrc $HOME/.vimrc

Then, you need to install VimPlug:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://github.com/raw/junegunn/vim-plug/master/plug.vim

This being done, you can install all the plugins (bundles).

Bundles installation

Basic install

To install the new bundle, open a terminal and type:

vim +PlugInstall

When complete, just type :q in Normal Mode to exit Vim.

CocConfig and CocInstall

Prerequisites

You should read the documentation of coc.nvim, but you need at least the latest LTS of Node.js (8.11.x) to make it work.

Install language servers

Then, you need to install the Language Servers for coc.nvim. Start vim and run the command:

:CocInstall coc-json coc-css coc-html coc-tsserver coc-eslint coc-ultisnips coc-python coc-vetur coc-tailwindcss coc-rls coc-rust-analyzer

This will install the language servers for:

  • JSON (coc-json)
  • CSS (coc-css)
  • HTML (coc-html)
  • TypeScript (+ the linting plugin) (coc-tsserver, coc-eslint)
  • Ultisnips (for snippets) (coc-utilsnips)
  • Python (coc-python)
  • VueJS (with vetur & coc-vetur)
  • TailwindCSS (coc-tailwindcss)
  • Rust (coc-rls & coc-rust-analyzer)

You can choose which language servers you want to install, but we always recommend:

  • JSON
  • Ultisnips

Install custom language servers

Some language servers need to be installed separately:

Our coc-config provides the right configuration for those languager servers.

Languages

  • For Rust you need to have rustup installed (see here) and change our config to enable:
{
    "rust-client.disableRustup": true
}

in coc-settings.json. Our config is made to be used with Nix & NixOS in a shell.

Copy/Paste coc-config

Open vim and execute the command:

:CocConfig

Then copy/paste the coc-settings.json content from this repository

Bundles description

Theming

We use Gruvbox as the default theme. It is free, has good constrast, we love it.

General purpose bundles

  • NerdTree: Tree file explorer. Use Ctrl+n to open the explorer
  • YankRing: Circular buffer for copy/pasting
  • vim-surround: Allow to change surrounding around text (parentheses, brackets, ...)
  • ctrlp.vim: Ctrlp is the most efficient and easy way to open buffers & files on Vim. With the stroke of binding you can easily search through all the different files available in the PWD and the best part is that you don’t even have to be precise while typing the name of the file or buffer.
  • vim-easymotion: Easy motion makes the process of moving around the lines in a document or piece of code much simpler by adding shortcuts to access different parts of the visible lines.
  • vim-airline: The famous status tabline for Vim
  • delimitMate: provides automatic closing of quotes, parenthesis, brackets, etc.
  • gundo: Gundo.vim is the Vim plugin to visualize your Vim undo tree.
  • rainbow_parentheses: Coloring parentheses (brackets, ...) when they are mingled
  • tabular: Allow fast tabularization of input

Text object bundles

We have several text object plugins to help text blocks selection and formatting. Also, we have those plugins:

Development

Apart from coc.nvim, we have support for:

  • C++11 (syntax highlighting)
  • Shell Fish (syntax)
  • VueJs (syntax hightlighting)
  • CMake support
  • PEP8 indentation for Python
  • TypeScript/JavaScript (syntax hightlighting)
  • Nix (syntax hightlighting)

Cheat sheet

  • <Leader> is ,
  • Using tab in command mode switch between Windows
  • <C-n> to open NerdTree