57 lines
2.8 KiB
Markdown
57 lines
2.8 KiB
Markdown
# Containerized `code` IDE
|
|
`code` is a containerized IDE, that runs in the terminal and is based on
|
|
[tmux][tmux] and [neovim][neovim]. That means you can run it on a machine
|
|
without X server or even within an SSH terminal session.
|
|
|
|
The [podman][podman] containerization makes the development environment not
|
|
only more secure but also reproducible. If something in the editor were to
|
|
break, restarting it would create a fresh container. Since only the current
|
|
working directory is mounted into the container, the editor plugins and code
|
|
dependencies can't directly access any other files on your system. In
|
|
combination with code reviews on your code hosting platform of trust, this
|
|
might even be a reasonable trade-off between security and productivity.
|
|
|
|
[tmux]: https://tmux.github.io/
|
|
[neovim]: https://neovim.io/
|
|
[podman]: https://podman.io/
|
|
|
|
## Variants
|
|
The beauty of `code` is, that you can easily specify a separate development
|
|
environment for each of your coding workflows by writing a Containerfile and
|
|
building it. When starting `code`, you simply specify the variant you'd like to
|
|
use on the command line.
|
|
|
|
The default and most basic variant is *core*. It contains the shell
|
|
configuration and a basic neovim setup, that doesn't use any third party
|
|
plugins and therefore is the most secure choice. The *basic* variant contains
|
|
[git][git] and a bunch of plugins and configurations for integration with tmux,
|
|
file tree navigation, completion, quick editing and visuals. It doesn't contain
|
|
any language runtimes, libraries or LSP servers though. Any language or
|
|
workflow-specific variants can be built on top of *basic*.
|
|
|
|
[git]: https://git-scm.com/
|
|
|
|
## Using `code`
|
|
After cloning the repository and making sure, that podman is installed on your
|
|
machine, you can build all images by executing `./build.sh` or only selected
|
|
variants by passing them as command line arguments. The *core* and *basic*
|
|
variants need to be built before any variants depending on them.
|
|
|
|
Now you can link the `code` script to some directory in your `$PATH` (e. g.
|
|
`ln -s "$(pwd)/code" ~/.local/bin/code`) and edit your first file by executing
|
|
`code my-file.txt`. Some flags at the beginning of the command are interpreted
|
|
by `code`, everything else gets passed to neovim. To learn more about `code`s
|
|
command line flags, execute `code --help`.
|
|
|
|
## Building new variants
|
|
Simply copy the template directory, add you [alpine packages][alpine] and
|
|
further instructions to the Containerfile, add additional neovim configuration
|
|
files etc. and build your variant with `./build.sh my-variant`. You can now run
|
|
it by executing `code --my-variant`.
|
|
|
|
Please consider the files in the template directory for further instructions
|
|
on installing packages, configuring neovim, installing and configuring plugins
|
|
etc.
|
|
|
|
[alpine]: https://pkgs.alpinelinux.org/packages
|