Vim
I generally use a Mac for most of my work and I am currently using MacVim as my GUI. Its pretty nice with tabs and able to open new files in a new tab in the current window. I got MacVim from MacPorts.
- At work I am working with another developer on a python project. We both have different editors with different settings for tabs etc. The code we are working on also had a number of developers before us so there are many different files with tabs or spaces for indentation with different widths.
I tried using a number of editors, some failed to identify indents properly as well. I've settled with MacVim with Indent Finder to automatically detect the indentation settings and fix Vim to match.
Indent Finder is not Mac OS X or MacVim specific.
- Pasting stuff into Vim can cause issues with auto indent and some other things. Some times comments will be auto populated to following lines and extra tabs are inserted. To copy/paste without Vim interfering use
:set paste then paste in your stuff then :set nopaste to return to normal.
- Vim Search and Replace Stuff:
You can group parts of the pattern expression enclosing them with “\(” and “\)” and refer to them inside the replacement pattern by their special number \1, \2, ..., \9. Typical example is swapping first two words of the line:
s:\(\w\+\)\(\s\+\)\(\w\+\):\3\2\1: where \1 holds the first word, \2 - any number of spaces or tabs in between and \3 - the second word.