I find it surprising on how little time coders spend on their development environment (the "dev env"). And especially, I find it amusing that I can find, refactor and test code way faster than the Netbeans IDE users in my office, with just a shell and Vim setup.
So why is a good dev env necessary? Because we do searching, refactoring, editing and updating of code much more than appending fresh code, and this also applies to code that you wrote half an hour ago, because you will want to quickly refactor it when a new constraint, a new requirement, a new design or a new idea comes to your mind.
I learned this lesson while I was writing my Vim book. Since then, I have been investing quite a bit of time on my
vimrc file, heavily customized to my liking.
To give one very quick example - I like the cursor to always be at the middle of the window (as opposed to at the bottom of the screen when you're scrolling down), so that I can see the lines of code before and after the current line. To achieve this, you simply set scrolloff=999 and you're done. A one-line setting, but it makes a world of difference in usage.
Extrapolate this to dozens of customizations and you have just optimized your environment for lesser time at the keyboard, lesser time fighting the editor, and more time on the actual code. You do not want to break your flow of thought because you're unable to quickly switch between the right files (say, between the controller and the view files), and so on. 
These customizations are stored in
.bashrc files, collectively referred to as "dotfiles". I have been asked quite a few times by readers of my book to share my dotfiles, but I was not comfortable to share it because I felt it was too hacked up and did not have a good "base".
These are my actual working environments at office and on my personal laptop, so if you don't agree with some of my defaults, fork away.
Now, on to what is interesting about my setup...
What bash-it provides
bash-it provides great defaults and aliases, right from
.. as a shortcut for
cd .. and
cd ../.. to bash completion setups for git, rake, etc., and of course, a gorgeous theme to use:
The best part though is it's neat organization into aliases, completion, custom, lib, plugins, themes and template folders. That makes a big difference in the long run, for the same reasons why a cleanly modularized codebase is better than one giant script.
And it will get various new features over time contributed by the community, example, completion of server names for ssh.
What vim-addon-manager provides
vim-addon-manager provides a super-simple way to install plugins into separate folders and then use them all, instead of lumping all of them together into a
.vim folder. Just add the name of a new Vim plugin to the list of plugins you want to load, and it will automatically fetch the plugin and install it for you! This makes it easy to play around with new plugins as well as a simple way of having the latest version of the Vim plugins.
There are caveats to vim-addon-manager, mainly that all plugins don't seamlessly work with it. For example, I couldn't get pyflakes.vim to work with it, so I had to unzip pyflakes into my regular
.vim directory to use it.
My Bash customizations
Ever since I saw gemedit, I wanted something like that for Python eggs, and I realized that it was easy because Python modules have a
__file__ attribute that I can use, and I created my own egg_edit command to do the same trick. Similarly, I have my own sync command with the settings that I prefer, etc.
tmux is a modern alternative to GNU Screen which is a common arsenal in any Unix coder's war-chest. I prefer to use tmux because it makes it easy to script sessions which makes it super-easy to start a new session working on a project. For example:
Put this as
flask-boilerplate-tmux.bash into the
custom folder of your bash-it/dotbash folder, and then you can run
flask-boilerplate-tmux any time to start a new session to work on the flask-boilerplate codebase! ( Update : Check out Teamocil which will allow you to do the same with a simple yaml config file )
I have a highly customized tmux configuration which sets many good default settings, especially starting the numbering of the windows from 1 (switching between 0 and 1 is painfully because they are at the opposite ends of the keyboard).
A good Bash plugin to use is autojump which monitors which directories you spend most of your time in, and then makes it easy to jump to your most favorite directories using a simple
Don't forget to use
jumpstat to see which are those directories. Also, bash-it/dotbash provides a command called
rh that does something similar.
Note that I have started using autojump only recently, so I don't have as much experience using it as the other tools.
My Vim customizations
I have a fairly customized vimrc, right from changing the status line to providing shortcuts like
:A to copy the full buffer to the clipboard and
:B for vice-versa, which I find it very useful in situations such as I am writing this article in Vim and can quickly copy/paste into Wordpress when I am done with the draft. I also have a
o shortcut to open a URL that the cursor is on, and many other goodies.
Vim plugins I use
There are three Vim plugins which are must-have for me:
First is command-t.vim which is a "fuzzy finder" to quickly jump to another file under the current directory.
Second is ack.vim which allows you to intelligently grep your source code for patterns and then jump to each occurrence in a split-window fashion.
My favorite feature is that I can search my code with
:Ack --python or
Third is conque shell which allows you to to create a split window which can be any interpreter prompt.
The best part is that you can use a shortcut
e (assuming the default mapleader) to send the visually selected text to the interpreter prompt as if it was copy-pasted and it will execute it! This is incredibly helpful when you want to iterate the development of a multi-line function or fragment of code and you find extracting that code to a separate file and editing that file to be a pain (The interpreter prompts are designed for playing around with one-liners, they are simply not built for multi-line code).
I have the following lines in my vimrc to quickly create ConqueShell sessions:
command Shell :set nolist | ConqueTermSplit bash command PythonShell :set nolist | ConqueTermSplit python
So, I quickly run
PythonShell to create a new session.
Setups by others
I'm hoping this article will help Vimmers and Bash users to broaden their usage and help them be more productive, the same intention behind my Vim book:
"I used to play with vim for years. I think this book would have to save me much time if it was written 10 years ago! Anyways, thank you for this amazing work you are doing."
-- turky_samy (at) hotmail (dot) fr
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe."
-- Abraham Lincoln
 The flip side though is that I have been told "You're the most mysterious guy in this office. No one understands what you're doing when we see you coding." Heh. Hopefully, it is not as mysterious after this article.