literate-dotfiles/docs/bash.html
2020-11-03 16:27:09 +01:00

742 lines
49 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>
<!-- 2020-11-03 mar. 16:26 -->
<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" />
<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>
</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>
<li><a href="#org6524e6a">What does that do?</a></li>
<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>
<li><a href="#org72d992f">Set colorful PS1 only on colorful terminals.</a></li>
<li><a href="#orgd137e06">Some config</a></li>
<li><a href="#org6e324a6">Prompt</a></li>
<li><a href="#orgaf06a47">SSH Agent</a></li>
<li><a href="#org586ae40">Rebind up and down arrow keys to search through bash history</a></li>
<li><a href="#org928d454">Aliases</a>
<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="#org88d74a4">Homelab Relative</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>
<li><a href="#org25e4d93">Functions</a>
<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>
<li><a href="#orga5ea80f">Gnome Keyring Daemon</a></li>
<li><a href="#org3e2966e">Default</a></li>
<li><a href="#org5ea13c1">Exports</a>
<ul>
<li><a href="#org58a49d1">Term</a></li>
<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>
<li><a href="#org20b9dbe">Latex Path</a></li>
<li><a href="#org8965bcd">Bitwarden Session</a></li>
</ul>
</li>
<li><a href="#org3b15f2e">Path</a></li>
</ul>
</li>
<li><a href="#org966baa0">Input</a></li>
</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">
<h3 id="org6524e6a">What does that do?</h3>
<div class="outline-text-3" id="text-org6524e6a">
<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-orgade44ee" class="outline-3">
<h3 id="orgade44ee">Bash Completion</h3>
<div class="outline-text-3" id="text-orgade44ee">
<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-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">
<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-org41663f0" class="outline-3">
<h3 id="org41663f0">Use Color</h3>
<div class="outline-text-3" id="text-org41663f0">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">use_color</span>=true
<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>
</pre>
</div>
</div>
</div>
<div id="outline-container-org72d992f" class="outline-3">
<h3 id="org72d992f">Set colorful PS1 only on colorful terminals.</h3>
<div class="outline-text-3" id="text-org72d992f">
<p>
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.
</p>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">safe_term</span>=$<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">TERM</span>//<span class="org-rainbow-delimiters-depth-2">[</span>^<span class="org-rainbow-delimiters-depth-3">[</span>:alnum:<span class="org-rainbow-delimiters-depth-3">]</span><span class="org-rainbow-delimiters-depth-2">]</span>/?<span class="org-rainbow-delimiters-depth-1">}</span> <span class="org-comment-delimiter"># </span><span class="org-comment">sanitize TERM</span>
<span class="org-variable-name">match_lhs</span>=<span class="org-string">""</span>
<span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f ~/.dir_colors <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-variable-name">match_lhs</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">{match_lhs}</span></span><span class="org-string"><span class="org-sh-quoted-exec">$(&lt;~/.dir_colors)</span></span><span class="org-string">"</span>
<span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f /etc/DIR_COLORS <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-variable-name">match_lhs</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">{match_lhs}</span></span><span class="org-string"><span class="org-sh-quoted-exec">$(&lt;/etc/DIR_COLORS)</span></span><span class="org-string">"</span>
<span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -z $<span class="org-rainbow-delimiters-depth-3">{</span><span class="org-variable-name">match_lhs</span><span class="org-rainbow-delimiters-depth-3">}</span> <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> <span class="org-sh-escaped-newline">\</span>
&amp;&amp; <span class="org-builtin">type</span> -P dircolors &gt;/dev/null <span class="org-sh-escaped-newline">\</span>
&amp;&amp; <span class="org-variable-name">match_lhs</span>=$<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-sh-quoted-exec">dircolors</span> --print-database<span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> $<span class="org-string">'\n'</span>$<span class="org-rainbow-delimiters-depth-3">{</span><span class="org-variable-name">match_lhs</span><span class="org-rainbow-delimiters-depth-3">}</span> == *$<span class="org-string">'\n'"TERM "</span>$<span class="org-rainbow-delimiters-depth-3">{</span><span class="org-variable-name">safe_term</span><span class="org-rainbow-delimiters-depth-3">}</span>* <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> &amp;&amp; <span class="org-variable-name">use_color</span>=true
<span class="org-keyword">if</span> $<span class="org-rainbow-delimiters-depth-1">{</span><span class="org-variable-name">use_color</span><span class="org-rainbow-delimiters-depth-1">}</span> ; <span class="org-keyword">then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Enable colors for ls, etc. Prefer ~/.dir_colors #64489</span>
<span class="org-keyword">if </span><span class="org-builtin">type</span> -P dircolors &gt;/dev/null ; <span class="org-keyword">then</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f ~/.dir_colors <span class="org-rainbow-delimiters-depth-2">]</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">dircolors</span> -b ~/.dir_colors<span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-keyword">elif</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> -f /etc/DIR_COLORS <span class="org-rainbow-delimiters-depth-2">]</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">dircolors</span> -b /etc/DIR_COLORS<span class="org-rainbow-delimiters-depth-1">)</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> $<span class="org-rainbow-delimiters-depth-3">{</span><span class="org-variable-name">EUID</span><span class="org-rainbow-delimiters-depth-3">}</span> == <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> ; <span class="org-keyword">then</span>
<span class="org-variable-name">PS1</span>=<span class="org-string">'\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">PS1</span>=<span class="org-string">'\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">else</span>
<span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-rainbow-delimiters-depth-2">[</span> $<span class="org-rainbow-delimiters-depth-3">{</span><span class="org-variable-name">EUID</span><span class="org-rainbow-delimiters-depth-3">}</span> == <span class="org-highlight-numbers-number">0</span> <span class="org-rainbow-delimiters-depth-2">]</span><span class="org-rainbow-delimiters-depth-1">]</span> ; <span class="org-keyword">then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">show root@ when we don't have colors</span>
<span class="org-variable-name">PS1</span>=<span class="org-string">'\u@\h \W \$ '</span>
<span class="org-keyword">else</span>
<span class="org-variable-name">PS1</span>=<span class="org-string">'\u@\h \w \$ '</span>
<span class="org-keyword">fi</span>
<span class="org-keyword">fi</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd137e06" class="outline-3">
<h3 id="orgd137e06">Some config</h3>
<div class="outline-text-3" id="text-orgd137e06">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">unset</span> use_color safe_term match_lhs sh
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-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-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
</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">
<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-orgaf06a47" class="outline-3">
<h3 id="orgaf06a47">SSH Agent</h3>
<div class="outline-text-3" id="text-orgaf06a47">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-comment-delimiter"># </span><span class="org-comment">if ! </span><span class="org-type"><span class="org-comment">pgrep</span></span><span class="org-comment"> -u "$USER" ssh-agent &gt; /dev/null; then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">ssh-agent &gt; "$XDG_RUNTIME_DIR/ssh-agent.env"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">fi</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">if [[ ! "$SSH_AUTH_SOCK" ]]; then</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">eval "$(&lt;"$XDG_RUNTIME_DIR/ssh-agent.env")"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">fi</span>
</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">
<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-org928d454" class="outline-3">
<h3 id="org928d454">Aliases</h3>
<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">
<pre class="src src-bash"><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-orgd519f4b" class="outline-4">
<h4 id="orgd519f4b">One letter aliases</h4>
<div class="outline-text-4" id="text-orgd519f4b">
<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">y</span>=<span class="org-string">"yadm"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">o</span>=<span class="org-string">"xdg-open"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">x</span>=<span class="org-string">"sxiv -ft *"</span>
</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">
<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-org258d499" class="outline-4">
<h4 id="org258d499">Magit</h4>
<div class="outline-text-4" id="text-org258d499">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-comment-delimiter"># </span><span class="org-comment">alias magit="emacsclient -create-frame --alternate-editor=\"\" --eval '(magit-status)'"</span>
<span class="org-builtin">alias</span> <span class="org-variable-name">magit</span>=<span class="org-string">"nvim -c MagitOnly"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org88d74a4" class="outline-4">
<h4 id="org88d74a4">Homelab Relative</h4>
<div class="outline-text-4" id="text-org88d74a4">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">alias</span> <span class="org-variable-name">dlab</span>=<span class="org-string">"aria2p --port 6800 --host http://dl.tdehaeze.xyz --secret </span><span class="org-string"><span class="org-sh-quoted-exec">$(</span></span><span class="org-sh-quoted-exec">pass</span><span class="org-string"><span class="org-sh-quoted-exec"> dl.tdehaeze.xyz/tdehaeze | sed -n 1p)</span></span><span class="org-string">"</span>
</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">
<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-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">
<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-org25e4d93" class="outline-3">
<h3 id="org25e4d93">Functions</h3>
<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">
<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-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">
<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-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">
<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-org4395b78" class="outline-4">
<h4 id="org4395b78">Filesize of directory</h4>
<div class="outline-text-4" id="text-org4395b78">
<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-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">
<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-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">
<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>
<span class="org-comment-delimiter"># </span><span class="org-type"><span class="org-comment">echo</span></span><span class="org-comment"> "${name}"$'\t'"${phone_number}"$'\t'"${phone_type}" &gt; ${_KDECONNECT_SMS_LAST_RECIPIENT}</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-comment-delimiter"># </span><span class="org-comment">kdeconnect-cli --device ${_KDECONNECT_DEFAULT_DEVICE} --send-sms "${args}" --destination "${phone_number}" &amp;&amp; \</span>
<span class="org-comment-delimiter"># </span><span class="org-type"><span class="org-comment">echo</span></span><span class="org-comment"> sent sms message to ${name} | fribidi</span>
<span class="org-keyword">fi</span>
<span class="org-rainbow-delimiters-depth-1">}</span>
</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">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">HISTFILESIZE</span>=
<span class="org-builtin">export</span> <span class="org-variable-name">HISTSIZE</span>=
<span class="org-builtin">export</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-org6a5ac47" class="outline-2">
<h2 id="org6a5ac47">Bash Profile</h2>
<div class="outline-text-2" id="text-org6a5ac47">
<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-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">
<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-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">
<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-orga5ea80f" class="outline-3">
<h3 id="orga5ea80f">Gnome Keyring Daemon</h3>
<div class="outline-text-3" id="text-orga5ea80f">
<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-org3e2966e" class="outline-3">
<h3 id="org3e2966e">Default</h3>
<div class="outline-text-3" id="text-org3e2966e">
<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">"termite"</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-org5ea13c1" class="outline-3">
<h3 id="org5ea13c1">Exports</h3>
<div class="outline-text-3" id="text-org5ea13c1">
</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>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">TERM</span>=xterm-color
</pre>
</div>
</div>
</div>
<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">
<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-org117a776" class="outline-4">
<h4 id="org117a776">Better yaourt colors</h4>
<div class="outline-text-4" id="text-org117a776">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">YAOURT_COLORS</span>=<span class="org-string">"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"</span>
</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">
<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-org545dc00" class="outline-4">
<h4 id="org545dc00">Goland</h4>
<div class="outline-text-4" id="text-org545dc00">
<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-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"><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-org8965bcd" class="outline-4">
<h4 id="org8965bcd">Bitwarden Session</h4>
<div class="outline-text-4" id="text-org8965bcd">
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">export</span> <span class="org-variable-name">BW_SESSION</span>=<span class="org-string">"HH0yycfocRSuGtq/iW1e6v13PQ1sShMXbMhdb/En94S6OcIXFnJlLEyU+dySsmf2YShY4CImoB5FrxgdPsY9Qw=="</span>
</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">
<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>=~/.local/bin:$<span class="org-variable-name">PATH</span>
<span class="org-variable-name">PATH</span>=~/.emacs.d/bin:$<span class="org-variable-name">PATH</span>
<span class="org-builtin">export</span> 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"><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: 2020-11-03 mar. 16:26</p>
</div>
</body>
</html>