How to change the format of autocomplete in Sublime text 3
-
26-12-2019 - |
Question
I installed the Emmet plugin in the Sublime text 3, and when I type 'function' in JavaScript syntax, the editor will autocomplete it into
function function_name (argument) {
// body...
}
, but I need to delete the space between the function_name and the argument.
Thank you.
Solution
This is actually a built-in Sublime snippet, and is not related to Emmet. To override the default, perform the following steps:
Go to
Preferences -> Browse Packages...
to open a file explorer menu in your ST3Packages
directory.Create a new directory called
JavaScript
.Create a new file in Sublime with the following content:
<snippet> <content><![CDATA[function ${1:function_name}(${2:argument}) { ${0:// body...} }]]></content> <tabTrigger>fun</tabTrigger> <scope>source.js</scope> <description>Function</description> </snippet>
Save the file as
Packages/JavaScript/function-(fun).sublime-snippet
- make sure you use this exact name, or it won't override the built-in snippet.Restart Sublime (just in case), and now when you're writing JavaScript and type
fun
Tab it will display:function function_name(argument) { // body... }
OTHER TIPS
You can make this even easier by installing Package Resource Viewer
- Press
Ctrl-Shift-P
to bring upPackage Control
- type
install
hitEnter
to bring upPackage Control: Install Package
- type
PackageResourceViewer
hitEnter
To modify the Javascript function-(fun)
snippet:
- Bring up Package Control again
(Ctrl+Shift+P)
- type
ope
hitEnter
to bring upPackageResourceViewer: Open Resource
- type
js
hitEnter
to browse theJavascript
package - type
fun
& selectfunction-(fun)
and edit to your heart's content :)