literate-dotfiles/docs/bash.html
2021-11-03 11:39:08 +01:00

685 lines
42 KiB
HTML

<?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>
<!-- 2021-11-03 mer. 10:59 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Bash Configuration</title>
<meta name="author" content="Dehaeze Thomas" />
<meta name="generator" content="Org Mode" />
<link rel="stylesheet" type="text/css" href="./dist/style.css"/>
<script type="text/javascript" src="./dist/script.js"></script>
</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" class="content">
<h1 class="title">Bash Configuration</h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#bashrc"><code>~/.bashrc</code></a>
<ul>
<li><a href="#orgb8018f7">If not running interactively, don&rsquo;t do anything</a></li>
<li><a href="#org16d9917">Bash Completion</a></li>
<li><a href="#org17408fe">FZF</a></li>
<li><a href="#org46238bc">Ignore case for auto-completion</a></li>
<li><a href="#org53c6a26">Use Color</a></li>
<li><a href="#org5664e96">Some config</a></li>
<li><a href="#org26dcd39">Prompt - <code>PS1</code></a></li>
<li><a href="#org7dc0b98">Rebind up and down arrow keys to search through bash history</a></li>
<li><a href="#org5d3b91c">Aliases</a>
<ul>
<li><a href="#orgad8f6ac">Better defaults for some commands</a></li>
<li><a href="#orgd2723b6">One letter aliases</a></li>
<li><a href="#org785c2af">Neovim</a></li>
<li><a href="#org61be992">Vim-like</a></li>
<li><a href="#org6f5c44a">Print each PATH entry on a separate line</a></li>
</ul>
</li>
<li><a href="#orgdd41cc3">Functions</a>
<ul>
<li><a href="#org716962c"><code>colors</code> - Display colors</a></li>
<li><a href="#orgb6faa84"><code>tre</code> - Tree display</a></li>
<li><a href="#org7b0ff56"><code>mkd</code> - Create a new directory and enter it</a></li>
<li><a href="#org78520b0"><code>fs</code> - Filesize of directory</a></li>
<li><a href="#orgfc72283"><code>nullify</code> - Redirect both standard output and standard error, as well as sending to background</a></li>
<li><a href="#orge1cc477"><code>sms</code> - Send SMS</a></li>
</ul>
</li>
<li><a href="#orgfa27a35">Bash History</a></li>
</ul>
</li>
<li><a href="#bash_profile"><code>~/.bash_profile</code></a></li>
<li><a href="#profile"><code>~/.profile</code></a>
<ul>
<li><a href="#org15952b2">QT And GTK Themes</a></li>
<li><a href="#org6c38c79">Gui program to ask for sudo password</a></li>
<li><a href="#org5d2ff76">Gnome Keyring Daemon</a></li>
<li><a href="#org10b40b3">Export some default applications</a></li>
<li><a href="#orgf65a830">Exports</a>
<ul>
<li><a href="#org0fa2d26">XDG Default</a></li>
<li><a href="#org51055fb">Use Ripgrep for FZF</a></li>
<li><a href="#org08d14fc">Goland</a></li>
<li><a href="#org18f49cf">Latex Path</a></li>
<li><a href="#org6bdbd18">Python Path</a></li>
<li><a href="#org2895615">Linkding</a></li>
</ul>
</li>
<li><a href="#org8a10d32">Path</a></li>
<li><a href="#orgda5e48a">Automatically run <code>startx</code></a></li>
</ul>
</li>
<li><a href="#inputrc"><code>~/.inputrc</code></a></li>
</ul>
</div>
</div>
<div id="outline-container-bashrc" class="outline-2">
<h2 id="bashrc"><code>~/.bashrc</code></h2>
<div class="outline-text-2" id="text-bashrc">
</div>
<div id="outline-container-orgb8018f7" class="outline-3">
<h3 id="orgb8018f7">If not running interactively, don&rsquo;t do anything</h3>
<div class="outline-text-3" id="text-orgb8018f7">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> $<span class="org-variable-name">-</span> != *i* <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-keyword">return</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org16d9917" class="outline-3">
<h3 id="org16d9917">Bash Completion</h3>
<div class="outline-text-3" id="text-org16d9917">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-rainbow-delimiters-depth-1">[</span> -r /usr/share/bash-completion/bash_completion <span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-builtin">.</span> /usr/share/bash-completion/bash_completion
</pre>
</div>
</div>
</div>
<div id="outline-container-org17408fe" class="outline-3">
<h3 id="org17408fe">FZF</h3>
<div class="outline-text-3" id="text-org17408fe">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">source</span> /usr/share/fzf/key-bindings.bash
</pre>
</div>
</div>
</div>
<div id="outline-container-org46238bc" class="outline-3">
<h3 id="org46238bc">Ignore case for auto-completion</h3>
<div class="outline-text-3" id="text-org46238bc">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">bind</span> <span class="org-string">"set completion-ignore-case on"</span>
<span class="org-builtin">bind</span> <span class="org-string">"set show-all-if-ambiguous on"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org53c6a26" class="outline-3">
<h3 id="org53c6a26">Use Color</h3>
<div class="outline-text-3" id="text-org53c6a26">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">use_color</span>=true
</pre>
</div>
</div>
</div>
<div id="outline-container-org5664e96" class="outline-3">
<h3 id="org5664e96">Some config</h3>
<div class="outline-text-3" id="text-org5664e96">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-comment-delimiter"># </span><span class="org-comment">Unset some variables</span>
<span class="org-builtin">unset</span> use_color safe_term match_lhs sh
<span class="org-comment-delimiter"># </span><span class="org-comment">Allow local processes with root privileges to connect to the locally running X server</span>
xhost +local:root &gt; /dev/null <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Autocomplete </span><span class="org-type"><span class="org-comment">sudo</span></span><span class="org-comment"> commands</span>
<span class="org-builtin">complete</span> -cf <span class="org-type">sudo</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Line wrap on window resize</span>
<span class="org-builtin">shopt</span> -s checkwinsize
<span class="org-comment-delimiter"># </span><span class="org-comment">Enable history expansion with space</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">E.g. typing !!&lt;space&gt; will replace the !! with your last command</span>
<span class="org-builtin">bind</span> Space:magic-space
<span class="org-comment-delimiter"># </span><span class="org-comment">Expand Aliases</span>
<span class="org-builtin">shopt</span> -s expand_aliases
<span class="org-comment-delimiter"># </span><span class="org-comment">Auto "</span><span class="org-type"><span class="org-comment">cd</span></span><span class="org-comment">" when entering just a path</span>
<span class="org-builtin">shopt</span> -s autocd
<span class="org-comment-delimiter"># </span><span class="org-comment">Enable history appending instead of overwriting</span>
<span class="org-builtin">shopt</span> -s histappend
<span class="org-comment-delimiter"># </span><span class="org-comment">Save multi-line commands as one command</span>
<span class="org-builtin">shopt</span> -s cmdhist
</pre>
</div>
</div>
</div>
<div id="outline-container-org26dcd39" class="outline-3">
<h3 id="org26dcd39">Prompt - <code>PS1</code></h3>
<div class="outline-text-3" id="text-org26dcd39">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">PS1</span>=<span class="org-string">"\[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> bold)</span></span><span class="org-string">\]\[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> setaf 1)</span></span><span class="org-string">\][\[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> setaf 3)</span></span><span class="org-string">\]\u\[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> setaf 2)</span></span><span class="org-string">\]@\[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> setaf 4)</span></span><span class="org-string">\]\h \[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> setaf 5)</span></span><span class="org-string">\]\W\[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> setaf 1)</span></span><span class="org-string">\]]\[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> setaf 7)</span></span><span class="org-string">\]\\$ \[</span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">tput</span><span class="org-string"><span class="org-sh-quoted-exec"> sgr0)</span></span><span class="org-string">\]"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org7dc0b98" class="outline-3">
<h3 id="org7dc0b98">Rebind up and down arrow keys to search through bash history</h3>
<div class="outline-text-3" id="text-org7dc0b98">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">bind</span> <span class="org-string">'"\e[A": history-search-backward'</span>
<span class="org-builtin">bind</span> <span class="org-string">'"\e[B": history-search-forward'</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org5d3b91c" class="outline-3">
<h3 id="org5d3b91c">Aliases</h3>
<div class="outline-text-3" id="text-org5d3b91c">
</div>
<div id="outline-container-orgad8f6ac" class="outline-4">
<h4 id="orgad8f6ac">Better defaults for some commands</h4>
<div class="outline-text-4" id="text-orgad8f6ac">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">alias</span> <span class="org-type">ls</span>=<span class="org-string">'</span><span class="org-type"><span class="org-string">ls</span></span><span class="org-string"> -hN --color=auto --group-directories-first'</span>
<span class="org-builtin">alias</span> <span class="org-type">grep</span>=<span class="org-string">'</span><span class="org-type"><span class="org-string">grep</span></span><span class="org-string"> --colour=auto'</span>
<span class="org-builtin">alias</span> <span class="org-type">cp</span>=<span class="org-string">"</span><span class="org-type"><span class="org-string">cp</span></span><span class="org-string"> -i"</span> <span class="org-comment-delimiter"># </span><span class="org-comment">confirm before overwriting something</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">df</span>=<span class="org-string">'df -h'</span> <span class="org-comment-delimiter"># </span><span class="org-comment">human-readable sizes</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">free</span>=<span class="org-string">'free -m'</span> <span class="org-comment-delimiter"># </span><span class="org-comment">show sizes in MB</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">mutt</span>=<span class="org-string">"neomutt"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">tmux</span>=<span class="org-string">'tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf'</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd2723b6" class="outline-4">
<h4 id="orgd2723b6">One letter aliases</h4>
<div class="outline-text-4" id="text-orgd2723b6">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">alias</span> <span class="org-variable-name">r</span>=<span class="org-string">"ranger"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">t</span>=<span class="org-string">"tmux"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">v</span>=<span class="org-string">"nvim"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">sv</span>=<span class="org-string">'</span><span class="org-type"><span class="org-string">sudo</span></span><span class="org-string"> -E nvim'</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">g</span>=<span class="org-string">"</span><span class="org-type"><span class="org-string">git</span></span><span class="org-string">"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">m</span>=<span class="org-string">"neomutt"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">o</span>=<span class="org-string">"xdg-open"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org785c2af" class="outline-4">
<h4 id="org785c2af">Neovim</h4>
<div class="outline-text-4" id="text-org785c2af">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">command</span> -v nvim &gt;/dev/null &amp;&amp; <span class="org-builtin">alias</span> <span class="org-variable-name">vim</span>=<span class="org-string">"nvim"</span> <span class="org-variable-name">vimdiff</span>=<span class="org-string">"nvim -d"</span> <span class="org-comment-delimiter"># </span><span class="org-comment">Use neovim for vim if present.</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org61be992" class="outline-4">
<h4 id="org61be992">Vim-like</h4>
<div class="outline-text-4" id="text-org61be992">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">alias</span> :<span class="org-variable-name">q</span>=exit
<span class="org-builtin">alias</span> :<span class="org-variable-name">e</span>=nvim
</pre>
</div>
</div>
</div>
<div id="outline-container-org6f5c44a" class="outline-4">
<h4 id="org6f5c44a">Print each PATH entry on a separate line</h4>
<div class="outline-text-4" id="text-org6f5c44a">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">alias</span> <span class="org-variable-name">path</span>=<span class="org-string">'</span><span class="org-type"><span class="org-string">echo</span></span><span class="org-string"> -e ${PATH//:/\\n}'</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgdd41cc3" class="outline-3">
<h3 id="orgdd41cc3">Functions</h3>
<div class="outline-text-3" id="text-orgdd41cc3">
</div>
<div id="outline-container-org716962c" class="outline-4">
<h4 id="org716962c"><code>colors</code> - Display colors</h4>
<div class="outline-text-4" id="text-org716962c">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-function-name">colors</span><span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-builtin">local</span> fgc bgc vals seq0
<span class="org-builtin">printf</span> <span class="org-string">"Color escapes are %s\n"</span> <span class="org-string">'\e[${value};...;${value}m'</span>
<span class="org-builtin">printf</span> <span class="org-string">"Values 30..37 are \e[33mforeground colors\e[m\n"</span>
<span class="org-builtin">printf</span> <span class="org-string">"Values 40..47 are \e[43mbackground colors\e[m\n"</span>
<span class="org-builtin">printf</span> <span class="org-string">"Value 1 gives a \e[1mbold-faced look\e[m\n\n"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">foreground colors</span>
<span class="org-keyword">for</span> fgc<span class="org-keyword"> in</span> <span class="org-rainbow-delimiters-depth-2">{</span>30..37<span class="org-rainbow-delimiters-depth-2">}</span>; <span class="org-keyword">do</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">background colors</span>
<span class="org-keyword">for</span> bgc<span class="org-keyword"> in</span> <span class="org-rainbow-delimiters-depth-2">{</span>40..47<span class="org-rainbow-delimiters-depth-2">}</span>; <span class="org-keyword">do</span>
<span class="org-variable-name">fgc</span>=$<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">fgc</span>#37<span class="org-rainbow-delimiters-depth-2">}</span> <span class="org-comment-delimiter"># </span><span class="org-comment">white</span>
<span class="org-variable-name">bgc</span>=$<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">bgc</span>#40<span class="org-rainbow-delimiters-depth-2">}</span> <span class="org-comment-delimiter"># </span><span class="org-comment">black</span>
<span class="org-variable-name">vals</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{fgc:+$fgc;}</span></span><span class="org-string">${bgc}"</span>
<span class="org-variable-name">vals</span>=$<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-variable-name">vals</span>%%;<span class="org-rainbow-delimiters-depth-2">}</span>
<span class="org-variable-name">seq0</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{vals:+\e[${vals}</span></span><span class="org-string">m}"</span>
<span class="org-builtin">printf</span> <span class="org-string">" %-9s"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{seq0:-(default)}</span></span><span class="org-string">"</span>
<span class="org-builtin">printf</span> <span class="org-string">" </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{seq0}</span></span><span class="org-string">TEXT\e[m"</span>
<span class="org-builtin">printf</span> <span class="org-string">" \e[</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{vals:+${vals+$vals;}</span></span><span class="org-string">}1mBOLD\e[m"</span>
<span class="org-keyword">done</span>
<span class="org-type">echo</span>; <span class="org-type">echo</span>
<span class="org-keyword">done</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb6faa84" class="outline-4">
<h4 id="orgb6faa84"><code>tre</code> - Tree display</h4>
<div class="outline-text-4" id="text-orgb6faa84">
<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">
<pre class="src src-bash"><span class="org-keyword">function</span> <span class="org-function-name">tre</span><span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
tree -aC -I <span class="org-string">'.git|node_modules|bower_components'</span> --dirsfirst <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span> | <span class="org-type">less</span> -FRNX;
<span class="org-rainbow-delimiters-depth-1">}</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org7b0ff56" class="outline-4">
<h4 id="org7b0ff56"><code>mkd</code> - Create a new directory and enter it</h4>
<div class="outline-text-4" id="text-org7b0ff56">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-keyword">function</span> <span class="org-function-name">mkd</span><span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-type">mkdir</span> -p <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span> &amp;&amp; <span class="org-type">cd</span> <span class="org-string">"$_"</span>;
<span class="org-rainbow-delimiters-depth-1">}</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org78520b0" class="outline-4">
<h4 id="org78520b0"><code>fs</code> - Filesize of directory</h4>
<div class="outline-text-4" id="text-org78520b0">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-keyword">function</span> <span class="org-function-name">fs</span><span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-keyword">if</span> du -b /dev/null &gt; /dev/null <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span>; <span class="org-keyword">then</span>
<span class="org-builtin">local</span> <span class="org-variable-name">arg</span>=-sbh;
<span class="org-keyword">else</span>
<span class="org-builtin">local</span> <span class="org-variable-name">arg</span>=-sh;
<span class="org-keyword">fi</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> -n <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
du $<span class="org-variable-name">arg</span> -- <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span>;
<span class="org-keyword">else</span>
du $<span class="org-variable-name">arg</span> .<span class="org-rainbow-delimiters-depth-2">[</span>^.<span class="org-rainbow-delimiters-depth-2">]</span>* ./*;
<span class="org-keyword">fi</span>;
<span class="org-rainbow-delimiters-depth-1">}</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfc72283" class="outline-4">
<h4 id="orgfc72283"><code>nullify</code> - Redirect both standard output and standard error, as well as sending to background</h4>
<div class="outline-text-4" id="text-orgfc72283">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-keyword">function</span> <span class="org-function-name">nullify</span><span class="org-rainbow-delimiters-depth-1">()</span> <span class="org-rainbow-delimiters-depth-1">{</span>
<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span> &gt;/dev/null <span class="org-highlight-numbers-number">2</span>&gt;&amp;<span class="org-highlight-numbers-number">1</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orge1cc477" class="outline-4">
<h4 id="orge1cc477"><code>sms</code> - Send SMS</h4>
<div class="outline-text-4" id="text-orge1cc477">
<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">
<pre class="src src-bash"><span class="org-function-name">sms</span><span class="org-rainbow-delimiters-depth-1">(){</span>
<span class="org-builtin">local</span> <span class="org-variable-name">args</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">local phone_number name phone_type</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">khard phone --parsable | sort -u | fzf | IFS=$'\t' read -r phone_number name phone_type</span>
<span class="org-builtin">local</span> <span class="org-variable-name">phone_number</span>=$<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-sh-quoted-exec">khard</span> phone --parsable | sort -u | fzf | cut -f1 -d$<span class="org-string">'\t'</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-2">[</span><span class="org-rainbow-delimiters-depth-3">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{phone_number}</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>; <span class="org-keyword">then</span>
<span class="org-type">echo</span> No recipient was chosen &gt;&amp;<span class="org-highlight-numbers-number">2</span>
<span class="org-keyword">return</span>
<span class="org-keyword">else</span>
kdeconnect-cli --send-sms <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{args}</span></span><span class="org-string">"</span> --destination <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{phone_number}</span></span><span class="org-string">"</span> --device 4de3b5de2264a17c
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgfa27a35" class="outline-3">
<h3 id="orgfa27a35">Bash History</h3>
<div class="outline-text-3" id="text-orgfa27a35">
<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">
<pre class="src src-bash"><span class="org-comment-delimiter"># </span><span class="org-comment">Huge history. Doesn't appear to slow things down, so why not?</span>
<span class="org-variable-name">HISTSIZE</span>=<span class="org-highlight-numbers-number">500000</span>
<span class="org-variable-name">HISTFILESIZE</span>=<span class="org-highlight-numbers-number">100000</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Avoid duplicate entries</span>
<span class="org-variable-name">HISTCONTROL</span>=<span class="org-string">"erasedups:ignoreboth"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Don't record some commands</span>
<span class="org-builtin">export</span> <span class="org-variable-name">HISTIGNORE</span>=<span class="org-string">"&amp;:[ ]*:exit:ls:bg:fg:history:clear"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Use standard ISO 8601 timestamp</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">%F equivalent to %Y-%m-%d</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">%T equivalent to %H:%M:%S (24-hours format)</span>
<span class="org-variable-name">HISTTIMEFORMAT</span>=<span class="org-string">'%F %T '</span>
</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">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">HISTFILE</span>=~/.bash_eternal_history
</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">
<pre class="src src-bash"><span class="org-variable-name">PROMPT_COMMAND</span>=<span class="org-string">"history -a; </span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">PROMPT_COMMAND</span></span><span class="org-string">"</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-bash_profile" class="outline-2">
<h2 id="bash_profile"><code>~/.bash_profile</code></h2>
<div class="outline-text-2" id="text-bash_profile">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f ~/.profile <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-builtin">.</span> ~/.profile
<span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f ~/.bashrc <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-builtin">.</span> ~/.bashrc
</pre>
</div>
</div>
</div>
<div id="outline-container-profile" class="outline-2">
<h2 id="profile"><code>~/.profile</code></h2>
<div class="outline-text-2" id="text-profile">
</div>
<div id="outline-container-org15952b2" class="outline-3">
<h3 id="org15952b2">QT And GTK Themes</h3>
<div class="outline-text-3" id="text-org15952b2">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">QT_QPA_PLATFORMTHEME</span>=<span class="org-string">"qt5ct"</span>
<span class="org-builtin">export</span> <span class="org-variable-name">GTK2_RC_FILES</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">HOME</span></span><span class="org-string">/.gtkrc-2.0"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org6c38c79" class="outline-3">
<h3 id="org6c38c79">Gui program to ask for sudo password</h3>
<div class="outline-text-3" id="text-org6c38c79">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">SUDO_ASKPASS</span>=~/.local/bin/askpass-rofi
</pre>
</div>
</div>
</div>
<div id="outline-container-org5d2ff76" class="outline-3">
<h3 id="org5d2ff76">Gnome Keyring Daemon</h3>
<div class="outline-text-3" id="text-org5d2ff76">
<p>
Enable the keyring for applications run through the terminal
</p>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -n <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">DESKTOP_SESSION</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span>;<span class="org-keyword">then</span>
<span class="org-builtin">eval</span> $<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">gnome-keyring-daemon</span> --start<span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-builtin">export</span> SSH_AUTH_SOCK
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org10b40b3" class="outline-3">
<h3 id="org10b40b3">Export some default applications</h3>
<div class="outline-text-3" id="text-org10b40b3">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">EDITOR</span>=<span class="org-string">"nvim"</span>
<span class="org-builtin">export</span> <span class="org-variable-name">TERMINAL</span>=<span class="org-string">"alacritty"</span>
<span class="org-builtin">export</span> <span class="org-variable-name">BROWSER</span>=<span class="org-string">"qutebrowser"</span>
<span class="org-builtin">export</span> <span class="org-variable-name">READER</span>=<span class="org-string">"zathura"</span>
<span class="org-builtin">export</span> <span class="org-variable-name">FILE</span>=<span class="org-string">"ranger"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf65a830" class="outline-3">
<h3 id="orgf65a830">Exports</h3>
<div class="outline-text-3" id="text-orgf65a830">
</div>
<div id="outline-container-org0fa2d26" class="outline-4">
<h4 id="org0fa2d26">XDG Default</h4>
<div class="outline-text-4" id="text-org0fa2d26">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">XDG_CONFIG_HOME</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">HOME</span></span><span class="org-string">/.config"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org51055fb" class="outline-4">
<h4 id="org51055fb">Use Ripgrep for FZF</h4>
<div class="outline-text-4" id="text-org51055fb">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">FZF_DEFAULT_COMMAND</span>=<span class="org-string">'rg --files --no-ignore --hidden --follow --glob "!.git/*"'</span>
<span class="org-builtin">export</span> <span class="org-variable-name">FZF_DEFAULT_OPTS</span>=<span class="org-string">'--layout=reverse --height=20'</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org08d14fc" class="outline-4">
<h4 id="org08d14fc">Goland</h4>
<div class="outline-text-4" id="text-org08d14fc">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">GOPATH</span>=$<span class="org-variable-name">HOME</span>/go
</pre>
</div>
</div>
</div>
<div id="outline-container-org18f49cf" class="outline-4">
<h4 id="org18f49cf">Latex Path</h4>
<div class="outline-text-4" id="text-org18f49cf">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">TEXMFHOME</span>=$<span class="org-variable-name">HOME</span>/.local/share/texmf
</pre>
</div>
</div>
</div>
<div id="outline-container-org6bdbd18" class="outline-4">
<h4 id="org6bdbd18">Python Path</h4>
<div class="outline-text-4" id="text-org6bdbd18">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">PYTHONPATH</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{PYTHONPATH}</span></span><span class="org-string">:/usr/lib/python3.9/site-packages/configobj"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org2895615" class="outline-4">
<h4 id="org2895615">Linkding</h4>
<div class="outline-text-4" id="text-org2895615">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">LINKDING_URL</span>=<span class="org-sh-quoted-exec">`pass nas/linkding_url`</span>
<span class="org-builtin">export</span> <span class="org-variable-name">LINKDING_TOKEN</span>=<span class="org-sh-quoted-exec">`pass nas/linkding_token`</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org8a10d32" class="outline-3">
<h3 id="org8a10d32">Path</h3>
<div class="outline-text-3" id="text-org8a10d32">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">PATH</span>=$<span class="org-variable-name">HOME</span>/appimages:$<span class="org-variable-name">PATH</span>
<span class="org-variable-name">PATH</span>=$<span class="org-variable-name">HOME</span>/.gem/ruby/2.5.0/bin:$<span class="org-variable-name">PATH</span>
<span class="org-variable-name">PATH</span>=$<span class="org-variable-name">GOPATH</span>:$<span class="org-variable-name">GOPATH</span>/bin:$<span class="org-variable-name">PATH</span>
<span class="org-variable-name">PATH</span>=~/.config/emacs/bin:$<span class="org-variable-name">PATH</span>
<span class="org-builtin">export</span> PATH
</pre>
</div>
</div>
</div>
<div id="outline-container-orgda5e48a" class="outline-3">
<h3 id="orgda5e48a">Automatically run <code>startx</code></h3>
<div class="outline-text-3" id="text-orgda5e48a">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> -z <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{DISPLAY}</span></span><span class="org-string">"</span> <span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-rainbow-delimiters-depth-1">[</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{XDG_VTNR}</span></span><span class="org-string">"</span> -eq <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
<span class="org-keyword">exec</span> startx
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-inputrc" class="outline-2">
<h2 id="inputrc"><code>~/.inputrc</code></h2>
<div class="outline-text-2" id="text-inputrc">
<p>
Completion:
</p>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Single tab for autocompletion</span>
set show-all-if-ambiguous on
<span class="org-comment-delimiter"># </span><span class="org-comment">Ignore case for completion</span>
set completion-ignore-case on
</pre>
</div>
<p>
vi mode:
</p>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">VI mode (works in bash and zsh)</span>
set editing-mode vi
<span class="org-comment-delimiter"># </span><span class="org-comment">Show which mode (normal or insert)</span>
set show-mode-in-prompt on
<span class="org-comment-delimiter"># </span><span class="org-comment">Show the mode by changing the cursor</span>
set vi-ins-mode-string \<span class="org-highlight-numbers-number">1</span>\e[<span class="org-highlight-numbers-number">6</span> q\<span class="org-highlight-numbers-number">2</span>
set vi-cmd-mode-string \<span class="org-highlight-numbers-number">1</span>\e[<span class="org-highlight-numbers-number">2</span> q\<span class="org-highlight-numbers-number">2</span>
</pre>
</div>
<p>
Key-bindings for vi-mode:
</p>
<div class="org-src-container">
<pre class="src src-conf">set keymap vi-command
<span class="org-comment-delimiter"># </span><span class="org-comment">these are for vi-command mode</span>
Control-l: clear-screen
Control-a: beginning-of-line
Control-e: end-of-line
Control-w: <span class="org-string">"\C-aisudo \C-e"</span>
set keymap vi-insert
<span class="org-comment-delimiter"># </span><span class="org-comment">these are for vi-insert mode</span>
Control-l: clear-screen
Control-a: beginning-of-line
Control-e: end-of-line
Control-w: <span class="org-string">"\C-asudo \C-e"</span>
</pre>
</div>
<p>
Colorized completion
</p>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Color files by types</span>
set colored-stats On
<span class="org-comment-delimiter"># </span><span class="org-comment">Append char to indicate type</span>
set visible-stats On
<span class="org-comment-delimiter"># </span><span class="org-comment">Mark symlinked directories</span>
set mark-symlinked-directories On
<span class="org-comment-delimiter"># </span><span class="org-comment">Color the common prefix</span>
set colored-completion-prefix On
<span class="org-comment-delimiter"># </span><span class="org-comment">Color the common prefix in menu-complete</span>
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>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2021-11-03 mer. 10:59</p>
</div>
</body>
</html>