From 32cb2b9862cf8edc4cec5b71465fbdb5973538d5 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 01:50:59 +0000 Subject: [PATCH 1/2] fix(vim): prevent E12 and E523 errors when sourced in secure mode When running `sudo vim` from a user's home directory, Vim sources the local `.vimrc`. If the owner of that file does not match the effective user (e.g., `arran` vs `root`), Vim executes it with the `secure` option enabled as a security precaution. This caused a barrage of errors like "E12: Command not allowed from exrc/vimrc" and "E523: Not allowed here" because our `.vimrc` contains restricted commands such as `autocmd`, `syntax on`, and mapping overrides that aren't allowed in secure mode. This commit adds a guard at the very beginning of the `.vimrc` file. If the `secure` option is active, we simply call `finish` to abort loading the rest of the user configuration. This correctly suppresses the errors and lets `sudo vim` fall back cleanly to a standard system configuration. --- dot_vimrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dot_vimrc b/dot_vimrc index 538cfdd..d2bdb17 100644 --- a/dot_vimrc +++ b/dot_vimrc @@ -1,3 +1,7 @@ +if &secure + finish +endif + syntax on " Syntax highlighting set foldmethod =syntax " Fold method set background =dark " Background colour scheme From c42db2c569573d2f646004558a90688355139b8e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 02:12:17 +0000 Subject: [PATCH 2/2] fix(vim): prevent E12 and E523 errors when sourced in secure mode When running `sudo vim` from a user's home directory, Vim sources the local `.vimrc`. If the owner of that file does not match the effective user (e.g., `arran` vs `root`), Vim executes it with the `secure` option enabled as a security precaution. This caused a barrage of errors like "E12: Command not allowed from exrc/vimrc" and "E523: Not allowed here" because our `.vimrc` contains restricted commands such as `autocmd`, `syntax on`, and mapping overrides that aren't allowed in secure mode. This commit adds a guard at the very beginning of the `.vimrc` file. If the `secure` option is active, we simply call `finish` to abort loading the rest of the user configuration. This correctly suppresses the errors and lets `sudo vim` fall back cleanly to a standard system configuration.