674 lines
40 KiB
HTML
674 lines
40 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>
|
|
<!-- 2022-05-09 lun. 10:05 -->
|
|
<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="#org05a79d8">If not running interactively, don’t do anything</a></li>
|
|
<li><a href="#org3695180">Bash Completion</a></li>
|
|
<li><a href="#org4a4d160">FZF</a></li>
|
|
<li><a href="#org85fd378">Ignore case for auto-completion</a></li>
|
|
<li><a href="#org8f219ce">Use Color</a></li>
|
|
<li><a href="#org1e666c8">Some config</a></li>
|
|
<li><a href="#org3d4e406">Prompt - <code>PS1</code></a></li>
|
|
<li><a href="#org2eb451d">Rebind up and down arrow keys to search through bash history</a></li>
|
|
<li><a href="#org68ea631">Aliases</a>
|
|
<ul>
|
|
<li><a href="#orgccd152d">Better defaults for some commands</a></li>
|
|
<li><a href="#orge8cb785">One letter aliases</a></li>
|
|
<li><a href="#org39c3683">Neovim</a></li>
|
|
<li><a href="#org706f81a">Vim-like</a></li>
|
|
<li><a href="#org2afd297">Print each PATH entry on a separate line</a></li>
|
|
<li><a href="#org1a6ba2c">Other</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org41248d3">Functions</a>
|
|
<ul>
|
|
<li><a href="#org3c65ff6"><code>colors</code> - Display colors</a></li>
|
|
<li><a href="#org8c5d327"><code>tre</code> - Tree display</a></li>
|
|
<li><a href="#orga41efe9"><code>mkd</code> - Create a new directory and enter it</a></li>
|
|
<li><a href="#org57cd28d"><code>fs</code> - Filesize of directory</a></li>
|
|
<li><a href="#org640ebd8"><code>nullify</code> - Redirect both standard output and standard error, as well as sending to background</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orgf766dae">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="#org33d42e0">QT And GTK Themes</a></li>
|
|
<li><a href="#org2963255">Gui program to ask for sudo password</a></li>
|
|
<li><a href="#orgfb2d3a0">Gnome Keyring Daemon</a></li>
|
|
<li><a href="#orgd06f8cc">Export some default applications</a></li>
|
|
<li><a href="#org0e3dafc">Exports</a>
|
|
<ul>
|
|
<li><a href="#orgdf02655">XDG Default</a></li>
|
|
<li><a href="#org70e92e1">Use Ripgrep for FZF</a></li>
|
|
<li><a href="#org5a8d89e">Goland</a></li>
|
|
<li><a href="#org9d92877">Latex Path</a></li>
|
|
<li><a href="#org552bb96">Python Path</a></li>
|
|
<li><a href="#org5fc0fad">Linkding</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orgf15d561">Path</a></li>
|
|
<li><a href="#org93ffa5b">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-org05a79d8" class="outline-3">
|
|
<h3 id="org05a79d8">If not running interactively, don’t do anything</h3>
|
|
<div class="outline-text-3" id="text-org05a79d8">
|
|
<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> && <span class="org-keyword">return</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org3695180" class="outline-3">
|
|
<h3 id="org3695180">Bash Completion</h3>
|
|
<div class="outline-text-3" id="text-org3695180">
|
|
<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> && <span class="org-builtin">.</span> /usr/share/bash-completion/bash_completion
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org4a4d160" class="outline-3">
|
|
<h3 id="org4a4d160">FZF</h3>
|
|
<div class="outline-text-3" id="text-org4a4d160">
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-builtin">.</span> /usr/share/doc/fzf/examples/completion.bash
|
|
<span class="org-builtin">.</span> /usr/share/doc/fzf/examples/key-bindings.bash
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org85fd378" class="outline-3">
|
|
<h3 id="org85fd378">Ignore case for auto-completion</h3>
|
|
<div class="outline-text-3" id="text-org85fd378">
|
|
<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-org8f219ce" class="outline-3">
|
|
<h3 id="org8f219ce">Use Color</h3>
|
|
<div class="outline-text-3" id="text-org8f219ce">
|
|
<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-org1e666c8" class="outline-3">
|
|
<h3 id="org1e666c8">Some config</h3>
|
|
<div class="outline-text-3" id="text-org1e666c8">
|
|
<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 > /dev/null <span class="org-highlight-numbers-number">2</span>>&<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 !!<space> 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-org3d4e406" class="outline-3">
|
|
<h3 id="org3d4e406">Prompt - <code>PS1</code></h3>
|
|
<div class="outline-text-3" id="text-org3d4e406">
|
|
<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-org2eb451d" class="outline-3">
|
|
<h3 id="org2eb451d">Rebind up and down arrow keys to search through bash history</h3>
|
|
<div class="outline-text-3" id="text-org2eb451d">
|
|
<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-org68ea631" class="outline-3">
|
|
<h3 id="org68ea631">Aliases</h3>
|
|
<div class="outline-text-3" id="text-org68ea631">
|
|
</div>
|
|
<div id="outline-container-orgccd152d" class="outline-4">
|
|
<h4 id="orgccd152d">Better defaults for some commands</h4>
|
|
<div class="outline-text-4" id="text-orgccd152d">
|
|
<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">bat</span>=<span class="org-string">'batcat'</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-orge8cb785" class="outline-4">
|
|
<h4 id="orge8cb785">One letter aliases</h4>
|
|
<div class="outline-text-4" id="text-orge8cb785">
|
|
<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-org39c3683" class="outline-4">
|
|
<h4 id="org39c3683">Neovim</h4>
|
|
<div class="outline-text-4" id="text-org39c3683">
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-builtin">command</span> -v nvim >/dev/null && <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-org706f81a" class="outline-4">
|
|
<h4 id="org706f81a">Vim-like</h4>
|
|
<div class="outline-text-4" id="text-org706f81a">
|
|
<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-org2afd297" class="outline-4">
|
|
<h4 id="org2afd297">Print each PATH entry on a separate line</h4>
|
|
<div class="outline-text-4" id="text-org2afd297">
|
|
<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 id="outline-container-org1a6ba2c" class="outline-4">
|
|
<h4 id="org1a6ba2c">Other</h4>
|
|
<div class="outline-text-4" id="text-org1a6ba2c">
|
|
<div class="org-src-container">
|
|
<pre class="src src-bash"><span class="org-builtin">alias</span> <span class="org-variable-name">fd</span>=<span class="org-string">"fdfind"</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org41248d3" class="outline-3">
|
|
<h3 id="org41248d3">Functions</h3>
|
|
<div class="outline-text-3" id="text-org41248d3">
|
|
</div>
|
|
<div id="outline-container-org3c65ff6" class="outline-4">
|
|
<h4 id="org3c65ff6"><code>colors</code> - Display colors</h4>
|
|
<div class="outline-text-4" id="text-org3c65ff6">
|
|
<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-org8c5d327" class="outline-4">
|
|
<h4 id="org8c5d327"><code>tre</code> - Tree display</h4>
|
|
<div class="outline-text-4" id="text-org8c5d327">
|
|
<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-orga41efe9" class="outline-4">
|
|
<h4 id="orga41efe9"><code>mkd</code> - Create a new directory and enter it</h4>
|
|
<div class="outline-text-4" id="text-orga41efe9">
|
|
<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> && <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-org57cd28d" class="outline-4">
|
|
<h4 id="org57cd28d"><code>fs</code> - Filesize of directory</h4>
|
|
<div class="outline-text-4" id="text-org57cd28d">
|
|
<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 > /dev/null <span class="org-highlight-numbers-number">2</span>>&<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-org640ebd8" class="outline-4">
|
|
<h4 id="org640ebd8"><code>nullify</code> - Redirect both standard output and standard error, as well as sending to background</h4>
|
|
<div class="outline-text-4" id="text-org640ebd8">
|
|
<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> >/dev/null <span class="org-highlight-numbers-number">2</span>>&<span class="org-highlight-numbers-number">1</span>
|
|
<span class="org-rainbow-delimiters-depth-1">}</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgf766dae" class="outline-3">
|
|
<h3 id="orgf766dae">Bash History</h3>
|
|
<div class="outline-text-3" id="text-orgf766dae">
|
|
<p>
|
|
Undocumented feature which sets the size to “unlimited”. <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">"&:[ ]*: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> && <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> && <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-org33d42e0" class="outline-3">
|
|
<h3 id="org33d42e0">QT And GTK Themes</h3>
|
|
<div class="outline-text-3" id="text-org33d42e0">
|
|
<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-org2963255" class="outline-3">
|
|
<h3 id="org2963255">Gui program to ask for sudo password</h3>
|
|
<div class="outline-text-3" id="text-org2963255">
|
|
<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-orgfb2d3a0" class="outline-3">
|
|
<h3 id="orgfb2d3a0">Gnome Keyring Daemon</h3>
|
|
<div class="outline-text-3" id="text-orgfb2d3a0">
|
|
<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-orgd06f8cc" class="outline-3">
|
|
<h3 id="orgd06f8cc">Export some default applications</h3>
|
|
<div class="outline-text-3" id="text-orgd06f8cc">
|
|
<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-org0e3dafc" class="outline-3">
|
|
<h3 id="org0e3dafc">Exports</h3>
|
|
<div class="outline-text-3" id="text-org0e3dafc">
|
|
</div>
|
|
<div id="outline-container-orgdf02655" class="outline-4">
|
|
<h4 id="orgdf02655">XDG Default</h4>
|
|
<div class="outline-text-4" id="text-orgdf02655">
|
|
<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-org70e92e1" class="outline-4">
|
|
<h4 id="org70e92e1">Use Ripgrep for FZF</h4>
|
|
<div class="outline-text-4" id="text-org70e92e1">
|
|
<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-org5a8d89e" class="outline-4">
|
|
<h4 id="org5a8d89e">Goland</h4>
|
|
<div class="outline-text-4" id="text-org5a8d89e">
|
|
<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-org9d92877" class="outline-4">
|
|
<h4 id="org9d92877">Latex Path</h4>
|
|
<div class="outline-text-4" id="text-org9d92877">
|
|
<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-org552bb96" class="outline-4">
|
|
<h4 id="org552bb96">Python Path</h4>
|
|
<div class="outline-text-4" id="text-org552bb96">
|
|
<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-org5fc0fad" class="outline-4">
|
|
<h4 id="org5fc0fad">Linkding</h4>
|
|
<div class="outline-text-4" id="text-org5fc0fad">
|
|
<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-orgf15d561" class="outline-3">
|
|
<h3 id="orgf15d561">Path</h3>
|
|
<div class="outline-text-3" id="text-orgf15d561">
|
|
<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-variable-name">PATH</span>=~/.local/bin:$<span class="org-variable-name">PATH</span>
|
|
<span class="org-variable-name">PATH</span>=~/.npm-global/bin:$<span class="org-variable-name">PATH</span>
|
|
<span class="org-variable-name">PATH</span>=~/miniconda3/bin:$<span class="org-variable-name">PATH</span>
|
|
<span class="org-builtin">export</span> PATH
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org93ffa5b" class="outline-3">
|
|
<h3 id="org93ffa5b">Automatically run <code>startx</code></h3>
|
|
<div class="outline-text-3" id="text-org93ffa5b">
|
|
<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> && <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’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: 2022-05-09 lun. 10:05</p>
|
|
</div>
|
|
</body>
|
|
</html>
|