My personal Vim configuration.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

activate-coc 1.4 KiB

5 vuotta sitten
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. missingCommands=""
  3. nodeVersion=$(node --version 2>&1 | cut -d. -f1 | sed 's/v//')
  4. if [ $? != 0 ]; then
  5. missingCommands="- node >= 8.0"
  6. fi
  7. vimVersion=$(vim --version | head -n 1 | sed -E 's/VIM - Vi IMproved ([^ ]+).+/\1/')
  8. vimMajorVersion=$(echo $vimVersion | cut -d. -f1)
  9. vimMinorVersion=$(echo $vimVersion | cut -d. -f2)
  10. if [ "$missingCommands" != "" ]; then
  11. echo -e "You have to install the following commands before installing this extension:\n$missingCommands"
  12. exit 1
  13. fi
  14. stop=0
  15. if [ "$nodeVersion" -lt "8" ]; then
  16. echo "This plugin requires NodeJS >= 8.0 (detected version $nodeVersion)."
  17. stop=1
  18. fi
  19. if [ "$vimMajorVersion" -lt "8" -o "$vimMajorVersion" -ge "8" -a "$vimMinorVersion" -lt "1" ]; then
  20. echo "This plugin requires VIM >= 8.1 (detected version $vimVersion)."
  21. stop=1
  22. fi
  23. if [ "$stop" -eq "1" ]; then
  24. exit 1;
  25. fi
  26. echo "Activating COC..."
  27. cat ~/.vimrc | sed "s/\" Plugin 'neoclide\/coc.nvim'/Plugin 'neoclide\/coc.nvim'/" > ~/.vimrc.tmp
  28. rm ~/.vimrc
  29. mv ~/.vimrc.tmp ~/.vimrc
  30. vim +PluginInstall +qall
  31. vim "+call coc#util#install()" +qall
  32. echo "COC is now ready for use!"
  33. echo "If you like this plugin, don't forget to send your ♥ to its author: https://github.com/neoclide/coc.nvim"
  34. 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"