A portable Neovim development environment based on Docker, allowing you to use the same Neovim configuration across any platform.
π Important Note: Place your Neovim configuration in the
config/nvim/directory, which maps to~/.config/nvim/inside the container.
- π Fully Containerized: Stable environment based on Debian
- π¨ Custom Configuration: Use your own Neovim configuration
- π οΈ Rich Toolchain: Includes Git, ripgrep, fzf, and other development tools
- πΎ Persistent Support: Plugins and configurations are automatically saved
- π Flexible Language Support: Choose which languages to install (Python, Node.js, Go, Rust, PHP, Lua)
- π Smart Tool Detection: Mason automatically installs only tools for enabled languages
- π¦ Optimized Image Size: Install only what you need (800MB to 2.5GB depending on configuration)
- Docker (20.10+)
- Docker Compose (optional, recommended)
π‘ First Time Setup: Use
build-config.shto choose your language support before building!
# Make script executable
chmod +x scripts/build-config.sh
# Run interactive configuration
./scripts/build-config.shChoose your preset:
- Minimal (~800MB-1GB): Essential tools only (Neovim, Git, lazygit, terminal tools)
- Standard (~1.5-1.8GB): Minimal + Python + Node.js (Recommended for most users)
- Full (~2-2.5GB): All languages (Python, Node.js, Go, Rust, PHP, Lua) + rsync
- Custom: Pick specific languages and tools (including optional rsync)
Language Support Detection:
The image creates a .language-support marker file that Neovim plugins read to conditionally install LSP servers and tools. This prevents errors when trying to install tools for languages that aren't available.
# Make script executable (first time only)
chmod +x scripts/docker-run.sh
# Build and run with default workspace (./workspace)
./scripts/docker-run.sh run
# Run with custom workspace directory
./scripts/docker-run.sh run -w ~/projects/myapp
# Force rebuild and run
./scripts/docker-run.sh rebuild
# Show all available options
./scripts/docker-run.sh helpBenefits:
- β
Auto-cleanup with
--rm(container removed on exit) - β Persistent data via named volumes
- β Custom workspace directory support
- β Single command to build and run
-
Start Container
docker-compose up -d
-
Enter Container
docker-compose exec nvim zsh -
Stop Container
docker-compose down
Benefits:
- β
Run in background with
-d - β Declarative configuration
- β Easy to manage multiple services
portable-nvim/
βββ Dockerfile # Docker Image definition
βββ docker-compose.yml # Docker Compose configuration
βββ .dockerignore # Docker ignore file
βββ README.md # Project documentation
βββ config/ # Configuration directory (maps to ~/.config in container)
β βββ nvim/ # Neovim configuration directory
β βββ init.lua # Neovim main configuration
β βββ lua/ # Lua configuration modules
β βββ ... # Your custom configuration
βββ scripts/ # Utility scripts
β βββ docker-run.sh # Standalone Docker management script
β βββ entrypoint.sh # Container startup script
β βββ README.md # Scripts documentation
βββ workspace/ # Working directory (mount point)
- Leader Key:
Space
<C-w>- Save file<C-q>- Quit
<leader>e- Toggle file explorer<leader>ff- Find files<leader>fg- Global search<leader>fb- Search buffers<leader>fh- Search help
<C-h/j/k/l>- Navigate windows<leader>v- Vertical split<leader>h- Horizontal split
gd- Go to definitionK- Show documentationgi- Go to implementation
<C-\>- Toggle floating terminal<Esc>- Exit terminal mode
s- Flash quick jumpgcc- Toggle line commentgc- Toggle block comment (visual mode)
- Place your Neovim configuration in the
config/nvim/directory - Rebuild the Docker Image
Note: The config/ directory maps to /root/.config/ inside the container, so you can place any .config configuration files here.
The configuration automatically detects available languages via the .language-support marker file:
- Rebuild with desired languages: Run
./scripts/build-config.shand select languages - Automatic tool installation: Mason will only attempt to install tools for enabled languages
- Manual override: Edit
config/nvim/lua/plugins/mason-tool-installer.luaif needed
How it works:
- During Docker build, a marker file is created at
~/.language-support lua/utils/language-support.luareads this file- Plugins like
mason-tool-installer.luaandrsync.luacheck language availability - Only tools for enabled languages are installed, preventing errors
- Cross-Platform Development: Use the same configuration on macOS, Linux, and Windows
- Team Collaboration: Ensure all team members use a consistent development environment
- CI/CD Integration: Use the same editing environment in CI pipelines
- Temporary Environment: Quickly set up a clean development environment
- Version Isolation: Use different tool versions for different projects
- Neovim
- Git
- ripgrep
- fd
- fzf
All languages are optional and can be selected during build configuration:
- Python 3 (with pip, pynvim, black, flake8, pylint, autopep8)
- Node.js (with npm, neovim support, tree-sitter-cli)
- Go (latest stable version from official source, not Debian repos)
- Rust (via rustup, minimal profile)
- PHP (with Composer)
- Lua (5.3 with LuaRocks)
Additional Tools:
- rsync (optional, enables rsync.nvim plugin for remote file sync)
- zsh (default shell)
- oh-my-zsh
- tmux
Depends on your config/nvim/ configuration. Common plugins include:
- Plugin Manager: Lazy.nvim
- File Manager: nvim-tree or neo-tree
- Fuzzy Finder: Telescope
- Syntax Highlighting: Treesitter
- LSP: nvim-lspconfig + Mason
- Completion: nvim-cmp
- Status Line: lualine
- Git Integration: gitsigns
- More: See your configuration files
Run inside the container:
:Lazy syncdocker system prune -aMIT License
Thanks to all Neovim plugin developers and community contributors.