rcmdnk / sentaku

Utility to make sentaku (selection, 選択(sentaku)) window with shell command.
http://rcmdnk.github.io/blog/2014/01/24/computer-bash-zsh/
MIT License
139 stars 6 forks source link

support custom aliases #10

Closed alem0lars-yr closed 7 years ago

alem0lars-yr commented 7 years ago

Currently if a user (like me) has defined some one-letter aliases, they will break sentaku.

This pull-request fixes those cases.

-- Alessandro

rcmdnk commented 7 years ago

I tested with one-letter alias such alias j=ls, but it doesn't affect on sentaku. Could you please tell me more details about your settings?

alem0lars-yr commented 7 years ago
if [[ $OSTYPE == darwin* && $commands[gls] ]]; then
  alias l="gls --color=auto"
elif [[ $OSTYPE == linux* ]]; then
  alias l="ls --color=auto"
fi
type l > /dev/null
if [[ $? -eq 0 ]]; then
  alias ll="l -lsh"
  alias la="ll -a"
fi

if [[ ${commands[sudo]} ]]; then
  alias -g S="sudo"
fi

alias -g E="${EDITOR}"
alias -g EE="S E"

alias -g G="| grep"
alias -g L="| less -r"

if [[ $commands[xclip] ]]; then
  alias -g C="| xclip -i -selection clipboard"
elif [[ $commands[pbcopy] ]]; then
  alias -g C="| pbcopy"
fi
if [[ $commands[xclip] ]]; then
  alias -g P="xclip -o -selection clipboard |"
elif [[ $commands[pbpaste] ]]; then
  alias -g P="pbpaste |"
fi
rcmdnk commented 7 years ago

I think you are using zsh, but I still don't see anything wrong even with your setup. Aliases should not affect on sentaku because aliases work only on the command line.

Could you explain what is happening? Which timing do you have problem? The content of the pull request is fine with me as it doesn't change anything as long as I know, but I would like to know exactly what is wrong.