zshrc.d/30-functions-vim.zrc
changeset 28 aa674a9c97c2
child 56 d065bc0c6991
equal deleted inserted replaced
27:77e442e4e486 28:aa674a9c97c2
       
     1 
       
     2 # Change "viml file:n" to "vim file +n"
       
     3 # Based on http://www.zsh.org/mla/users/2011/msg00333.html
       
     4 #
       
     5 function viml() {
       
     6     [[ "$#" != 1 || -r "$1" ]] && {
       
     7         vim "$@"
       
     8         return $?
       
     9     }
       
    10 
       
    11     local args
       
    12     args=(${(s.:.)1})
       
    13     [[ "$#args" -ge 2 && "$args[2]" == <-> ]] && \
       
    14         command vim "$args[1]" "+$args[2]"    || \
       
    15         command vim "$args[1]"
       
    16 }