Opções de alias no zsh

0

Ao usar o comando zsh alias, o que faz o -s flag (por exemplo, linhas 83-87 de plug-in de alias comuns do oh-my-zsh ?

    
por raisin 13.01.2015 / 04:15

1 resposta

4

o que o sinalizador -s faz

alias -s ... cria um Sufixo Alias , que permite atribuir comandos a sufixos de nome de arquivo.

Sufixo de apelidos

Since zsh 4.2.x its possible to make a programme alias for a given filename extension. That means, you can assign commands to filename suffixes.

alias -s txt='less -rE'

Now every time you enter a $filename with extension .txt less -rE $filename is invoked.

If you use '*.txt' then all files with that extension will be invoked with the command less with options -r -E.

Fonte link

Exemplos

Suffix aliases are supported in zsh since version 4.2.0. Some examples:

alias -s tex=vim
alias -s html=w3m
alias -s org=w3m

Now pressing return-key after entering foobar.tex starts vim with foobar.tex.

Calling a html-file runs browser w3m.

www.zsh.org and pressing enter starts w3m with argument www.zsh.org.

Fonte ZSH-LOVERS (1)

    
por 13.01.2015 / 11:36

Tags