For the past few months, I have been trying to move from using Geany to using Sublime Text as my primary text editor.
I find myself repeating some repetitive operations dozen times a day when coding in python, such as import IPython;IPython.embed() and etc.
So here are some of my Sublime Text snippets to enhance my productivity, and simplify my life.
Sublime Text 3 makes it super easy to create a snippet. You simply select Tools > Developer > New Snippet from the toolbar menu and you’re off to the races!
1. IPython debugger
Type ipyt and press tab to automatically insert IPython debugger under current pointer.
<snippet> <content> <![CDATA[import IPython;IPython.embed()]]> </content> <tabTrigger>ipython</tabTrigger> <scope>source.python</scope> <description>Interactive IPython debugger</description> </snippet>
2. Docstring
Type docstring and press tab to automatically insert a numpy-style valid
docstring pattern right after your function definition
<snippet> <content><![CDATA[ """${1:One liner description} Parameters ---------- ${2} Returns ------- ${3} """ ]]></content> <tabTrigger>docstring</tabTrigger> <scope>source.python</scope> <description>Adds a docstring skeleton to function</description> </snippet>
and save your snippets with the .sublime-snippet file extension in /home/$USER/.config/sublime-text-3/Packages/User