Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new feature to base.plugin.bash #2257

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions aliases/available/general.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ alias _='sudo'
alias vbrc='${VISUAL:-vim} ~/.bashrc'
alias vbpf='${VISUAL:-vim} ~/.bash_profile'


# colored grep
# Need to check an existing file for a pattern that will be found to ensure
# that the check works when on an OS that supports the color option
Expand Down Expand Up @@ -55,6 +56,7 @@ alias cd..='cd ..' # Common misspelling for going up one directory
alias ...='cd ../..' # Go up two directories
alias ....='cd ../../..' # Go up three directories
alias -- -='cd -' # Go back
alias d='cd /home/$USER/Downloads' # Go to the Downloads directory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit too short and already taken by a function for the fasd plugin. please rename to something that won't clobber or move to your private alias file.


# Shell History
alias h='history'
Expand All @@ -68,6 +70,9 @@ fi
alias md='mkdir -p'
alias rd='rmdir'

# Remove
alias rmrf='rm -rf'

# Shorten extract
alias xt='extract'

Expand Down
13 changes: 13 additions & 0 deletions plugins/available/base.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,16 @@ if ! _command_exists del; then
mkdir -p /tmp/.trash && mv "$@" /tmp/.trash
}
fi

# replace multiple file extensions at once
function rex() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a package in Ubuntu and other distros called rex and I would rather not have them clash. Could you consider naming it renex or rext?

about 'mass replace of the extension of multiple files'
param '1: extension to replace'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is mixed spaces and tabs, please align all to just tabs. Thanks!

param '2: new extenstion'
example 'rex txt md'
group 'base'
local ext2replace="${1:-}"
local newext="${2:-}"
local files=(`ls *.$ext2replace`)
for file in "${files[@]}"; do mv "$file" "${file/%.$ext2replace/.$newext}"; done
}
Loading