diff -r 77e442e4e486 -r aa674a9c97c2 zshrc.d/30-functions-vim.zrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zshrc.d/30-functions-vim.zrc Wed Mar 18 20:12:05 2015 +0100 @@ -0,0 +1,16 @@ + +# Change "viml file:n" to "vim file +n" +# Based on http://www.zsh.org/mla/users/2011/msg00333.html +# +function viml() { + [[ "$#" != 1 || -r "$1" ]] && { + vim "$@" + return $? + } + + local args + args=(${(s.:.)1}) + [[ "$#args" -ge 2 && "$args[2]" == <-> ]] && \ + command vim "$args[1]" "+$args[2]" || \ + command vim "$args[1]" +}