Remove functions that are now binaries.

Also, input config is now part of bash.org
This commit is contained in:
Thomas Dehaeze 2020-05-26 08:33:44 +02:00
parent 14d997b598
commit d09e7873c4
2 changed files with 103 additions and 161 deletions

View File

@ -173,7 +173,7 @@ bind '"\e[B": history-search-forward'
** Functions
*** Display colors
#+BEGIN_SRC bash
colors() {
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
@ -198,65 +198,7 @@ colors() {
done
echo; echo
done
}
#+END_SRC
*** Meteo
#+BEGIN_SRC bash
meteo() {
if [ -n "$*" ]; then
address="wttr.in/"
address+=$*
address+="?lang=fr"
curl "$address"
else
address="wttr.in/"
address+="?lang=fr"
curl "$address"
fi
}
alias meteo=meteo
#+END_SRC
*** Upload using transfer.sh
#+BEGIN_SRC bash
upload() {
# write to output to tmpfile because of progress bar
tmpfile=$(mktemp -t transferXXX)
# basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9]/-/g')
curl --progress-bar --upload-file "$1" "https://transfer.sh/" >> $tmpfile;
cat $tmpfile | xsel -ib;
echo "Copied:" $(cat $tmpfile);
rm -f $tmpfile;
}
alias upload=upload
#+END_SRC
*** Extract archive
usage: ex <file>
#+BEGIN_SRC bash
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
#+END_SRC
*** Tree display
@ -266,16 +208,16 @@ the =.git= directory, listing directories first. The output gets piped into
small enough for one screen.
#+BEGIN_SRC bash
function tre() {
function tre() {
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX;
}
}
#+END_SRC
*** Create a new directory and enter it
#+BEGIN_SRC bash
function mkd() {
function mkd() {
mkdir -p "$@" && cd "$_";
}
}
#+END_SRC
*** Filesize of directory
@ -429,3 +371,67 @@ This is important for termite to work when sshing in remote machines.
PATH=~/.emacs.d/bin:$PATH
export PATH
#+END_SRC
* Input
:PROPERTIES:
:header-args: :tangle ~/.inputrc
:header-args+: :comments both :mkdirp yes
:END:
Completion:
#+BEGIN_SRC conf
# Single tab for autocompletion
set show-all-if-ambiguous on
# Ignore case for completion
set completion-ignore-case on
#+END_SRC
vi mode:
#+BEGIN_SRC conf
# VI mode (works in bash and zsh)
set editing-mode vi
# Show which mode (normal or insert)
set show-mode-in-prompt on
# Show the mode by changing the cursor
set vi-ins-mode-string \1\e[6 q\2
set vi-cmd-mode-string \1\e[2 q\2
#+END_SRC
Key-bindings for vi-mode:
#+BEGIN_SRC conf
set keymap vi-command
# these are for vi-command mode
Control-l: clear-screen
Control-a: beginning-of-line
Control-e: end-of-line
Control-w: "\C-aisudo \C-e"
set keymap vi-insert
# these are for vi-insert mode
Control-l: clear-screen
Control-a: beginning-of-line
Control-e: end-of-line
Control-w: "\C-asudo \C-e"
#+END_SRC
Colorized completion
#+begin_src conf
# Color files by types
set colored-stats On
# Append char to indicate type
set visible-stats On
# Mark symlinked directories
set mark-symlinked-directories On
# Color the common prefix
set colored-completion-prefix On
# Color the common prefix in menu-complete
set menu-complete-display-prefix On
#+end_src
Don't echo =^C= after =Ctrl+C= is pressed.
#+begin_src conf
set echo-control-characters off
#+end_src

View File

@ -88,70 +88,6 @@
</fontconfig>
#+end_src
* Input
:PROPERTIES:
:header-args: :tangle ~/.inputrc
:header-args+: :comments both :mkdirp yes
:END:
Completion:
#+BEGIN_SRC conf
# Single tab for autocompletion
set show-all-if-ambiguous on
# Ignore case for completion
set completion-ignore-case on
#+END_SRC
vi mode:
#+BEGIN_SRC conf
# VI mode (works in bash and zsh)
set editing-mode vi
# Show which mode (normal or insert)
set show-mode-in-prompt on
# Show the mode by changing the cursor
set vi-ins-mode-string \1\e[6 q\2
set vi-cmd-mode-string \1\e[2 q\2
#+END_SRC
Key-bindings for vi-mode:
#+BEGIN_SRC conf
set keymap vi-command
# these are for vi-command mode
Control-l: clear-screen
Control-a: beginning-of-line
Control-e: end-of-line
Control-w: "\C-aisudo \C-e"
set keymap vi-insert
# these are for vi-insert mode
Control-l: clear-screen
Control-a: beginning-of-line
Control-e: end-of-line
Control-w: "\C-asudo \C-e"
#+END_SRC
Colorized completion
#+begin_src conf
# Color files by types
set colored-stats On
# Append char to indicate type
set visible-stats On
# Mark symlinked directories
set mark-symlinked-directories On
# Color the common prefix
set colored-completion-prefix On
# Color the common prefix in menu-complete
set menu-complete-display-prefix On
#+end_src
Don't echo =^C= after =Ctrl+C= is pressed.
#+begin_src conf
set echo-control-characters off
#+end_src
* GnuPG
:PROPERTIES:
:header-args: :tangle ~/.gnupg/gpg-agent.conf