-
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)
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
andgit
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 toC:\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.
-
Use vim commands in a browser
I’ve been giving preference to a keyboard over mouse since I discovered vim for myself, as it’s a faster and more convenient way to go. I am a Chrome user and recently I found an amazing plugin: Vimium.
It does exactly what the name suggests, allowing you to use vim-like commands in your browser. You can freely move, switch between tabs, work with forms and click links using familiar vim key bindings.
A two minute long introductory video explains basic commands and you’re all set! I’ve been using Vimium for over a week now, an amusing experience which allows you to throw your mouse in a dark corner (well, not exactly: Vimium still has some issues with over-bloated ajax pages, not to mention Flash and other nasty stuff).
Check it out: http://vimium.github.com/.
-
Git: merge two repositories
Today I had to merge changes from one repository into another. Let’s assume you want to merge
beta
intoalpha
.Operations are performed in repo alpha:
git remote add beta_repo git@rosipov.com:beta.git git fetch beta_repo git merge beta_repo/master
In this case,
beta_repo
is the name you pick for remote.If you just need to cherry-pick a certain commit from
beta
you can omit the last step and replace it with the cherry-pick.More on the topic of remotes: http://git-scm.com/book/ch2-5.html.