Code Monkey home page Code Monkey logo

neovim-docker's Introduction

Neovim-docker

My personal neovim environment (neovim + tools) as a Docker image

Why ?

  • Keep track of all external tools, specifically installed for neovim (ctags, syntax checkers, language server protocol,…)
  • Keep track of all installed plugins
  • Easily deploy your developement environnement on different machine with docker-hub
  • Safely try new tools (e.g. language server protocol) in the sandbox environment

Usage

cd into your top level project directory, then run the following docker command:

docker run \
  --rm -it \
  [-e UID="1000" \]
  [-e GID="1000" \]
  [-v <your init.vim directory>:/home/neovim/.config/nvim \]
  -v <your workspace top level dir>:/mnt/workspace \
   nicodebo/neovim-docker:latest \
  [nvim arguments]

Examples

  • Open neovim with file1 and file2 stacked horizontally:

docker run \
    --rm -it \
    -v $(pwd):/mnt/workspace \
    nicodebo/neovim-docker:latest \
    -o file1 file2
  • Open neovim with file1 and use your custom neovim configuration stored in the .dotfile directory under your $HOME:
docker run \
    --rm -it \
    -v $(pwd):/mnt/workspace \
    -v $HOME/.dotfiles/nvim:/home/neovim/.config/nvim \
    nicodebo/neovim-docker:latest \
    file1
  • File permission issues may arise if the default user id (1000) and group id (1000) of the container does not match user id and group id of the host.
docker run \
    --rm -it \
    -v $(pwd):/mnt/workspace \
    -e UID="1003" \
    -e GID="1004" \
    nicodebo/neovim-docker:latest \
    -o file1 file2

You can find out your host user id and group id with the following command: $ id

Local runtime/binary

For conveniance, you might want to define a function in your shell configuration (bashrc, zshrc,…) to run neovim-docker as an executable, e.g.:

nvim() {
    docker run \
        --rm -it \
        -v $(pwd):/mnt/workspace \
        -v $HOME/.dotfiles/nvim:/home/neovim/.config/nvim \
        nicodebo/neovim-docker:latest \
        "$@"
       }

Limitation

You must cd into the directory (preferably the top level directory of your project) where the files you want to edit are located.

Related project

neovim-docker's People

Contributors

nicodebo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.