# neoche Neovim editor for Eclipse Che and Red Hat OpenShift Dev Spaces. Runs Neovim in the browser via [ttyd](https://github.com/tsl0922/ttyd), following the same init container injection pattern as [che-code](https://github.com/che-incubator/che-code). ## Quick Start Append to your Dev Spaces dashboard URL: ``` ?che-editor=neoche/neovim/insiders ``` Or add to your devfile: ```yaml attributes: che-editor: neoche/neovim/insiders ``` ## Customizing Neovim ### Bring Your Own Config (dotfiles) The recommended way. Point Dev Spaces at your dotfiles repo: 1. Open the Dev Spaces dashboard 2. Go to User Preferences > Dotfiles URI 3. Set it to a git repo containing your `.config/nvim/` directory When a workspace starts, Che clones your dotfiles into the home directory before Neovim launches. The editor detects existing config and uses it as-is. ### Bootstrap a Distribution If you don't have your own config, set the `NVIM_DISTRO` environment variable to bootstrap one of these distributions on first launch: | Value | Distribution | |-------|-------------| | `lazyvim` | [LazyVim](https://github.com/LazyVim/starter) | | `astrovim` | [AstroNvim](https://github.com/AstroNvim/template) | | `nvchad` | [NvChad](https://github.com/NvChad/starter) | | `kickstart` | [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) | Set it in your devfile: ```yaml components: - name: neovim-runtime container: env: - name: NVIM_DISTRO value: lazyvim ``` Or override it per-workspace via the Dev Spaces dashboard environment variables. The bootstrap only runs when `$HOME/.config/nvim` does not exist, so it won't overwrite your dotfiles or a previously bootstrapped config. ### Persistent Storage Dev Spaces can persist `/home/user` across workspace restarts using a PVC. This means plugins installed by lazy.nvim, packer, or any other plugin manager survive workspace restarts. Enable persistent home in your Dev Spaces configuration to avoid re-installing plugins on every start. ## Architecture neoche uses the same two-phase init container pattern as che-code: 1. **preStart**: The `neovim-injector` init container copies Neovim binaries, ttyd, machine-exec, and entrypoint scripts into a shared `/neovim` volume 2. **postStart**: The workspace container runs `entrypoint-volume.sh`, which detects the platform (glibc or musl), starts machine-exec, optionally bootstraps a Neovim distribution, and launches ttyd serving Neovim on port 7681 The image ships both glibc and musl Neovim builds. Platform detection happens at runtime via `ldd /bin/ls`, so the correct binary is selected regardless of the workspace base image. ## Building ``` make build # build the container image make test-standalone # run locally at http://localhost:7681 make push # push to quay.io/pfeifferj/neoche:insiders ``` ### Build Args | Arg | Default | Description | |-----|---------|-------------| | `NVIM_VERSION` | `v0.10.4` | Neovim release tag | | `TTYD_VERSION` | `1.7.7` | ttyd release tag | ## Deploying to OpenShift Dev Spaces ``` make deploy-editor ``` This creates the editor definition ConfigMap in your Dev Spaces namespace with the required labels. Users can then select Neovim as their editor when creating workspaces. The image is pulled from `quay.io/pfeifferj/neoche:insiders`. If your registry is private, add the credentials to the cluster's global pull secret: ``` oc get secret pull-secret -n openshift-config -o jsonpath='{.data.\.dockerconfigjson}' | base64 -d > /tmp/ps.json # merge your registry creds into /tmp/ps.json oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=/tmp/ps.json ``` ## Standalone Testing Run outside of Che for quick testing: ``` podman run --rm -p 7681:7681 quay.io/pfeifferj/neoche:insiders ``` Open http://localhost:7681 in a browser. Test with a distribution: ``` podman run --rm -p 7681:7681 -e NVIM_DISTRO=lazyvim quay.io/pfeifferj/neoche:insiders ``` ## License [Eclipse Public License 2.0](LICENSE)