Merge pull request #164 from jeanblanchard/ls-aliases

Make ls aliases optional
This commit is contained in:
Nathan Broadbent
2015-03-11 22:58:01 +06:00
3 changed files with 66 additions and 61 deletions

View File

@@ -114,3 +114,5 @@ git_commit_all_with_ci_skip_keys="\C-xv" # CTRL+x, v (Appends [ci skip] to c
shell_command_wrapping_enabled="true" shell_command_wrapping_enabled="true"
# Here you can tweak the list of wrapped commands. # Here you can tweak the list of wrapped commands.
scmb_wrapped_shell_commands="vim emacs gedit cat rm cp mv ln cd" scmb_wrapped_shell_commands="vim emacs gedit cat rm cp mv ln cd"
# Add numbered shortcuts to output of ls -l, just like 'git status'
shell_ls_aliases_enabled="true"

View File

@@ -108,8 +108,9 @@ fi
# Function wrapper around 'll' # Function wrapper around 'll'
# Adds numbered shortcuts to output of ls -l, just like 'git status' # Adds numbered shortcuts to output of ls -l, just like 'git status'
unalias ll > /dev/null 2>&1; unset -f ll > /dev/null 2>&1 if [ "$shell_ls_aliases_enabled" = "true" ]; then
function ls_with_file_shortcuts { unalias ll > /dev/null 2>&1; unset -f ll > /dev/null 2>&1
function ls_with_file_shortcuts {
local ll_output local ll_output
if [ "$_ls_bsd" != "BSD" ]; then if [ "$_ls_bsd" != "BSD" ]; then
ll_output="$(\ls -lhv --group-directories-first --color "$@")" ll_output="$(\ls -lhv --group-directories-first --color "$@")"
@@ -185,8 +186,9 @@ EOF
# Turn off shwordsplit unless it was on previously # Turn off shwordsplit unless it was on previously
if [[ $shell == "zsh" ]] && [ -z "$SHWORDSPLIT_ON" ]; then unsetopt shwordsplit; fi if [[ $shell == "zsh" ]] && [ -z "$SHWORDSPLIT_ON" ]; then unsetopt shwordsplit; fi
} }
# Setup aliases # Setup aliases
alias ll="exec_scmb_expand_args ls_with_file_shortcuts" alias ll="exec_scmb_expand_args ls_with_file_shortcuts"
alias la="ll -A" alias la="ll -A"
fi

View File

@@ -26,6 +26,7 @@ source "$scmbDir/lib/scm_breeze.sh"
oneTimeSetUp() { oneTimeSetUp() {
export shell_command_wrapping_enabled="true" export shell_command_wrapping_enabled="true"
export scmb_wrapped_shell_commands="not_found cat rm cp mv ln cd sed" export scmb_wrapped_shell_commands="not_found cat rm cp mv ln cd sed"
export shell_ls_aliases_enabled="true"
alias rvm="test" # Ensure tests run if RVM isn't loaded but $HOME/.rvm is present alias rvm="test" # Ensure tests run if RVM isn't loaded but $HOME/.rvm is present