Merge eddb356fee into 011e9767d6
commit
ba1b1382ad
|
|
@ -11,6 +11,7 @@ Includes autocompletion, themes, aliases, custom functions, a few stolen pieces
|
||||||
1. Check a clone of this repo: `git clone https://github.com/revans/bash-it.git ~/.bash_it`
|
1. Check a clone of this repo: `git clone https://github.com/revans/bash-it.git ~/.bash_it`
|
||||||
2. Run `~/.bash_it/install.sh` (it automatically backs up your `~/.bash_profile`)
|
2. Run `~/.bash_it/install.sh` (it automatically backs up your `~/.bash_profile`)
|
||||||
3. Edit your `~/.bash_profile` file in order to customize bash-it.
|
3. Edit your `~/.bash_profile` file in order to customize bash-it.
|
||||||
|
4. Run `$ edit` and edit this file to have bookmarks to the files you edit over and over again
|
||||||
|
|
||||||
**NOTE:**
|
**NOTE:**
|
||||||
The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll).
|
The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll).
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ alias c='clear'
|
||||||
alias k='clear'
|
alias k='clear'
|
||||||
alias cls='clear'
|
alias cls='clear'
|
||||||
|
|
||||||
alias edit="$EDITOR"
|
|
||||||
alias pager="$PAGER"
|
alias pager="$PAGER"
|
||||||
|
|
||||||
alias q='exit'
|
alias q='exit'
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/.bash_profile
|
||||||
|
|
||||||
echo "Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it"
|
echo "Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it"
|
||||||
|
|
||||||
|
# TODO: this should be tested more.
|
||||||
|
cp $BASH_IT/template/FILES.template $BASH_IT/custom/FILES
|
||||||
|
echo "Copied the template FILES into $BASH_IT/custom/FILES, edit this file to have bookmarks to file you 'edit' often"
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP
|
read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP
|
||||||
|
|
|
||||||
|
|
@ -353,3 +353,48 @@ all_groups ()
|
||||||
cat $file | sort | uniq
|
cat $file | sort | uniq
|
||||||
rm $file
|
rm $file
|
||||||
}
|
}
|
||||||
|
edit () {
|
||||||
|
FILES=$1
|
||||||
|
if [ -z "$FILES" ]
|
||||||
|
then
|
||||||
|
$EDITOR $BASH_IT/custom/FILES
|
||||||
|
else
|
||||||
|
$EDITOR $FILES
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
archive () {
|
||||||
|
FILE=$1
|
||||||
|
BASEFILE=$(basename "$FILE")
|
||||||
|
TODAY=$(date --rfc-3339=date)
|
||||||
|
TARGET="$TODAY--$BASEFILE"
|
||||||
|
|
||||||
|
if [ -z "$FILE" ]
|
||||||
|
then
|
||||||
|
echo "move a file in the '$ARCHIVE' directory, timestamping it with $TODAY"
|
||||||
|
echo "Syntaxe : archive <file>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ -d "$FILE" ]
|
||||||
|
then
|
||||||
|
echo "sorry, archive doesn't work for directories"
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
if [ ! -r "$FILE" ]
|
||||||
|
then
|
||||||
|
echo "Cannot read file '$FILE'"
|
||||||
|
return 3
|
||||||
|
fi
|
||||||
|
if [ -z "$ARCHIVE" ]
|
||||||
|
then
|
||||||
|
ARCHIVE=$HOME/archive
|
||||||
|
fi
|
||||||
|
if [ ! -r "$ARCHIVE" ]
|
||||||
|
then
|
||||||
|
mkdir -p "$ARCHIVE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Archiving '$FILE' in '$ARCHIVE'"
|
||||||
|
/bin/mv -- "$FILE" "$ARCHIVE"/"$TARGET"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
# This file is opened with you type 'edit' without argument
|
||||||
|
# $ edit
|
||||||
|
|
||||||
|
# Simply edit this file and put you have bookmarks to the files you edit most
|
||||||
|
#
|
||||||
|
# You don't need anymore to go to the same directory and open the same files again and again
|
||||||
|
# How to open the file is then trivial
|
||||||
|
# - With vim, see :help gf
|
||||||
|
# - With xxx, do yyyy
|
||||||
|
# - If your text editor doesn't have that feature, simply copy and paste
|
||||||
|
|
||||||
|
# When you call edit with arguments, edit is simply a shortcut to EDITOR
|
||||||
|
# $ edit /etc/fstab
|
||||||
|
|
||||||
|
# edit those files as root
|
||||||
|
/etc/apt/sources.list
|
||||||
|
/etc/fstab
|
||||||
|
/etc/hosts
|
||||||
|
/etc/hosts
|
||||||
|
/etc/nginx/conf.d/nginx.conf
|
||||||
|
/etc/profile
|
||||||
|
|
||||||
|
# edit those files as a user
|
||||||
|
$BASH_IT/aliases/custom.aliases.bash
|
||||||
|
$BASH_IT/lib/custom.bash
|
||||||
|
$BASH_IT/plugins/custom.plugins.bash
|
||||||
|
$HOME/.bash_profile
|
||||||
|
$HOME/.vimrc
|
||||||
|
$HOME/.emacs
|
||||||
|
|
||||||
|
# See here for inspiration of what you can put here
|
||||||
|
http://en.wikibooks.org/wiki/Guide_to_Unix/Files
|
||||||
|
|
@ -1,5 +1,19 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Set where your want to archive your files with the archive command
|
||||||
|
export ARCHIVE=$HOME/archive # default
|
||||||
|
|
||||||
|
# Set the XDG_* environnment variable
|
||||||
|
# See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
|
export XDG_DATA_HOME=$HOME/.local/share
|
||||||
|
export XDG_CONFIG_HOME=$HOME/.config
|
||||||
|
export XDG_CONFIG_DIRS=/etc/xdg
|
||||||
|
export XDG_CACHE_HOME=$HOME/.cache
|
||||||
|
# export XDG_RUNTIME_DIR=we won t set this for you, read the spec
|
||||||
|
# export XDG_DATA_DIRS=we won t set this for you, read the spec
|
||||||
|
# TODO : those directories should be created if they don't exist
|
||||||
|
|
||||||
|
|
||||||
# Load RVM, if you are using it
|
# Load RVM, if you are using it
|
||||||
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
|
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
|
||||||
|
|
||||||
|
|
@ -41,5 +55,6 @@ export SCM_CHECK=true
|
||||||
# https://github.com/xvzf/vcprompt
|
# https://github.com/xvzf/vcprompt
|
||||||
#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
|
#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
|
||||||
|
|
||||||
|
|
||||||
# Load Bash It
|
# Load Bash It
|
||||||
source $BASH_IT/bash_it.sh
|
source $BASH_IT/bash_it.sh
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue