Search code examples
dockervimsingularity-container

Containerizing vim with plugins


I am trying to containerize vim along with the plugins. I am using singularity containers. The most important plugin is youcompleteme. My approach to containerizing the plugins is to install vim and clone all the plugins to /etc/vim/plugin and compile youcompleteme during the build. Once the image is built, I launch vim with the modified runtimepath (rtp) that points to /etc/vim:

singularity run vim_image.sif vim --cmd 'set rtp^=/etc/vim'

But, vim is failing to load the plugins. I am getting errors like:

Error detected while processing /etc/vim/plugin/sonokai/autoload/airline/themes/sonokai.vim: line
10: E117: Unknown function: sonokai#get_configuration line 11: E121: Undefined variable: s:configuration E116: Invalid arguments for function sonokai#get_palette(s:configuration.style, s:configuration.colors_override)

...

I expect vim to load any plugins inside /etc/vim/plugin without any issues. I am stuck on this. Any suggestions are welcome.


Solution

  • try this command:

    sudo docker run -it amine2029/vim-plug
    

    I build it using this Dockerfile:

    FROM ubuntu:18.04
    RUN apt-get update -yq \
        && apt-get install curl -yq \
        && apt-get install -yq vim git 
    RUN curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
        https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 
    
    ADD vimrc /root/.vimrc
    
    RUN vim -E -s -u "$HOME/.vimrc" +PlugInstall +qall
    

    This 'vimrc' file need to be in the building directory (add more plugins here):

    call plug#begin()
     Plug 'tomlion/vim-solidity'
    call plug#end()
    

    then to build:

    sudo docker build -t vim-plug .