How to use SPICE syntax highlighter in Sublime Text 3
This topic has nothing to do with STM32 devices, but it seems nice feature for all SPICE users who uses notepad to edit circuit, which may be very transparent to look.
In this post, I will walk you through steps to enable SPICE syntax highlighter for Sublime Text 3. If you don’t have this great text editor, I really suggest you start using it. I’ve used Notepad++ first, but when I first saw this editor, I immediatelly switched to it. It supports many things and is very lightweight.
So, let’s start with steps how to install syntax highlighter.
Step by step guide
Syntax highlighter supports regular spice syntax, HSPICE, Spectre and SPICE OPUS.
- After you have installed Sublime Text 3 editor, open it up, go to View -> Show Console, copy/paste code below and hit enter. After few seconds it will tell you that is done. Code (There are 2 codes for Sublime Text version 2 or 3. Make sure you use code for your version.):
1import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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://packagecontrol.io/' + 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)
1import urllib2,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation') - You have to restart Sublime.
- Open Sublime back up and hit CTRL + SHIFT + P. Another command window will pop-up. Type inside “Package control: Install package” and hit enter. Popup window will open again for you.
- Last step is to find our package. Search for “Spice Syntax Highlight” plugin and hit enter. It will install your plugin and you are ready to use.
- Supported extensions are: sp, cdl, mdl, cir, mod, scs, spi.
- If you open file of this type and there is no syntax highlighted, then you have to manually enable it. Go to View -> Syntax -> Spice and it will enable SPICE syntax highlight.
- Have a nice use.
Source: Package Control for Sublime
Recent comments