I\'m a mac user giving vim a serious try. Most of the GUI editors I\'m used to allow me to open a directory as a \"project\" by executing a command like:
Thanks to @sehe's suggestions, I came up with this. Not sure if it's the best solution, but it seems to work.
#!/bin/bash
if [ "$#" -eq 1 ];then # is there a path argument?
if test -d $1;then # open directory in vim
vim $1 +':cd %'
else # open file in vim
vim $1 +':cd %:h'
fi
else # no path argument, just open vim
vim
fi