2025 February
How to make exclamation marks autofill as !important in VS Code
On 28, Feb 2025 | No Comments | In Blog, Web Development | By Reggie Lloyd-Jones
If you want to make Visual Studio Code automatically fill in “!important” when you type an exclamation mark, I’ll show you how to do it in this video. This little trick can save you a lot of time typing in the same thing over and over again on a big project.
You can create a VS Code keybinding that replaces ! with !important every time you press ! in a .css file.
1. Open VS Code and go to File / Preferences / Keyboard Shortcuts (or press Ctrl + K Ctrl + S).
2. Click the Open Keyboard Shortcuts (JSON) icon in the top right. 3. Add the following rule inside the JSON file:
{ "key": "!", "command": "type", "when": "editorLangId == css", "args": { "text": "!important" } }
4. Save the file. Now, every time you type ! in a CSS file, it will automatically turn into !important without needing to press another key.
Recent Comments