• Vim movement cheatsheet

    A great cheat sheet for Vim movement commands.

    I had this lying around for a while now. This is great vim movement commands cheat sheet made by Ted Naleid (link to the original post). It does an amazing job aiding in the memorization of essential vim movement shortcuts.

  • Rename commit author in git

    In some extremely rare cases you end up pushing data to the repo with the wrong credentials. If you are the only author and you’re as picky as I am, it can be corrected easily:

    git filter-branch -f --env-filter
    "GIT_AUTHOR_NAME='Stan Smith';
    GIT_AUTHOR_EMAIL='stansmith@cia.gov';
    GIT_COMMITTER_NAME='Stan Smith';
    GIT_COMMITTER_EMAIL='stansmith@cia.gov';" HEAD
    git push --force
    

    In the case of there being multiple people working on a project, you may want to use the following gist posted by anonymous: https://gist.github.com/anonymous/2523336/ (again, followed by git push --force).

  • Read man pages from vim

    I recently discovered an incredibly useful function - you can look up man pages for keywords by pressing K (read: Shift + k) in normal mode when cursor is over the word you need to look up.

    It works with any shell or programming language keywords, as long as vim recognizes the filetype.

  • Mintty color scheme (Cygwin)

    Softer colors for mintty.

    I find the default cygwin color palette to be a bit ugly, so here’s one that has softer colors. Add the following lines to your .minttyrc and restart cygwin in order to apply changes.

    ForegroundColour = 131, 148, 150
    BackgroundColour =   0,   0,   0
    CursorColour     = 220,  50,  47
    
    Black            =   7,  54,  66
    BoldBlack        =   0,  43,  54
    Red              = 220,  50,  47
    BoldRed          = 203,  75,  22
    Green            =   0, 200, 132
    BoldGreen        =   0, 200, 132
    Yellow           = 204, 204, 102
    BoldYellow       = 204, 204, 102
    Blue             = 102, 153, 204
    BoldBlue         = 102, 153, 204
    Magenta          = 211,  54, 130
    BoldMagenta      = 108, 113, 196
    Cyan             =  42, 161, 152
    BoldCyan         = 147, 161, 161
    White            = 238, 232, 213
    BoldWhite        = 253, 246, 227
    

    Update (December 2018): This theme is now packaged with the default Mintty distribution! Pull up Mintty/Cygwin and check for a theme called rosipov (I didn’t pick the name).

  • Rails and MongoDB with Cygwin

    Setting up Ruby on Rails with MongoDB on a Windows machine.

    You need to have cygwin installed with ruby and git packages (obviously you may want to have more).

    The following commands are executed in the cygwin prompt:

    git clone git://github.com/rubygems/rubygems.git
    cd rubygems/
    ruby setup.rb
    gem install rails
    

    Go to the MongoDB website and download Windows binaries: http://www.mongodb.org/downloads. Extract the content of the bin/ directory to C:\cygwin\usr\local\bin.

    Create a directory for the db files (the default MongoDB db files directory is C:\datadb):

    cd /cygdrive/c
    mkdir data
    mkdir data/db
    

    Done! Both mongo and rails are in your cygwin’s path now, feel free to tweak it as you see fit.