Skip to content

Instantly share code, notes, and snippets.

@madbence
Last active January 25, 2019 14:47
Show Gist options
  • Save madbence/caedf36081ffe68ed5db9061995207d0 to your computer and use it in GitHub Desktop.
Save madbence/caedf36081ffe68ed5db9061995207d0 to your computer and use it in GitHub Desktop.
vim on steroids
$ docker run --rm -it -v $(pwd)/init.vim:/root/.config/nvim/init.vim -v $(pwd)/pyls-wrapper.sh:/usr/bin/pyls -v $(pwd):/opt/app pvim bash -l

Vim is called nvim. Don't forget to install the Plugins with :PlugInstall. :UpdateRemotePlugins will fix post-installation errors when deoplete is missing (restart nvim first). A virtualenv with django is in /virtualenv.

FROM ubuntu
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y curl \
git \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
wget \
llvm \
libncurses5-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libffi-dev \
liblzma-dev && \
git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \
curl -O -L https://github.com/neovim/neovim/releases/download/v0.3.1/nvim.appimage && \
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim && \
chmod +x nvim.appimage && \
./nvim.appimage --appimage-extract && \
echo 'export PATH=/squashfs-root/usr/bin:$PATH' >> ~/.profile && \
echo 'export PYENV_ROOT=~/.pyenv' >> ~/.profile && \
echo 'export PATH=$PYENV_ROOT/bin:$PATH' >> ~/.profile && \
echo 'eval "$(pyenv init -)"' >> ~/.profile && \
bash -lc 'pyenv install 2.7.15 && pyenv install 3.7.1 && pyenv global 3.7.1' && \
bash -lc '$(pyenv which pip) install -U pip' && \
bash -lc '$(pyenv which pip) install virtualenv' && \
bash -lc 'virtualenv ~/.nvim-python2 -p $(PYENV_VERSION=2.7.15 pyenv which python)' && \
bash -lc 'virtualenv ~/.nvim-python3 -p $(PYENV_VERSION=3.7.1 pyenv which python)' && \
bash -c '. ~/.nvim-python2/bin/activate && pip install python-language-server neovim' && \
bash -c '. ~/.nvim-python3/bin/activate && pip install python-language-server neovim rope pyflakes pycodestyle' && \
bash -lc 'virtualenv virtualenv -p $(PYENV_VERSION=2.7.15 pyenv which python) && . virtualenv/bin/activate && pip install django'
import django
django.VERSION
call plug#begin('~/.vim/plugged')
Plug 'autozimu/LanguageClient-neovim', {'branch': 'next', 'do': 'bash install.sh'}
Plug 'Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'}
call plug#end()
let g:deoplete#enable_at_startup = 1
let g:LanguageClient_autoStart = 1
let g:LanguageClient_serverCommands = {
\ 'cpp': ['clangd'],
\ 'python': ['pyls'],
\ 'rust': ['rls'],
\ 'typescript': ['typescript-language-server', '--stdio'],
\ 'typescript.tsx': ['typescript-language-server', '--stdio', '--tsserver-path', './node_modules/.bin/tsserver'],
\ }
let home = expand('$HOME')
let g:python3_host_prog = home . '/.nvim-python3/bin/python'
let g:python_host_prog = home . '/.nvim-python2/bin/python'
let g:LanguageClient_loggingFile = home . '/.languageclient_log'
let g:LanguageClient_loggingLevel = 'DEBUG'
let g:LanguageClient_serverStderr = home . '/.languageclient_stderr'
let g:LanguageClient_rootMarkers = {
\ 'typescript.tsx': ['tsconfig.json'],
\ }
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
#!/bin/bash
tee in.log | /root/.nvim-python3/bin/pyls | tee out.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment