author | Mikael Berthe <mikael@lilotux.net> |
Sat, 20 Aug 2022 14:39:34 +0200 | |
changeset 56 | d065bc0c6991 |
parent 28 | aa674a9c97c2 |
permissions | -rw-r--r-- |
28 | 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]" || \ |
|
56
d065bc0c6991
viml: Pass all args to vim
Mikael Berthe <mikael@lilotux.net>
parents:
28
diff
changeset
|
15 |
command vim "$@" |
28 | 16 |
} |