Update bash config
This commit is contained in:
parent
fbd71a4d65
commit
ddd338ce1d
@ -23,7 +23,7 @@
|
|||||||
:header-args:bash+: :comments both :mkdirp yes
|
:header-args:bash+: :comments both :mkdirp yes
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
** TODO What does that do?
|
** What does that do?
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
[[ $- != *i* ]] && return
|
[[ $- != *i* ]] && return
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
@ -46,7 +46,7 @@ bind "set show-all-if-ambiguous on"
|
|||||||
alias grep='grep --colour=auto'
|
alias grep='grep --colour=auto'
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** TODO Set colorful PS1 only on colorful terminals.
|
** Set colorful PS1 only on colorful terminals.
|
||||||
dircolors --print-database uses its own built-in database instead of using /etc/DIR_COLORS. Try to use the external file first to take advantage of user additions. Use internal bash globbing instead of external grep binary.
|
dircolors --print-database uses its own built-in database instead of using /etc/DIR_COLORS. Try to use the external file first to take advantage of user additions. Use internal bash globbing instead of external grep binary.
|
||||||
|
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
@ -84,11 +84,10 @@ dircolors --print-database uses its own built-in database instead of using /etc/
|
|||||||
fi
|
fi
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** Some config
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
unset use_color safe_term match_lhs sh
|
unset use_color safe_term match_lhs sh
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC bash
|
|
||||||
xhost +local:root > /dev/null 2>&1
|
xhost +local:root > /dev/null 2>&1
|
||||||
|
|
||||||
complete -cf sudo
|
complete -cf sudo
|
||||||
@ -126,7 +125,7 @@ bind '"\e[A": history-search-backward'
|
|||||||
bind '"\e[B": history-search-forward'
|
bind '"\e[B": history-search-forward'
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** TODO Aliases
|
** Aliases
|
||||||
*** Better defaults for some commands
|
*** Better defaults for some commands
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
alias cp="cp -i" # confirm before overwriting something
|
alias cp="cp -i" # confirm before overwriting something
|
||||||
@ -166,26 +165,12 @@ bind '"\e[B": history-search-forward'
|
|||||||
alias :e=nvim
|
alias :e=nvim
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** Youtube
|
|
||||||
#+BEGIN_SRC bash
|
|
||||||
alias yt="youtube-dl --add-metadata -ic" # Download video link
|
|
||||||
alias yta="yt -x -f bestaudio/best" # Download only audio
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
*** Print each PATH entry on a separate line
|
*** Print each PATH entry on a separate line
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
alias path='echo -e ${PATH//:/\\n}'
|
alias path='echo -e ${PATH//:/\\n}'
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** TODO [#B] IP addresses - Remove the use of =dig= and =ifbashig=
|
** Functions
|
||||||
Use =addr= instead
|
|
||||||
#+BEGIN_SRC bash
|
|
||||||
# alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
|
|
||||||
# alias localip="ip route get 8.8.4.4 | head -1 | awk '{print $7}'"
|
|
||||||
# alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** TODO Functions
|
|
||||||
*** Display colors
|
*** Display colors
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
colors() {
|
colors() {
|
||||||
@ -216,9 +201,7 @@ colors() {
|
|||||||
}
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** TODO Meteo - Is Dig mandatory?
|
*** Meteo
|
||||||
To install =dig=, use =yay -S bind-tools=
|
|
||||||
|
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
meteo() {
|
meteo() {
|
||||||
if [ -n "$*" ]; then
|
if [ -n "$*" ]; then
|
||||||
@ -228,7 +211,6 @@ To install =dig=, use =yay -S bind-tools=
|
|||||||
curl "$address"
|
curl "$address"
|
||||||
else
|
else
|
||||||
address="wttr.in/"
|
address="wttr.in/"
|
||||||
address+=$(ip)
|
|
||||||
address+="?lang=fr"
|
address+="?lang=fr"
|
||||||
curl "$address"
|
curl "$address"
|
||||||
fi
|
fi
|
||||||
@ -236,7 +218,7 @@ To install =dig=, use =yay -S bind-tools=
|
|||||||
alias meteo=meteo
|
alias meteo=meteo
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** TODO Upload using transfer.sh
|
*** Upload using transfer.sh
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
upload() {
|
upload() {
|
||||||
# write to output to tmpfile because of progress bar
|
# write to output to tmpfile because of progress bar
|
||||||
@ -250,14 +232,6 @@ To install =dig=, use =yay -S bind-tools=
|
|||||||
alias upload=upload
|
alias upload=upload
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** TODO Upload alternative
|
|
||||||
#+BEGIN_SRC bash
|
|
||||||
transfer() {
|
|
||||||
curl --progress-bar --upload-file "$1" https://transfer.sh/$(basename $1) | xclip -in -selection clipboard;
|
|
||||||
}
|
|
||||||
alias transfer=transfer
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
*** Extract archive
|
*** Extract archive
|
||||||
usage: ex <file>
|
usage: ex <file>
|
||||||
|
|
||||||
@ -368,6 +342,11 @@ Force prompt to write history after every command. http://superuser.com/question
|
|||||||
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
|
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** Starship Prompt
|
||||||
|
#+begin_src bash
|
||||||
|
eval "$(starship init bash)"
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Bash Profile
|
* Bash Profile
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:header-args:bash: :tangle ~/.bash_profile
|
:header-args:bash: :tangle ~/.bash_profile
|
||||||
@ -396,6 +375,14 @@ Force prompt to write history after every command. http://superuser.com/question
|
|||||||
export SUDO_ASKPASS=~/bin/askpass-rofi
|
export SUDO_ASKPASS=~/bin/askpass-rofi
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** Gnome Keyring Daemon
|
||||||
|
#+begin_src bash
|
||||||
|
if [ -n "$DESKTOP_SESSION" ];then
|
||||||
|
eval $(gnome-keyring-daemon --start)
|
||||||
|
export SSH_AUTH_SOCK
|
||||||
|
fi
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Default
|
** Default
|
||||||
#+begin_src bash
|
#+begin_src bash
|
||||||
export EDITOR="nvim"
|
export EDITOR="nvim"
|
||||||
@ -431,11 +418,6 @@ Force prompt to write history after every command. http://superuser.com/question
|
|||||||
export GOPATH=$HOME/go
|
export GOPATH=$HOME/go
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** SSH Agent
|
|
||||||
#+begin_src bash
|
|
||||||
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Path
|
** Path
|
||||||
#+begin_src bash
|
#+begin_src bash
|
||||||
PATH=$HOME/appimages:$PATH
|
PATH=$HOME/appimages:$PATH
|
||||||
|
Loading…
Reference in New Issue
Block a user