Skip to content

Commit 9ea2830

Browse files
committed
Add Neovim + system-wide NvChad config; set nvim as default via alternatives; add headless smoketest for sysinit
1 parent f89ecc9 commit 9ea2830

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ RUN set -eux; \
5252
source-extractor \
5353
weightwatcher \
5454
vim \
55+
neovim \
5556
xterm \
5657
libgsl-dev \
5758
npm \
@@ -88,6 +89,37 @@ RUN set -eux; \
8889
# cleanup \
8990
apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
9091

92+
# Neovim system-wide default config (NvChad) for Docker/Apptainer
93+
RUN set -eux; \
94+
mkdir -p /etc/xdg/nvim; \
95+
git clone --depth 1 https://github.com/NvChad/starter /tmp/nvchad; \
96+
rsync -a /tmp/nvchad/ /etc/xdg/nvim/; \
97+
rm -rf /tmp/nvchad/.git /tmp/nvchad; \
98+
printf '%s\n' \
99+
'let g:using_system_nvchad = 1' \
100+
'lua << EOF' \
101+
"dofile('/etc/xdg/nvim/init.lua')" \
102+
'EOF' \
103+
> /etc/xdg/nvim/sysinit.vim
104+
105+
# Smoke test: ensure system NvChad sysinit is picked up
106+
RUN set -eux; \
107+
out="$(nvim --headless '+echo exists(\"g:using_system_nvchad\") | q' 2>/dev/null | tr -d '\r')"; \
108+
[ "$out" = "1" ]
109+
110+
# Prefer Neovim as default editor inside the container
111+
ENV EDITOR=nvim \
112+
VISUAL=nvim
113+
114+
# Prefer nvim for vim/vi/editor via update-alternatives
115+
RUN set -eux; \
116+
update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 110; \
117+
update-alternatives --set editor /usr/bin/nvim; \
118+
update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 110; \
119+
update-alternatives --set vi /usr/bin/nvim; \
120+
update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 110; \
121+
update-alternatives --set vim /usr/bin/nvim
122+
91123
# Quarto (for scientific writing) — prerelease channel, AMD64
92124
RUN set -eux; \
93125
ARCH=amd64; \

0 commit comments

Comments
 (0)