Monday, November 11, 2013

Snipmate

If you like Textmate Snippits, consider installing Snipmate. From the Github page.

SnipMate aims to provide support for textual snippets, similar to TextMate or other Vim plugins like UltiSnips. For example, in C, typing for<tab> could be expanded to:
for (i = 0; i < count; i++) {
    /* code */
}
The project linked above appears to be a fork of the original plugin, but it's up to date, and it works!

Friday, November 8, 2013

Supertab

If you like Bash auto-completion, you'll love Supertab. Installation and configuration details are available via its Github Page.

Wednesday, November 6, 2013

Vim Gitgutter

Vim Gitgutter Vim Gitgutter shows a diff in the sign (left-hand) column of your editing window. This is a really cool way to see what portions of a file have changed without resorting to git diff.















Edit:
Droggl asked how to disable vim-gutter when viewing log files because of slowness. I've come up with the following solution which seems like it should work.

Assuming your log files end in *.log, add the following to your ~/.vimrc.
autocmd BufNewFile,BufReadPost *.log setlocal filetype=log
filetype plugin on
Then make an entry like so in ~/.vim/ftplugin/log.vim
:GitGutterDisable
Hope that helps!

Basic Recovery

The following commands are useful for recovering an editing session.

Retrieve a list of recoverable files.
vim -r
Recover a specific file.
vim -r .file.extension.swp (from swap files listed above)
Recover an unnamed (unsaved) file.
vim -r .swp
Or from inside of Vim:
:recover .file.extension.swp

Tuesday, November 5, 2013

Watching Memcached Traffic with TCPDump

Here's a fun little one-liner I just hacked together to keep tabs on the get/set commands coming in on a memcached server that I administer.
sudo tcpdump -i eth0 -s 65535 -A -ttt port 11211| cut -c 9- | grep -i '^get\|set'
It'd be easy to feed the output of this command into another script to aggregate key summary data over a given sample period.

Monday, November 4, 2013

Wrap Git With Fugitive

From the Fugitive Github page:

I'm not going to lie to you; fugitive.vim may very well be the best Git wrapper of all time. Check out these features:

View any blob, tree, commit, or tag in the repository with :Gedit (and :Gsplit, :Gvsplit, :Gtabedit, ...). Edit a file in the index and write to it to stage the changes. Use :Gdiff to bring up the staged version of the file side by side with the working tree version and use Vim's diff handling capabilities to stage a subset of the file's changes.


Quite simply, Fugitive provides a ton of awesome hooks for integrating Vim with Git's best features. Check it out!