Wednesday, March 18, 2015

Sublime text 3 - How to auto complete file name


Hi peeps! What are you favourite tool for web-development? Sublime-Text are on the list of tool as web programmer. I use sublime-text 3. Ever wonder a trick how to auto complete file name when using src syntax ?

What you need is a package control and a autofilename package. By default, you need to install package control if you already have it, just skip this step. Now, open you sublime-text console by shortcut key Ctrl+' or navigate View -> Show console and paste this python code into console and press enter:

import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
P/s : The code maybe change by time, check HERE for new code

Congratulation! Now you have a package control manager. Now, back to our objective. You need a plugin to auto complete file name. Press Ctrl+Shift+P shortcut key and type Package control, now you see lot of available option, right? Choose Package control : Install package. Just wait a while, sublime-text will automatic check what on the repository first. Now type "AutoFileName". The repo should have this plugin. Now press enter to start installing the plugin.

Start from here, you don't need to memorize files name. Just type src="" , sublime-text will invoke a popup auto completion of file name in the same path. That all peeps! Bye x2!

1 comment: