Vim, TextMate and Gedit, make your editor rich featured

There are hundreds of editors available in the market, both free and paid, depending upon ones need. I mostly work on Ruby or ROR, Web2.0 stuff and I prefer to work fast, efficient and effective way and editor plays a very important role for every developer, so as system (OS) but its a different discussion as of now.

I’ll make my assumptions on the basis you like working either on MacOS X or linux (Ubuntu, fedora or any other flavour) and can dig yourself to get your things working like the way you want to work on your machine. Sorry, I don’t recommend Windows for development and I presume that you like to learn shortcuts and emphasize more upon your keyboard instead of mouse.

I started development during my college days on Vim or GEdit on Linux. Truly speaking VIM seemed flamboyant with its unmatched capabilities. I always wanted to work/handson/try Emacs there after, but still lazy enough to start exploring it.

After college, I started development on Mac OS X and got paid version of TextMate and as said its best for development for Ruby on Rails application. I was pretty happy and used to install some bundles from time to time to make it work the way I want to code fast and effective and started coding with as many shortcuts I can learn and remember. As a rescue I used Vim and always feel overwhelmed about Linux community and such a powerful and fast editor, which can’t be replaced by anything (with same regard for Emacs).

With time I worked more on Vim and TextMate and trying to point some of their key features which I liked and used the most.

Vim (all terminal based and though fast):

  • Searching (/search_string)
  • Search and replace (:%s/search/replace/gi)
  • Macro (record and play on a file of any size), at par feature
  • Practically open file of any size (tried with gigs of sql files)
  • use of CTags (extremely powerful feature when working on a project)
  • GVIM with more additional feature
  • Split (horizontal and vertical) views (:sp or :vsp <filename>)
  • Automated indentation
  • Color schema makes one feel geeky developer 🙂 especially after watching MatriX
  • Thousands of other feature and plugin and it makes it extremely powerful and fast to work till now

  • TextMate (a high-hyped editor):

  • Snippets to call your programming structures e.g. def+tab will complete the function block
  • Supports almost all languages and frameworks
  • It can open your whole project (in a side pane, left or right side), I prefer right side. I love this feature
  • Allows you to remove reference certain files or folders from project to apply search upon e.g logs, images etc
  • except common feature, it allows full project search (even regular expression)
  • Star Me and CmdT allows to reach any part of the file and to file in your open project by just typing some literals
  • Auto file indent (Cmd] or SftCmd[ )
  • Cmd/ to auto comment line or lines
  • Most importantly, it won’t annoy you some red or green light here and there or extra fancy stuff and provide more space to code and keep it elegant
  • I like the twilight theme to work upon
  • Takes up very less memory(as compared to most rich featured editors) and its pleasant to work upon it
  • Textmate

    Recently, I moved to Delhi and started working on Linux and to be frank its a hard transition to work without TextMate. Thanks to VIM again, it wasn’t a hard transition. Gedit is good but its like Notepad of windows and reasonably nothing is there. Than I started making it feature rich owing to the fact its always fast to load and can be my textmate on linux. Thanks to hundreds of plugins available and for such a vibrant community around and the research already done by other folks.

    So lets talk about different plugins for Gedit to make it work fast, efficient, elegant and more like TextMate

    Gedit (conventional and basic editor):

    Here are hundreds of plugins available but choosing the right one is important.

    How to install additional Gedit plugins

    While Gedit ships with a set of default plugins, you can surely add as many as you like. To install a plugin for Gedit, you must first download it to a local folder and then extract the contents to ‘~/.gnome2/gedit/plugins/’ directory. Also look for a package named “gedit-plugins” in your distribution’s package manager, this package contains some additional plugins for gedit. Once you have installed the plugin you want, you need to enable it via Edit -> Preferences and then the Plugins Tab.

  • Snippets -> allows you to insert frequently typed phrases and text by using hotkeys or a shortcode, it supports mostly all the languages
  • Auto Tab  -> detects the indent/space settings in a file and adjusts tabbing accordingly on the fly
  • File Browser Pane -> It open up a whole project in directory structure ( file structure)
  • Right Pane -> For right hand side pane for project viewer
  • Code Comment -> To comment your code (CTL+m)
  • External Tools -> Execute external commands and shell scripts
  • Quick Open -> Its good but not as good as CMDT of textmate
  • Regex Search and replace -> CTL + H for regex search and replace
  • Gemini -> character completion
  • Change Case -> for fast switching case for selected text
  • Class Browser -> List all the methods of class or module, uses Ctags and side pan view
  • Commander -> to provide command line interface
  • Document Statistics -> Analyses the current document and reports the number of words, lines, characters and non-space characters in it.
  • Embedded Terminal and Open terminal here
  • File Search -> Search for text in all files in a directory
  • Session Saver -> Session saver allows you to save you current workspace
  • Snap Open -> A regex open file dialog that resembles that of Textmate
  • Tag List -> Provides a method to easily insert into a document commonly used tags/strings without having to type them
  • Word Completion -> suggestions from all words in all documents in all windows, annoying sometimes
  • Colors and fonts:

    Get all themes from here. But I prefer these two.

  • Rubycious
  • Twilight
  • So, after go through of important features of all these editors. Its one like and dislike or any editor (other than these three). Vim is always the winner, as it comes with these features and the moment you do code review or sit on someone else computers, it takes no time to work on new machine. Vim is a must for any programmer (If I infer it right, it makes you think above conventional ways). On top of it, while working on a project and other than terminal TextMate (Mac) and Gedit (Linux) is no-doubt a better option.

    To comment on Windows based editors GVim, e-text editor with cygwin and notepad ++  seems to be better and fast option.
    Happy Coding!

    Railscasts crawler (Download all screencasts easily)

    I wrote this script, as I felt really annoying to download each screencast everytime I needed them. So I ended up writing script to automatically download all screencasts without hassle i.e crawler.

    Its in Ruby of course 🙂 and requires simple Hpricot gem.
    If you not having it. Just type this command in your terminal —

    $gem install hpricot

    –Rest include this script in your /lib folder
    –Change the path in the script where you want to download all the screencasts
    –Go to your projects development environment (script/console) and run the script by these commands–
    video = Railscasts.new #new Railscasts object
    video.start #will start downloading all screencasts from Railscasts
    Note:
    1. If you stop the script in between manually, it will not download those screencasts that are already in your hard disk.
    2. All logs are maintained in Railsproject/log/railscasts.log.
    3. Handling all exceptions raised

    Improvements/Suggestions  are appreciated.

    Thanks
    And yes script:
    # Author : Akshay Gupta
    #file: railscasts.rb
    # First check you have all gems installed. Place the script in /lib folder and run the script.
    # I don't have expertize in ruby, please tell how it can be improved.
    # change the path accordingly, where you want to save path
    # My working env is on MacOS, one need to make some changes if running on Windows
    
    require 'rubygems'
    require 'hpricot'
    require 'open-uri'
    require 'logger'
    $log = Logger.new('log/railscasts.log')
    $path = "/Users/akshaygupta/railsvideo/railscasts/"
    $stop = false
    
    class Railscasts
    attr_accessor :url
    
    def initialize
      @@page = 1
      @@url  = "http://railscasts.com/episodes?page="
      start
    end
    
    def url
      @url = @@url+@@page.to_s
    end
    
    def start
      url
      build_doc
      screencasts_links
      download_screencasts
      next_page
      if !$stop
        start
      else
        puts "Successfully done :) Enjy all the screencasts"
      end
    end
    
    def build_doc
      begin
        $log.info("*********Fetching #{@url}***********")
        @doc = Hpricot(open(@url))
      rescue Exception => e
        $log.debug("Problem fetching #{e}")
      end
    end
    
    def screencasts_links
      begin
        @download_links =
          (@doc/".download/a[1]").collect {|a| (a.search("[@href]").first[:href])}
        $log.info(" All Download links on this page :\n #{@download_links}")
      rescue
        $log.info("Problem in download links")
      end
    end
    
    def download_screencasts
      @download_links.each do |mov|
        begin
          file = mov.split('/').last
          res = `cd #{$path}; ls | grep "#{file}"`
          if !res
            $log.info("Now downloading file #{file}")
            result = `cd #{$path}; wget "#{mov}"`
            if result
              $log.info("Successfully Downloaded #{file}")
            end
          else
            $log.info("Already downloaded #{file}")
          end
        rescue Exception => e
          $log.info("problem downloding file #{e}")
        end
      end
    end
    
      def next_page
        if @@page < 17
          @@page += 1
        else
          $log.info("All screencasts downloaded :-), Mission accomplished!!")
          $stop = true
        end
      end
    end
    

    Moments, Life and Remarkability

    Moments pass by as a drop of water, each one of it make Life. Moments vanishes as you start thinking of it to complete your life. But just analyze WHY? Why are we here ? What we are supposed to be?
    Some good saying: Live whole-heartedly, help others, do whatever you like with passion, contribute to the miraculous deeds our ancestors had done once, never give up life will always test your patience and endurance. Is it love, lust, success we are living for? Are we going the right way? Are we destined ?

    If one ever think of why Einstein, Faraday, Sachin, Gandhi..name anyone..why were they great?How come respect comes out of its own while remembering them.

    • Simple they discovered something, they were leaders, they were simply different.
    • How come they were different, they were mere humans.

    Your answers started sprouting:

    • Things were easier at that time. Nah
    • Easy resources. Not possible.
    • Plenty of time to try out something new. Not sure? same 24 hours.
    • Things was unexplored, now everything is there. Same thoughts prevails over centuries.
    Eight Secrets Of Life

    View SlideShare presentation or Upload your own. (tags: secrets powerpoint)
    It seems they did something different, impossible and remarkable. My thoughts say follow those simple guys who were remarkable, contributer and made their life worth living. Moving against the tide is never easy, but the flew, they were not different rather they were much simpler. Isn’t?
    Its just that they analyzed and walked through the path their heart was leading. It was their passion and inner urge to follow their dream that made them remarkable. They never did it to be famous or for wealth, its the satisfaction they were thriving for. This is greatness.Now, lets discuss our life, we are brought up educated, equipped with all resources (most of them one don’t even need), plenty of time (exclude the time spent on cell, chat, bc and complains about life), I belief everything is more easy, approachable, just one click away thanks to Mr Tim Berners Lee. One dont have to travel years to find where India is, on boat with few crew members. Our great remarkable leaders fulfilled all the resposibilities, they did loved some one, they did married, they did whatever a common man spent time upon. So whats missing ??

    Passion, Depth of thought, Direction etc
    In one thought we have never thought, why are we here for? It was their remarability that made them respectable, different, famous, successful. You know Apple never fell over Newton‘s head, he was just sitting idle under apple tree and looking at calm moon and an Apple and he realized that both are of same size and yet one falls down and one never. So distance can make things look alike but something decreases and he coined the name as Gravity. Remarkable enough for the whole world.In Modern World one try to dress, talk , walk, become rich but surprisingly none of them takes to the path of remarkability other than creating differences, boundaries. Simplicity is the characterstic of being different.

    I believe “Simplicity of character is the natural result of profound thought

    Job vs Life

    Why are we being educated?

    Nursery, LKG, UKG, I, II, III, IV, V, VI, VII, VIII, IX, X, XI, XII
    What Next ? …IIT, an year dropped:(, Jamia is although good. I, II, III, IV year. B.Tech Comp(uter)lete. What Next?…MS/MBA/Job?I opted for Job 🙂

    Being from a middle class family, some how our society gives you an aim to get a “JOB” and work generously to rise and earn decent salaries.

    And when I am very near to start with my first job, there is something within myself which is questioning is this the end (as shown by our society) or is this the beginning? Beginning as of…starting of my career, going to company everyday, work and again work. Is this what for I have been educated for so long and awaited to feel the eternal bliss of a Job, what only matters is to earn money, do i also get trapped as millions of people and loose my identity, will it provide me happiness to the rest of my life, will I be able to fulfill my dreams/ambitions within some years from now before marriage specifically.

    I felt really disappointing that neither our society nor our education system taught anything in this regard. Always I tried soving Matrix/Differential/Integration problems, mugging history, solving assignments, impress my teachers, having high grade. Unfortunately, it had lead me nowhere and I completely don’t know why did I actually studied all the crap which I have already forgotten long time back and to blame myself, I never took the pain to explore beyond the psychological comfort of a job which somehow flourished in my mindset too and I completely felt a class-I guy who enters new classroom (World), and feels completely strange with no mentor this time and as understanding grows, this is stage where again I have to prove myself where millions of people are already competing to grow by hook or by crook. Remember famous dialogue from RDB: “gate k is taraf hum duniya ko nachate hai and gate k us taraf duniya hamein aur duniya ki is bheed me na jaane laakhon DJ piss gaye“,indeed very true. We are out of the gate, no step backing, now.

    Don’t read if you think I’m about to give to an answer or an alternate to situation. What I mean is to understand yourself, organize your thought. Think again and again why have you really been educated? Its only your thought process that can enlighten your path to vision beyond the boundaries.

    If I talk about myself, I am closely analyzing all trends of lifestyle, fashion, Gen X, Tech World, Entrepreneurs, Government, India’s “Cool” philosophy (will talk more about it later), Mobile, Internet etc., and will launch myself in the direction I’ll feel myself more aligned to unleash the mystery of life and to achieve 100 percent of my thought. This might be the reason why Americans/Japanese are leading as they walk in that platform they are actually meant for besides merely following others blindly and unknowingly getting trapped.

    Remember, job in any way is a medium (not the end) to reach to your dream/ambitions and this is what you exactly need to explore and then one need to keep the SPARK alive to achieve them. Happy Beginning 🙂

    Ideas and their Execution..

    Ideas … ?

    Human brain works at much higher frequency than a CPU of one’s PC or laptop, without getting unplugged or low battery. Simulations shake hand concurrently without deadlock par than multitasking system can. Hemoglobin transfers data and control signals with FSB with the frequency of light. Brain stores all memories with infinite storage capacity as a Hard-disk without ever getting crashed, Responses which are impulsive, simple, potent and follow all the Laws of Nature, and portray ones thought process which flows out intermittently from our Mind (Cache). Ans if they really solve some problem…I call them IDEAS … !!!
    Hope now one understands my IDEA !!
    I’m another idiotic computers guy 🙂

    Individual Globalization….

    Voyage:

    The term mostly related with Christopher Coumbus on his voyage in 1492 who sailed with the Nina, the pinta and the Santa Maria in an effort to discover a shorter, more direct route to India to confirm that the world is round not flat!!
    U know Y he did the Voyage???Just to encounter a New World, to search Indian Riches: precious metals , silks, spices. Era of The Globalizaton of countries and power.

    World:

    Then from 19th to 20th century the expansion of world via telephones, media, electronics world, Stock exchange, the PC’s, satellite, Multi national Companies headed while being interrupted by the great depresson(colonization and bombing on Hiroshima and Nagasaki) and World Wars I &II the life never stopped and the key factor “Change” resulted in the

    Globalization of Companies and their Integration

    Flat World:

    The Playing Ground Is Being Leveled: Mr Nilkani, CEO Infosys”
    Now the 21st Century and the world shrinking is to nano size and the storage expanding to Terabytes. Asians, especially Indian professional outsourcing the work and Indian IT market and Software graduates encomplishing tons of work while its night in the Developed Countries has set the world for a individual to Expand Its Horizon and

    The Era Of INDIVIDUAL Globalization, the newfound power to collaborate and compete globally has now Leveled the GROUND.