============================================================
CodeMirror Autocomplete for Virtualmin File Editor
Installation Guide
OVERVIEW
Adds keyword autocompletion to the Virtualmin File Editor for
20+ languages (PHP, Python, JS, CSS, HTML, SQL, Bash, Apache,
Nginx, systemd, Docker, YAML, JSON, Ruby, Go, and more).
Zero extra dependencies — uses the CodeMirror already bundled
with the Authentic Theme.
STEP 1 — Create the script file
Save the script to:
/usr/share/webmin/unauthenticated/js/intellisense.js
Command:
sudo nano /usr/share/webmin/unauthenticated/js/intellisense.js
Paste the full script (attached / linked below), save (Ctrl+O,
Enter) and exit (Ctrl+X).
Verify it exists:
ls -la /usr/share/webmin/unauthenticated/js/intellisense.js
STEP 2 — Edit the File Manager page
Open the File Manager CGI script:
sudo nano /usr/share/webmin/filemin/index.cgi
Press Ctrl+W, type “ui_print_footer” and hit Enter. You want
the LAST occurrence near the bottom of the file.
Just ABOVE that line, add:
print qq{<script src="/unauthenticated/js/intellisense.js"></script>\n};
So the result looks like:
print qq{<script src="/unauthenticated/js/intellisense.js"></script>\n};
&ui_print_footer(undef, undef, 1);
Save (Ctrl+O, Enter) and exit (Ctrl+X).
STEP 3 — Edit the standalone file editor page
Do exactly the same thing in the edit_file script:
sudo nano /usr/share/webmin/filemin/edit_file.cgi
Find the last “ui_print_footer”, add the same line above it:
print qq{<script src="/unauthenticated/js/intellisense.js"></script>\n};
Save and exit.
STEP 4 — Verify it works
-
Open any file in the Virtualmin File Editor
-
Press F12 to open your browser Developer Tools
-
Go to the Console tab
-
You should see:
Autocomplete v2 active — php (377 keywords) [auto](The language and keyword count will vary by file type.)
-
Type at least 2 characters and pause — suggestions appear.
Or press Ctrl+Space at any time to trigger manually.
If you do NOT see the message, do a hard refresh:
Ctrl+Shift+R (Windows/Linux — Chrome, Edge, Firefox)
Cmd+Shift+R (Mac)
NO RESTART REQUIRED
No need to restart Webmin. The script is loaded by the browser
on the next page load. It’s cached after the first load so
there’s no ongoing performance hit.
USAGE QUICK REFERENCE
Ctrl+Space Manually trigger autocomplete
Arrow keys Navigate suggestions
Enter / Tab Accept highlighted suggestion
Escape Dismiss the popup
Suggestions appear automatically after:
- Typing 2+ characters and pausing 300ms
- Typing $, ., >, :, or \ (instant trigger)
Snippets — type a short abbreviation then Ctrl+Space:
PHP: ife → if/else block, func → function, class → class
Apache: vhost → VirtualHost block, dir → Directory block
Nginx: server → server block, php → PHP location block
HTML: doc → full HTML5 document
TROUBLESHOOTING
Console says “unknown” language:
→ Make sure you have the latest script with the
CodeMirror mode fallback. Re-download from the source.
No popup appears at all:
→ Check Console for errors. If “CodeMirror hint addon
not available”, your Authentic Theme may be too old.
Works but feels slow on large files:
→ In the script, find the AUTO block and increase
“debounceMs” to 500 or lower “maxFileSize”.
Changes to the script don’t take effect:
→ Hard-refresh the page (Ctrl+Shift+R). If that fails,
open DevTools → Network tab → check “Disable cache”
→ then refresh.
intellisense.zip (16.2 KB)