literate-dotfiles/docs/bash.html

720 lines
21 KiB
HTML
Raw Normal View History

2020-01-11 22:04:45 +01:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
2020-05-26 08:40:15 +02:00
<!-- 2020-05-26 mar. 08:39 -->
2020-01-11 22:04:45 +01:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Bash Configuration</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
2020-01-11 22:22:46 +01:00
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="./js/readtheorg.js"></script>
2020-01-11 22:04:45 +01:00
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Bash Configuration</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orge676bb2">Bashrc</a>
<ul>
2020-03-01 22:51:16 +01:00
<li><a href="#org6524e6a">What does that do?</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#orgade44ee">Bash Completion</a></li>
<li><a href="#orgd9f988d">Ignore case for autocompletion</a></li>
<li><a href="#org41663f0">Use Color</a></li>
2020-03-01 22:51:16 +01:00
<li><a href="#org72d992f">Set colorful PS1 only on colorful terminals.</a></li>
<li><a href="#orgd137e06">Some config</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#org6e324a6">Prompt</a></li>
2020-03-01 22:51:16 +01:00
<li><a href="#orgaf06a47">SSH Agent</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#org586ae40">Rebind up and down arrow keys to search through bash history</a></li>
2020-03-01 22:51:16 +01:00
<li><a href="#org928d454">Aliases</a>
2020-01-11 22:04:45 +01:00
<ul>
<li><a href="#orgfc778e8">Better defaults for some commands</a></li>
<li><a href="#orgd519f4b">One letter aliases</a></li>
<li><a href="#org564af34">Neovim</a></li>
<li><a href="#org258d499">Magit</a></li>
<li><a href="#org9b3882d">Vim-like</a></li>
<li><a href="#org62f7fe5">Print each PATH entry on a separate line</a></li>
</ul>
</li>
2020-03-01 22:51:16 +01:00
<li><a href="#org25e4d93">Functions</a>
2020-01-11 22:04:45 +01:00
<ul>
<li><a href="#orgfc4520c">Display colors</a></li>
<li><a href="#org1522290">Tree display</a></li>
<li><a href="#orgfe71409">Create a new directory and enter it</a></li>
<li><a href="#org4395b78">Filesize of directory</a></li>
<li><a href="#orgf1e7ce2">Redirect both standard output and standard error, as well as sending to background</a></li>
<li><a href="#org2896f4a">Send SMS</a></li>
</ul>
</li>
<li><a href="#org9d14b86">Bash History</a></li>
</ul>
</li>
<li><a href="#org6a5ac47">Bash Profile</a></li>
<li><a href="#org99b9ec7">Profile</a>
<ul>
<li><a href="#orgfbbfbf9">QT And GTK Themes</a></li>
<li><a href="#orgbe2ffab">Gui program to ask for sudo password</a></li>
2020-03-01 22:51:16 +01:00
<li><a href="#orga5ea80f">Gnome Keyring Daemon</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#org3e2966e">Default</a></li>
<li><a href="#org5ea13c1">Exports</a>
<ul>
2020-05-26 08:40:15 +02:00
<li><a href="#org58a49d1">Term</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#org1a74001">XDG Default</a></li>
<li><a href="#org117a776">Better yaourt colors</a></li>
<li><a href="#org684e85f">Use Ripgrep for FZF</a></li>
<li><a href="#org545dc00">Goland</a></li>
2020-05-26 08:40:15 +02:00
<li><a href="#org20b9dbe">Latex Path</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
<li><a href="#org3b15f2e">Path</a></li>
</ul>
</li>
2020-05-26 08:40:15 +02:00
<li><a href="#org966baa0">Input</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</div>
</div>
<div id="outline-container-orge676bb2" class="outline-2">
<h2 id="orge676bb2">Bashrc</h2>
<div class="outline-text-2" id="text-orge676bb2">
</div>
<div id="outline-container-org6524e6a" class="outline-3">
2020-03-01 22:51:16 +01:00
<h3 id="org6524e6a">What does that do?</h3>
2020-01-11 22:04:45 +01:00
<div class="outline-text-3" id="text-org6524e6a">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">[[ $- != *i* ]] &amp;&amp; return
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgade44ee" class="outline-3">
<h3 id="orgade44ee">Bash Completion</h3>
<div class="outline-text-3" id="text-orgade44ee">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">[ -r /usr/share/bash-completion/bash_completion ] &amp;&amp; . /usr/share/bash-completion/bash_completion
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd9f988d" class="outline-3">
<h3 id="orgd9f988d">Ignore case for autocompletion</h3>
<div class="outline-text-3" id="text-orgd9f988d">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">bind "set completion-ignore-case on"
bind "set show-all-if-ambiguous on"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org41663f0" class="outline-3">
<h3 id="org41663f0">Use Color</h3>
<div class="outline-text-3" id="text-org41663f0">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">use_color=true
alias ls='ls -hN --color=auto --group-directories-first'
alias grep='grep --colour=auto'
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org72d992f" class="outline-3">
2020-03-01 22:51:16 +01:00
<h3 id="org72d992f">Set colorful PS1 only on colorful terminals.</h3>
2020-01-11 22:04:45 +01:00
<div class="outline-text-3" id="text-org72d992f">
<p>
2020-05-26 08:40:15 +02:00
dircolors &#x2013;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.
2020-01-11 22:04:45 +01:00
</p>
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] &amp;&amp; match_lhs="${match_lhs}$(&lt;~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] &amp;&amp; match_lhs="${match_lhs}$(&lt;/etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&amp;&amp; type -P dircolors &gt;/dev/null \
&amp;&amp; match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] &amp;&amp; use_color=true
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors &gt;/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
else
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '
fi
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-01 22:51:16 +01:00
</div>
</div>
2020-01-11 22:04:45 +01:00
2020-03-01 22:51:16 +01:00
<div id="outline-container-orgd137e06" class="outline-3">
<h3 id="orgd137e06">Some config</h3>
<div class="outline-text-3" id="text-orgd137e06">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">unset use_color safe_term match_lhs sh
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
xhost +local:root &gt; /dev/null 2&gt;&amp;1
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
complete -cf sudo
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Line wrap on window resize
shopt -s checkwinsize
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
shopt -s expand_aliases
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Auto "cd" when entering just a path
shopt -s autocd
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Enable history appending instead of overwriting
shopt -s histappend
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org6e324a6" class="outline-3">
<h3 id="org6e324a6">Prompt</h3>
<div class="outline-text-3" id="text-org6e324a6">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-03-01 22:51:16 +01:00
<div id="outline-container-orgaf06a47" class="outline-3">
<h3 id="orgaf06a47">SSH Agent</h3>
<div class="outline-text-3" id="text-orgaf06a47">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash"># if ! pgrep -u "$USER" ssh-agent &gt; /dev/null; then
# ssh-agent &gt; "$XDG_RUNTIME_DIR/ssh-agent.env"
# fi
# if [[ ! "$SSH_AUTH_SOCK" ]]; then
# eval "$(&lt;"$XDG_RUNTIME_DIR/ssh-agent.env")"
# fi
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org586ae40" class="outline-3">
<h3 id="org586ae40">Rebind up and down arrow keys to search through bash history</h3>
<div class="outline-text-3" id="text-org586ae40">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org928d454" class="outline-3">
2020-03-01 22:51:16 +01:00
<h3 id="org928d454">Aliases</h3>
2020-01-11 22:04:45 +01:00
<div class="outline-text-3" id="text-org928d454">
</div>
<div id="outline-container-orgfc778e8" class="outline-4">
<h4 id="orgfc778e8">Better defaults for some commands</h4>
<div class="outline-text-4" id="text-orgfc778e8">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias mutt="neomutt"
alias tmux='tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf'
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd519f4b" class="outline-4">
<h4 id="orgd519f4b">One letter aliases</h4>
<div class="outline-text-4" id="text-orgd519f4b">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">alias r="ranger"
alias t="tmux"
alias v="nvim"
alias sv='sudo -E nvim'
alias g="git"
alias m="neomutt"
alias y="yadm"
alias o="xdg-open"
alias x="sxiv -ft *"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org564af34" class="outline-4">
<h4 id="org564af34">Neovim</h4>
<div class="outline-text-4" id="text-org564af34">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">command -v nvim &gt;/dev/null &amp;&amp; alias vim="nvim" vimdiff="nvim -d" # Use neovim for vim if present.
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org258d499" class="outline-4">
<h4 id="org258d499">Magit</h4>
<div class="outline-text-4" id="text-org258d499">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash"># alias magit="emacsclient -create-frame --alternate-editor=\"\" --eval '(magit-status)'"
alias magit="nvim -c MagitOnly"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org9b3882d" class="outline-4">
<h4 id="org9b3882d">Vim-like</h4>
<div class="outline-text-4" id="text-org9b3882d">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">alias :q=exit
alias :e=nvim
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org62f7fe5" class="outline-4">
<h4 id="org62f7fe5">Print each PATH entry on a separate line</h4>
<div class="outline-text-4" id="text-org62f7fe5">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">alias path='echo -e ${PATH//:/\\n}'
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org25e4d93" class="outline-3">
2020-03-01 22:51:16 +01:00
<h3 id="org25e4d93">Functions</h3>
2020-01-11 22:04:45 +01:00
<div class="outline-text-3" id="text-org25e4d93">
</div>
<div id="outline-container-orgfc4520c" class="outline-4">
<h4 id="orgfc4520c">Display colors</h4>
<div class="outline-text-4" id="text-orgfc4520c">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">colors() {
local fgc bgc vals seq0
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org1522290" class="outline-4">
<h4 id="org1522290">Tree display</h4>
<div class="outline-text-4" id="text-org1522290">
<p>
<code>tre</code> is a shorthand for <code>tree</code> with hidden files and color enabled, ignoring
the <code>.git</code> directory, listing directories first. The output gets piped into
<code>less</code> with options to preserve color and line numbers, unless the output is
small enough for one screen.
</p>
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">function tre() {
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX;
}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfe71409" class="outline-4">
<h4 id="orgfe71409">Create a new directory and enter it</h4>
<div class="outline-text-4" id="text-orgfe71409">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">function mkd() {
mkdir -p "$@" &amp;&amp; cd "$_";
}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org4395b78" class="outline-4">
<h4 id="org4395b78">Filesize of directory</h4>
<div class="outline-text-4" id="text-org4395b78">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">function fs() {
if du -b /dev/null &gt; /dev/null 2&gt;&amp;1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
du $arg -- "$@";
else
du $arg .[^.]* ./*;
fi;
}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf1e7ce2" class="outline-4">
<h4 id="orgf1e7ce2">Redirect both standard output and standard error, as well as sending to background</h4>
<div class="outline-text-4" id="text-orgf1e7ce2">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">function nullify() {
"$@" &gt;/dev/null 2&gt;&amp;1
}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org2896f4a" class="outline-4">
<h4 id="org2896f4a">Send SMS</h4>
<div class="outline-text-4" id="text-org2896f4a">
<p>
<a href="https://doronbehar.com/articles/using-kdeconnect-to-comfortably-send-sms-messages-from-the-shell/#kdeconnects-builtin-sms-interface">https://doronbehar.com/articles/using-kdeconnect-to-comfortably-send-sms-messages-from-the-shell/#kdeconnects-builtin-sms-interface</a>
</p>
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">sms(){
local args="$@"
# local phone_number name phone_type
# khard phone --parsable | sort -u | fzf | IFS=$'\t' read -r phone_number name phone_type
local phone_number=$(khard phone --parsable | sort -u | fzf | cut -f1 -d$'\t')
if [[ -z "${phone_number}" ]]; then
echo No recipient was chosen &gt;&amp;2
return
else
# echo "${name}"$'\t'"${phone_number}"$'\t'"${phone_type}" &gt; ${_KDECONNECT_SMS_LAST_RECIPIENT}
kdeconnect-cli --send-sms "${args}" --destination "${phone_number}" --device 4de3b5de2264a17c
# kdeconnect-cli --device ${_KDECONNECT_DEFAULT_DEVICE} --send-sms "${args}" --destination "${phone_number}" &amp;&amp; \
# echo sent sms message to ${name} | fribidi
fi
}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org9d14b86" class="outline-3">
<h3 id="org9d14b86">Bash History</h3>
<div class="outline-text-3" id="text-org9d14b86">
<p>
Undocumented feature which sets the size to &ldquo;unlimited&rdquo;. <a href="http://stackoverflow.com/questions/9457233/unlimited-bash-history">http://stackoverflow.com/questions/9457233/unlimited-bash-history</a>
</p>
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
2020-01-11 22:04:45 +01:00
</pre>
</div>
<p>
Change the file location because certain bash sessions truncate <code>.bash_history</code> file upon close. <a href="http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login">http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login</a>
</p>
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export HISTFILE=~/.bash_eternal_history
2020-01-11 22:04:45 +01:00
</pre>
</div>
<p>
Force prompt to write history after every command. <a href="http://superuser.com/questions/20900/bash-history-loss">http://superuser.com/questions/20900/bash-history-loss</a>
</p>
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
2020-03-01 22:51:16 +01:00
</pre>
</div>
</div>
</div>
2020-01-11 22:04:45 +01:00
</div>
<div id="outline-container-org6a5ac47" class="outline-2">
<h2 id="org6a5ac47">Bash Profile</h2>
<div class="outline-text-2" id="text-org6a5ac47">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">[[ -f ~/.profile ]] &amp;&amp; . ~/.profile
[[ -f ~/.bashrc ]] &amp;&amp; . ~/.bashrc
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org99b9ec7" class="outline-2">
<h2 id="org99b9ec7">Profile</h2>
<div class="outline-text-2" id="text-org99b9ec7">
</div>
<div id="outline-container-orgfbbfbf9" class="outline-3">
<h3 id="orgfbbfbf9">QT And GTK Themes</h3>
<div class="outline-text-3" id="text-orgfbbfbf9">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export QT_QPA_PLATFORMTHEME="qt5ct"
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgbe2ffab" class="outline-3">
<h3 id="orgbe2ffab">Gui program to ask for sudo password</h3>
<div class="outline-text-3" id="text-orgbe2ffab">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export SUDO_ASKPASS=~/.local/bin/askpass-rofi
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-03-01 22:51:16 +01:00
<div id="outline-container-orga5ea80f" class="outline-3">
<h3 id="orga5ea80f">Gnome Keyring Daemon</h3>
<div class="outline-text-3" id="text-orga5ea80f">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">if [ -n "$DESKTOP_SESSION" ];then
eval $(gnome-keyring-daemon --start)
export SSH_AUTH_SOCK
fi
2020-03-01 22:51:16 +01:00
</pre>
</div>
</div>
</div>
2020-01-11 22:04:45 +01:00
<div id="outline-container-org3e2966e" class="outline-3">
<h3 id="org3e2966e">Default</h3>
<div class="outline-text-3" id="text-org3e2966e">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export EDITOR="nvim"
export TERMINAL="termite"
export BROWSER="qutebrowser"
export READER="zathura"
export FILE="ranger"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org5ea13c1" class="outline-3">
<h3 id="org5ea13c1">Exports</h3>
<div class="outline-text-3" id="text-org5ea13c1">
2020-05-26 08:40:15 +02:00
</div>
<div id="outline-container-org58a49d1" class="outline-4">
<h4 id="org58a49d1">Term</h4>
<div class="outline-text-4" id="text-org58a49d1">
<p>
This is important for termite to work when sshing in remote machines.
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export TERM=xterm-color
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
2020-05-26 08:40:15 +02:00
</div>
2020-01-11 22:04:45 +01:00
<div id="outline-container-org1a74001" class="outline-4">
<h4 id="org1a74001">XDG Default</h4>
<div class="outline-text-4" id="text-org1a74001">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export XDG_CONFIG_HOME="$HOME/.config"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org117a776" class="outline-4">
<h4 id="org117a776">Better yaourt colors</h4>
<div class="outline-text-4" id="text-org117a776">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org684e85f" class="outline-4">
<h4 id="org684e85f">Use Ripgrep for FZF</h4>
<div class="outline-text-4" id="text-org684e85f">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'
export FZF_DEFAULT_OPTS='--layout=reverse --height=20'
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org545dc00" class="outline-4">
<h4 id="org545dc00">Goland</h4>
<div class="outline-text-4" id="text-org545dc00">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">export GOPATH=$HOME/go
</pre>
</div>
</div>
</div>
<div id="outline-container-org20b9dbe" class="outline-4">
<h4 id="org20b9dbe">Latex Path</h4>
<div class="outline-text-4" id="text-org20b9dbe">
<div class="org-src-container">
<pre class="src src-bash">export TEXMFHOME=$HOME/.local/share/texmf
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org3b15f2e" class="outline-3">
<h3 id="org3b15f2e">Path</h3>
<div class="outline-text-3" id="text-org3b15f2e">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">PATH=$HOME/appimages:$PATH
PATH=$HOME/.gem/ruby/2.5.0/bin:$PATH
PATH=$GOPATH:$GOPATH/bin:$PATH
PATH=~/.local/bin:$PATH
PATH=~/.emacs.d/bin:$PATH
export PATH
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org966baa0" class="outline-2">
<h2 id="org966baa0">Input</h2>
<div class="outline-text-2" id="text-org966baa0">
<p>
Completion:
</p>
<div class="org-src-container">
<pre class="src src-conf"># Single tab for autocompletion
set show-all-if-ambiguous on
# Ignore case for completion
set completion-ignore-case on
</pre>
</div>
<p>
vi mode:
</p>
<div class="org-src-container">
<pre class="src 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
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-05-26 08:40:15 +02:00
<p>
Key-bindings for vi-mode:
</p>
<div class="org-src-container">
<pre class="src 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"
</pre>
</div>
<p>
Colorized completion
</p>
<div class="org-src-container">
<pre class="src 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
</pre>
</div>
<p>
Don&rsquo;t echo <code>^C</code> after <code>Ctrl+C</code> is pressed.
</p>
<div class="org-src-container">
<pre class="src src-conf">set echo-control-characters off
</pre>
2020-01-11 22:04:45 +01:00
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2020-05-26 08:40:15 +02:00
<p class="date">Created: 2020-05-26 mar. 08:39</p>
2020-01-11 22:04:45 +01:00
</div>
</body>
</html>