Browse Source

Add COC

pull/6/head
Jérôme Deuchnord 5 years ago
parent
commit
f19448c2fb
4 changed files with 57 additions and 5 deletions
  1. +3
    -0
      Makefile
  2. +5
    -5
      README.md
  3. +46
    -0
      scripts/activate-coc
  4. +3
    -0
      vimrc

+ 3
- 0
Makefile View File

@@ -1,2 +1,5 @@
install:
bash scripts/install

coc:
bash scripts/activate-coc

+ 5
- 5
README.md View File

@@ -10,9 +10,9 @@ Note: if a configuration already exists, it will be backed up.

## Installed plugins

The following plugins are installed with [Vundle](https://github.com/VundleVim/Vundle.vim):

| Plugin | Description |
| ------ | ----------- |
| [w0rp/ale](https://github.com/w0rp/ale) | Asynchronous linting/fixing for Vim and Language Server Protocol (LSP) integration
The following plugins are installed with [Vundle](https://github.com/VundleVim/Vundle.vim).

| Plugin | Description | Activation
| ------ | ----------- | ----------
| [w0rp/ale](https://github.com/w0rp/ale) | Asynchronous linting/fixing for Vim and Language Server Protocol (LSP) integration | _Immediate_
| [neoclide/coc.vim](https://github.com/neoclide/coc.nvim) | Intellisense engine for Vim 8 & neovim | `make coc`

+ 46
- 0
scripts/activate-coc View File

@@ -0,0 +1,46 @@
#!/bin/bash

missingCommands=""

nodeVersion=$(node --version 2>&1 | cut -d. -f1 | sed 's/v//')

if [ $? != 0 ]; then
missingCommands="- node >= 8.0"
fi

vimVersion=$(vim --version | head -n 1 | sed -E 's/VIM - Vi IMproved ([^ ]+).+/\1/')
vimMajorVersion=$(echo $vimVersion | cut -d. -f1)
vimMinorVersion=$(echo $vimVersion | cut -d. -f2)

if [ "$missingCommands" != "" ]; then
echo -e "You have to install the following commands before installing this extension:\n$missingCommands"
exit 1
fi

stop=0

if [ "$nodeVersion" -lt "8" ]; then
echo "This plugin requires NodeJS >= 8.0 (detected version $nodeVersion)."
stop=1
fi

if [ "$vimMajorVersion" -lt "8" -o "$vimMajorVersion" -ge "8" -a "$vimMinorVersion" -lt "1" ]; then
echo "This plugin requires VIM >= 8.1 (detected version $vimVersion)."
stop=1
fi

if [ "$stop" -eq "1" ]; then
exit 1;
fi

echo "Activating COC..."
cat ~/.vimrc | sed "s/\" Plugin 'neoclide\/coc.nvim'/Plugin 'neoclide\/coc.nvim'/" > ~/.vimrc.tmp
rm ~/.vimrc
mv ~/.vimrc.tmp ~/.vimrc
vim +PluginInstall +qall
vim "+call coc#util#install()" +qall

echo "COC is now ready for use!"
echo "If you like this plugin, don't forget to send your ♥ to its author: https://github.com/neoclide/coc.nvim"
echo "You can add support for your favourite languages by adding them: https://github.com/neoclide/coc.nvim/wiki/Language-servers#example-configuration-for-custom-language-servers"


+ 3
- 0
vimrc View File

@@ -25,5 +25,8 @@ Plugin 'VundleVim/Vundle.vim'
" integration - https://github.com/w0rp/ale
Plugin 'w0rp/ale'

" IntelliSense for Vim
" Plugin 'neoclide/coc.nvim'

call vundle#end()


Loading…
Cancel
Save