tidy up for public access, insert converter for repo change
This commit is contained in:
18
qcd_function
18
qcd_function
@@ -1,4 +1,5 @@
|
||||
function cd_history () {
|
||||
# Function that replaces "cd". It stores visited folder in ~/.bash_cdhistory
|
||||
local old
|
||||
local p
|
||||
local b
|
||||
@@ -17,6 +18,7 @@ function cd_history () {
|
||||
alias cd=cd_history
|
||||
|
||||
function hcd() {
|
||||
# History cd. Run without arguments to see list of entries, give number to change cwd.
|
||||
local d
|
||||
|
||||
if [ -z "$1" ]
|
||||
@@ -31,6 +33,7 @@ function hcd() {
|
||||
}
|
||||
|
||||
function qcd() {
|
||||
# cd command, that jumps to folders visited in the near history, or user bookmarked folders
|
||||
local OPTIND
|
||||
local OPTARG
|
||||
local opt
|
||||
@@ -156,6 +159,7 @@ Keeps a history of folders visited in ~/.bash_cdhistory
|
||||
}
|
||||
|
||||
function whenfilechanges() {
|
||||
# Run a command when file(s) time stamp changes
|
||||
echo "Version: 2015-10-13"
|
||||
[ -z "$2" ] && { echo 'Usage: whenfilechanges "file" "some" "command"
|
||||
Follows the modification time of the "file" and runs the command
|
||||
@@ -202,7 +206,7 @@ function whenfilechanges() {
|
||||
}
|
||||
|
||||
function gcd() {
|
||||
# guess cd, find first match in folder, or ask if multiple hits
|
||||
# guess cd, find first match in folder, or ask if multiple hits
|
||||
local cdto
|
||||
{ cdto=$( python -c '
|
||||
import sys,os,re
|
||||
@@ -278,7 +282,7 @@ sys.stderr.write(os.path.join(pat_dir,key_match))
|
||||
}
|
||||
|
||||
function rmv () {
|
||||
#mv with rsync
|
||||
# mv files/folders with rsync (shows speed and progress)
|
||||
local sources
|
||||
sources=()
|
||||
# remove / from ends, if target is an existing folder
|
||||
@@ -329,6 +333,7 @@ function ised () {
|
||||
}
|
||||
|
||||
function foldermenu_prompt {
|
||||
# Function to add in PS prompt variable, enabling foldermenu support
|
||||
[ -f .foldermenu ] && {
|
||||
foldermenu -lf 10 $@ || echo -n "*"
|
||||
} || {
|
||||
@@ -337,12 +342,10 @@ function foldermenu_prompt {
|
||||
}
|
||||
|
||||
function _tools-update {
|
||||
# update self
|
||||
[[ -z "$TOOLSPATH" ]] || return
|
||||
[[ -w "$TOOLSPATH" ]] || return
|
||||
touch "$TOOLSPATH"/.lastupdate
|
||||
[[ -w "$TOOLSPATH"/.lastupdate ]] || return
|
||||
pushd "$TOOLSPATH" > /dev/null
|
||||
hg pull -u 2>&1
|
||||
popd > /dev/null
|
||||
"$TOOLSPATH"/rc -u
|
||||
}
|
||||
|
||||
function qbg {
|
||||
@@ -360,6 +363,7 @@ function set_term_title {
|
||||
}
|
||||
|
||||
function path_add_current {
|
||||
# Add current folder to PATH
|
||||
export PATH=$( echo $(pwd):$PATH | awk -F: '{for (i=1;i<=NF;i++) { if ( !x[$i]++ ) printf("%s:",$i); }}' | sed 's,:\+$,,g' )
|
||||
echo PATH=$PATH
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user