ZSH Case Insensitive Aliases

In my .zshrc, I set up suffix completion aliases like this so that I can more easily open files:

alias -s -- txt='mate -w'

Allows you to open text files in a text editor without adding an editor command.

However, there is a problem when I try to open a file with a capital suffix. ZSH recognizes ".txt" and opens it in a text editor, but not ".TXT."

Is there a way to make the ZSH suffix registration case insensitive so that I can open such files?

+3
source share
2 answers

This seems to be fixed for me:

setopt extendedglob
unsetopt CASE_GLOB

I got a solution from this question

+3
source

:)

alias -s -- TXT='mate -w'
alias -s -- Txt='mate -w'
alias -s -- TXt='mate -w'
alias -s -- tXt='mate -w'
alias -s -- txT='mate -w'
alias -s -- tXT='mate -w'
alias -s -- TxT='mate -w'
+4

Source: https://habr.com/ru/post/1712946/


All Articles