From a774667938afe56b7b6b09db3ff1f8a85deba6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Tue, 9 Apr 2019 21:35:27 +0200 Subject: [PATCH] Add Markdown plugin --- Makefile | 4 ++++ README.md | 1 + scripts/activate-markdown | 47 +++++++++++++++++++++++++++++++++++++++ vimrc | 3 +++ 4 files changed, 55 insertions(+) create mode 100644 scripts/activate-markdown diff --git a/Makefile b/Makefile index 8ee9b91..b044542 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,7 @@ install: coc: bash scripts/activate-coc + +markdown: + bash scripts/activate-markdown + diff --git a/README.md b/README.md index c627477..a41d13e 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,4 @@ The following plugins are installed with [Vundle](https://github.com/VundleVim/V | ------ | ----------- | ---------- | [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` +| [suan/vim-instant-markdown](https://github.com/suan/vim-instant-markdown) | Shows a preview of your Markdown file in your browser | `make markdown` diff --git a/scripts/activate-markdown b/scripts/activate-markdown new file mode 100644 index 0000000..4658308 --- /dev/null +++ b/scripts/activate-markdown @@ -0,0 +1,47 @@ +#!/bin/bash + +missingCommands="" + +npm --version > /dev/null 2>&1 + +if [ $? -ne 0 ]; then + missingCommands="- npm" +fi + +xdg-open --version > /dev/null 2>&1 + +if [ $? != 0 ]; then + missingCommands="${missingCommands}\n- xdg-utils" +fi + +curl --version > /dev/null 2>&1 + +if [ $? != 0 ]; then + missingCommands="${missingCommands}\n- curl" +fi + +if [ "$missingCommands" != "" ]; then + echo -e "You have to install the following commands before installing this extension:\n$missingCommands" + exit 1 +fi + +which instant-markdown-d > /dev/null 2>&1 + +if [ "$?" -ne 0 ]; then + echo "This plugin needs you to install the following NPM package: https://www.npmjs.com/package/instant-markdown-d" + echo "Please install it and restart this script to activate this plugin." + exit 1 +fi + +echo "Activating Markdown support..." + +sudo npm -g install instant-markdown-d + +cat ~/.vimrc | sed "s/\" Plugin 'suan\/vim-instant-markdown'/Plugin 'suan\/vim-instant-markdown'/" > ~/.vimrc.tmp +rm ~/.vimrc +mv ~/.vimrc.tmp ~/.vimrc +vim +PluginInstall +qall + +echo "Markdown support has been activated!" +echo "If you like this plugin, don't forget to send your ♥ to its author: https://github.com/suan/vim-instant-markdown" + diff --git a/vimrc b/vimrc index 8ac5bb1..ff6233a 100644 --- a/vimrc +++ b/vimrc @@ -21,6 +21,9 @@ call vundle#begin() Plugin 'VundleVim/Vundle.vim' +" Markdown live preview +" Plugin 'suan/vim-instant-markdown' + " Asynchronous linting/fixing for Vim and Language Server Protocol (LSP) " integration - https://github.com/w0rp/ale Plugin 'w0rp/ale'