Coding

Work environment

Vim

When not in Visual Studio, my code editor of choice is Vim.

I started using it seriously only a few years ago thanks to ViEmu (see below).
What can I say.. the basic Vi mechanics are very programmer-like and I think that they give an edge on efficiency when typing code.
Actually turning Vim into an full fledged coding environment is a different matter. Like many things in programming, it's a journey. It has great potential, but it takes time and care.

Here's my Vim setup on GitHub: https://github.com/dpasca/vimfiles

My local .vimrc is a bootstrap config that jumps to the actual config that I have on Dropbox.
This basic .vimrc is different on OS X and Windows.

.vimrc on OS X:
let $MYCLANGLIBPATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/"
let $MYVIMFILES="~/Dropbox/Settings/vimfiles"
source $MYVIMFILES/vimrc
.vimrc on Windows:
let $MYCLANGLIBPATH="C:/Program Files (x86)/LLVM/bin"
let $MYVIMFILES="$HOME/Dropbox/Settings/vimfiles"
source $MYVIMFILES/vimrc
It's basically a redirection to the vimfiles directory that I keep in Dropbox (in addition to the git synching.. best of both worlds).
I can get my whole Vim environment in any computer by simply synching the Dropbox account and setting the .vimrc to have those two lines alone.

As for installing, on OS X I rely on Homebrew. Using the following install command:
brew install macvim --override-system-vim
..and changing /etc/paths to have /usr/local/bin listed first, thus having top priority as a search path.
See "Change order of PATH entries on Mac OS X" more info.

Visual Assist X (Visual Studio plug-in)

To me, this is a must-have for C++ programming.
It has some very useful features, like better syntax highlight and better autocompletion. But the biggest difference to me comes from its ability to deal with code at the symbolic level, something that I find essential to program in C++. So much so that without it I'd probably revert to some sort of hybrid C+ programming.

With VAX I can find and rename anywhere in the code a method from any class.
For example I can find all instances of the method Draw() only for the class Widget.
Or I can rename Draw() to Paint() only the class Widget, while keeping Draw() for the class Mesh.

This is something that couldn't be done with a plain textual find and replace, because at the text level Draw() is Draw().

Unless one adopts a 'C' style with explicit decoration, like:

class Widget
{
    string mWidget_Name;
    void Widget_Draw();
};

..but that's clearly insane 8P

See more about VAX at http://www.wholetomato.com/

ViEmu (Visual Studio plug-in)

This is pretty much like having Vim inside Visual Studio (minus the Vim plugins, of course).
I've been using it for a few years now. It takes a while to get used to it, but it's quite powerful and it spares me from having to fiddle too much with the mouse.

I also like the fact that one needs very few special keys. I used to use the Borland-style cut & paste, but that requires plain (and big) full size keyboards.

See more about ViEmu at http://www.viemu.com/

Note: ViEmu is now also available for Xcode. Needless to say that it's a must for me.

AutoHotkey


I use AutoHotkey to have Vim-like cursor movement anywhere in Windows.

This is mostly useful in Visual Studio itself. For example when I'm typing a method and VAX suggests it, I can select it without having to reach for the cursor keys.
The same thing goes for other panels, like for the Find in File Results or the Error List..

Here's my script:

^+h:: Send, {Left}
^+j:: Send, {Down}
^+k:: Send, {Up}
^+l:: Send, {Right}

Basically mapping CTRL+SHIFT+ h / j / k / l to the cursor keys.

Incidentally, I also map my Caps Lock to act as a Control key.
This doesn't work well with AutoHotKey, so I used KeyTweak instead.

My public GitHub repo

It's not much, just the old RibTools which I recently moved there.

I also use GitHub for private repositories for work (meaning the oyatsukai.com games)

Maybe someday I'll get a chance to make more of that stuff public !


Here's the link: https://github.com/dpasca
Also my Gistshttps://gist.github.com/dpasca

Coding style


This is the coding style (not the colors), that I've been using in C++ for a while now.