-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Dockerfile for testing. * Add coc-json, coc-snippets, move to tools
- Loading branch information
1 parent
ad9f12e
commit 1b3fdac
Showing
1 changed file
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Dockerfile creates two system users (vim, nvim) | ||
# | ||
# vim user: | ||
# * configured for vim with /home/vim/.vimrc | ||
# * vim-plug installed into /home/.vim/ | ||
# | ||
# nvim user: | ||
# * configured for neovim with /home/nvim/.config/nvim/init.vim | ||
# * vim-plug installed into /home/nvim/.local/share/nvim/ | ||
# | ||
# Plugins enabled by default: | ||
# * neoclide/coc.nvim | ||
# * bling/vim-airline | ||
# * sheerun/vim-polyglot | ||
# * coc-powershell (coc.nvim plugin) | ||
# | ||
# Both vim and neovim configurations are set with pwsh as default shell. | ||
# | ||
# Default container user is root with /tmp as WORKDIR. | ||
# | ||
# To test with neovim run: | ||
# runuser -l nvim -c 'nvim test.ps1' | ||
# | ||
# To test with vim run: | ||
# runuser -l vim -c 'vim test.ps1' | ||
# | ||
# You can also switch into each user by running: | ||
# | ||
# su - nvim | ||
# su - vim | ||
|
||
FROM mcr.microsoft.com/powershell:latest | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
WORKDIR /tmp | ||
|
||
# Install base packages | ||
RUN apt-get update -qq | ||
RUN apt-get install wget vim git curl software-properties-common -y | ||
|
||
# Install neovim | ||
RUN add-apt-repository ppa:neovim-ppa/stable | ||
RUN apt-get update -qq | ||
RUN apt-get install neovim -y | ||
|
||
# Install nodejs | ||
RUN bash -c 'bash <(curl -sL install-node.now.sh/lts) --yes' | ||
|
||
# Create paswordless vim and nvim users | ||
RUN adduser --disabled-password --gecos "" vim | ||
RUN adduser --disabled-password --gecos "" nvim | ||
|
||
# Configure vim as vim user. | ||
USER vim | ||
WORKDIR /home/vim | ||
|
||
RUN curl -sfLo ~/.vim/autoload/plug.vim --create-dirs \ | ||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | ||
|
||
RUN echo "call plug#begin('~/.vim/plugged')\n\ | ||
Plug 'neoclide/coc.nvim', {'branch': 'release'}\n\ | ||
Plug 'bling/vim-airline'\n\ | ||
Plug 'sheerun/vim-polyglot'\n\ | ||
call plug#end()\n\ | ||
autocmd FileType ps1 setlocal shell=pwsh" >> ~/.vimrc | ||
|
||
RUN vim +PlugInstall +qall | ||
RUN vim -c 'CocInstall -sync coc-powershell coc-snippets coc-json|q' | ||
|
||
RUN rm -rf /tmp/coc-nvim* | ||
|
||
|
||
# Configure nvim as nvim user. | ||
USER nvim | ||
WORKDIR /home/nvim | ||
|
||
RUN curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ | ||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | ||
|
||
RUN mkdir -p ~/.config/nvim | ||
|
||
RUN echo "call plug#begin('~/.local/share/nvim/plugged')\n\ | ||
Plug 'neoclide/coc.nvim', {'branch': 'release'}\n\ | ||
Plug 'bling/vim-airline'\n\ | ||
Plug 'sheerun/vim-polyglot'\n\ | ||
call plug#end()\n\ | ||
autocmd FileType ps1 setlocal shell=pwsh" >> ~/.config/nvim/init.vim | ||
|
||
RUN nvim +PlugInstall +qall | ||
RUN nvim -c 'CocInstall -sync coc-powershell coc-snippets coc-json|q' | ||
|
||
USER root | ||
RUN usermod -s /usr/bin/pwsh vim | ||
RUN usermod -s /usr/bin/pwsh nvim | ||
|
||
RUN rm -rf /tmp/* | ||
WORKDIR /tmp | ||
|
||
CMD ["/usr/bin/pwsh"] |