Monday, 1 April 2013

Editing the code with the speed of thought


I changed my code editor from Textmate2 to Sublime. A friend of mine told me about it and I was so curious that I needed to try it. I started to love it right in the first moment mainly because of the existence of the command palette and its modular feature approach and the multiple editing feature.

The command palette was for me like some sort of help combined with a quicksearch-autosuggest menu. When I thought to something I would do I typed in and if I had luck then the feature was already there. If not then I needed to search for a suitable package which did the desired functionality.
I saw a huge potential in this approach because I always wanted to edit my code like the code editor would be a extension of my body. In other words I wanted to edit code with the speed of my thought.
By default the desired functions were not there. I needed to search for some packages and even edit those packages to achieve my desires. I wanted to toggle between quote types 'a', "a". I wanted to convert a string to a symbol and vice versa "a", :a. I wanted to toggle the do end blocks with the braces blocks. I wanted to convert amongst sneak_case, pascalCase, dash-case,, slash/separated

So by using it continouosly for more than half year I installed these packages:

          For converting each other from any of them:
    • "sneak_case"
    • "pascalCase"
    • "dash-case"
    • ""
    • "slash/separated"
  • Clipboard History - for using multiple history feature
  • CoffeeScript - syntax for coffee script
  • Cucumber -  syntax for cucumber
  • Eco - syntax for eco template
  • ERB Insert And Toggle Command
          For toggling amongs these
    • <%= %> 
    • <%-  -%>
    • <%  %>
    • <%=  -%>
    • <%#  %>
  • Gist - I like to store my snippets on gist and access them from sublime
  • Missing Palette Commands
  • Plain Tasks - For storing my tasks in plain text format but nicely formated, like the below list
    • ✔ task 1 @done (13-04-01 21:28)
    •  ☐ implement sorting
  • RSpec - syntax for my specs. I am a TDD advocate. It saves me a lot of time.
  • Ruby Block Converter - for toggling amongst {} block and do end blocks.
  • SFTP - for editing remote files.
  • Toggle Symbol To String for toggling between "symbol"and :symbol
  • Toggle Quotes for toggling between 'string' and "string"
  • Advanced New File for creating deeple nested directories when I place a file into them.
  • Nettuts + Fetch for fetching the latest jquery.js or jquery-ui.js or backbone.js libraries.

Often the commands were missing from some of these packages. So when I searched for 'toggle block' then no result was shown however I wanted to convert a block from "{}" style to "do end" style. This was a bottleneck in my speedy coding... In these cases I needed to open the package add the command to the Default.sublime-commands file and then make a pull request. This way if I eventually forgot the key combination of a feature I could search for it in a command palette.

May I ask any developer who makes a sublime package to add this file to the package and enlist the commands there.
There is the multiple editing feature I like the most... :)
And it is a very fast editor.
I also like the snippet feature of it.

Overall all I can say s that it is a very handy code editor and it worth the money for buying it and spending time to learn it ;)