-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
5483 lines (4766 loc) · 206 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
#######################################################
# ┏━╸╻ ╻╺┳╸┏━┓┏━╸┏┳┓┏━╸ ╻ ╻╻ ╺┳╸╻┏┳┓┏━┓╺┳╸┏━╸ ┏┓ ┏━┓┏━┓╻ ╻┏━┓┏━╸
# ┣╸ ┏╋┛ ┃ ┣┳┛┣╸ ┃┃┃┣╸ ┃ ┃┃ ┃ ┃┃┃┃┣━┫ ┃ ┣╸ ┣┻┓┣━┫┗━┓┣━┫┣┳┛┃
# ┗━╸╹ ╹ ╹ ╹┗╸┗━╸╹ ╹┗━╸ ┗━┛┗━╸ ╹ ╹╹ ╹╹ ╹ ╹ ┗━╸ ╹┗━┛╹ ╹┗━┛╹ ╹╹┗╸┗━╸
# Extreme Ultimate .bashrc File sources are free and
# open software released under the MIT License (MIT)
# https://sourceforge.net/projects/ultimate-bashrc/files/
#
# The MIT License (MIT)
# Copyright © 2022
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the “Software”), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#######################################################
# To Install or Update:
# wget -O ~/.bashrc https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc/download
# wget -O ~/.bashrc_help https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc_help/download
# -or-
# curl -L --output ~/.bashrc https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc/download
# curl -L --output ~/.bashrc_help https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc_help/download
#######################################################
# Supported Optional Applications/Dependencies:
# 7z aria2 baca bash-completion bashmarks bashtop bat bc blesh bottom bpytop
# broot btop btrfs bzip2 ccat cmatrix cod colordiff commacd curl delta doas dua
# dust dym enhancd exa exiftool fasd fd ffmpeg figlet fx fzf fzy gawk gcal gdu
# git gitalias git-commander git-completion git-delta gitui glances glow grc grv
# gtop gzip hBlock hstr htop icdiff ifconfig iotop jless jq jp2a lazygit lolcat
# lscolors lsd lsof lsx mc mcfly micro mlocate moar multitail mysql-colorize
# nano ncdu neovim nmon nnn paru qfc rar resh ripgrep rsync shellcheck shred
# skim silver_searcher source-highlight tar terminology thefuck tig tmux toilet
# trash-cli tree tuifi ugit vivid vlock wget xsel youtube-dl yt-dlp ytfzf ytop
# zellij zf zip zoxide
#
# Supported Optional Huds:
# neofetch, fastfetch, screenFetch, linux_logo, archey, pfetch
#
# Supported Optional Prompts:
# Trueline, Powerline, Powerline-Go, Powerline-Shell,
# Pureline, Starship, Bash Git Prompt, Liquid Prompt
#
# To Install Packages:
# pkginstall [package names separated by spaces]
#######################################################
# set -o errexit # Exit when a command fails
# set -o pipefail # Catch mysqldump fails
# set -o nounset # Exit when using undeclared variables
# set -o xtrace # Trace what gets executed (useful for debugging)
### ERROR TRAPPING
# alias debug="set -o nounset; set -o xtrace"
# error() { echo 'Error in ${1} on line ${2}: ${3}' }
# trap 'error "${BASH_SOURCE}" "${LINENO}"' ERR
### TEST FOR AN INTERACTIVE SHELL
# This file is sourced by all "interactive" bash shells on startup
# including shells such as scp and rcp that can't tolerate any output.
# There is no need to set anything past this point for scp and rcp,
# and it's important to refrain from outputting anything in those cases.
[[ $- != *i* ]] && return
[[ -z "$PS1" ]] && return
# Security for X apps
if [[ -x "$(command -v xhost)" ]]; then
xhost +local:root > /dev/null 2>&1
fi
# Bash version check
if ((BASH_VERSINFO[0] < 4)); then
echo "This .bashrc file requires at least Bash 4.0"
exit 1
fi
# If missing, recreate a new empty history file so apps don't show errors
if [[ -z ${HISTFILE+x} ]]; then
[[ ! -f "$HOME/.bash_history" ]] && touch "$HOME/.bash_history"
else
[[ ! -f "$HISTFILE" ]] && touch "$HISTFILE"
fi
# Source global definitions
if [[ -f /etc/bashrc ]]; then
source /etc/bashrc
elif [[ -f /etc/bash.bashrc ]]; then
source /etc/bash.bashrc
fi
#######################################################
# Set the default editor
# Examples: vim, nvim, emacs, nano, micro, helix, pico,
# or gui apps like kate, gedit, notepadqq, or vscodium
# NOTE: In Git Bash, you can use something like "/c/Program\ Files/Notepad++/notepad++.exe"
# To change these without modifying this file, simply
# add these with your changes to one of these files:
# ~/.env
# ~/.envrc
# ~/.config/bashrc/config
# See section "Configuration and Extras" in the README:
# Link: https://sourceforge.net/projects/ultimate-bashrc/files/
#######################################################
export EDITOR=nano visudo
export VISUAL=nano visudo
export SUDO_EDITOR=nano
export FCEDIT=nano
# We will default to use either Neovim https://neovim.io or vim instead of vi
# NOTE: vi is POSIX compliant but vim has more features and Neovim is more extensible
# http://www.viemu.com/a-why-vi-vim.html
# https://www.linuxfordevices.com/tutorials/linux/vim-vs-neovim
if [[ -x "$(command -v nvim)" ]]; then
alias {v,vi,vim}='nvim'
alias svi='sudo nvim'
alias vis='nvim "+set si"'
elif [[ -x "$(command -v vim)" ]]; then
alias {v,vi}='vim'
alias svi='sudo vim'
alias vis='vim "+set si"'
elif [[ -x "$(command -v vi)" ]]; then
alias v='vi'
alias svi='sudo vi'
fi
# Set some defaults for nano
# NOTE: Depending on the version of nano you have, --linenumbers and --suspend is helpful
if [[ -x "$(command -v nano)" ]]; then
alias {n,nano}='nano --smarthome --multibuffer --const --autoindent'
fi
# Set Micro editor true color support
# Link: https://micro-editor.github.io/
# Install: curl https://getmic.ro | bash
export MICRO_TRUECOLOR=1
# Create an alias for the Helix editor
# See hx --tutor or :tutor for a vimtutor-like introduction
# Link: https://github.com/helix-editor/helix
# Link: https://docs.helix-editor.com/title-page.html
if [[ -x "$(command -v helix)" ]]; then
alias hx='helix'
fi
# Alias to run the default editor
# Edit any file using the default editor for the user
# and auto-detect if root permissions are needed
function edit() {
# If we have no parameters
if [[ $# -eq 0 ]]; then
# Load the default editor without any file
"${EDITOR}"
# If the file exists, and we have read/write access...
elif [[ -r "${1}" ]] && [[ -w "${1}" ]]; then
# Load in the default editor
"${EDITOR}" "${1}"
elif [[ -f "${1}" ]]; then # The file does exist...
# Edit the file using sudo but use this users default editor
echo -ne "\033[1;31mInsufficient permissions:"
echo -e "\033[1;33m Using super user to edit \033[1;36m${1}\033[0m"
#sudoedit "${1}" 2> /dev/null || sudo --preserve-env "${EDITOR}" "${1}"
sudo --preserve-env "${EDITOR}" "${1}"
else # File does not exist...
# Create a new file...
if touch "${1}" ; then
# If success, edit it
"${EDITOR}" "${1}"
# If there was no edit (file is empty), delete it
[[ -s "${1}" ]] || \rm -f "${1}" 2>/dev/null
else # Cannot create new file...
# Create the file using sudo using this user's default editor
echo -ne "\033[1;31mInsufficient permissions:"
echo -e "\033[1;33m Using super user to create \033[1;36m${1}\033[0m"
#sudoedit "${1}" 2> /dev/null || sudo --preserve-env "${EDITOR}" "${1}"
sudo --preserve-env "${EDITOR}" "${1}"
fi
fi
}
# Shortcut for edit using only the letter e
alias e="edit"
alias se="sudoedit"
#######################################################
# Set default variable values
# These variables can be overridden in one of these environment variable files:
# ~/.env
# ~/.envrc
# ~/.config/bashrc/config
#######################################################
# Determines if CTRL-h will show help
# Ctrl+h (for help) and Ctrl+Backspace share the same key binding
# in some terminal emulators so we default to skip this keybind
_SKIP_HELP_KEYBIND=true
# Show an installed information HUD on initial Bash load (if not skipped)
# Link: https://github.com/LinusDierheimer/fastfetch
# Link: https://ostechnix.com/neofetch-display-linux-systems-information/
# Link: https://github.com/KittyKatt/screenFetch
# Link: https://github.com/deater/linux_logo
# Link: https://github.com/dylanaraps/pfetch
_SKIP_SYSTEM_INFO=false
# If not skipped, shows pending updates (only in Arch, Manjaro, and Ubuntu)
# WARNING: This check for updates takes several seconds so the default is true
_SKIP_UPGRADE_NOTIFY=true
# Automatically launch TMUX terminal multiplexer in local, TTY, or SSH sessions
# https://github.com/tmux/tmux/wiki
# Since TMUX is pre-installed on so many systems, the default is to skip TMUX
_TMUX_LOAD_TTY=false
_TMUX_LOAD_SSH=false
_TMUX_LOAD_LOCAL=false
# OPTIONAL: Set and force the default TMUX session name for this script and tm
# If not specified, an active TMUX session is used and attached to
# If no active TMUX session exists, the current logged in user name is used
#_TMUX_LOAD_SESSION_NAME=""
# Terminology is a graphical EFL terminal emulator that can run in TTY sessions
# If installed, it can automatically be launched when starting a TTY session
# To split the window horizontally press Ctrl+Shift+PgUp
# To split the window vertically press Ctrl+Shift+PgDn
# To create Tabs press Ctrl+Shift+T and cycle through using Ctrl+1-9
# Link: https://github.com/borisfaure/terminology
# Link: https://linoxide.com/terminology-terminal/
_SKIP_TERMINOLOGY_TTY=false
# Blesh: Bash Line Editor replaces default GNU Readline
# Link: https://github.com/akinomyoga/ble.sh
# Link for configuration: https://github.com/akinomyoga/ble.sh/blob/master/blerc
# WARNING: Can be buggy with certain prompts (like Trueline)
_SKIP_BLESH=false
# Make sure the default file and directory permissions for newly created files
# in the home directory is umask 026 to improve security.
# (user=read/write/execute, group=read/execute, others=execute for directories)
# The default is to skip this security setting and not modify home permissions
_SKIP_UMASK_HOME=true
# Replaces Sudo with one of the two alternatives (if installed):
# RootDO (rdo) - A very slim alternative to both sudo and doas
# Link: https://codeberg.org/sw1tchbl4d3/rdo
# - OR -
# A port of OpenBSD's doas offers two benefits over sudo:
# 1) Its configuration file has a simple syntax and
# 2) It is smaller, requiring less effort to audit the code
# Link: https://github.com/Duncaen/OpenDoas or https://github.com/slicer69/doas
# Default value is skip and must be set to false manually for security reasons
_SKIP_SUDO_ALTERNATIVE=true
# If set to true, cd will not output the current absolute path under certain
# circumstances like when using the command cd - or using cdable_vars bookmarks
# Link: https://www.gnu.org/software/bash/manual/bash.html#index-cd
_SILENCE_CD_OUTPUT=false
# If set to true, will not load anything that modifies the ls command or colors
_SKIP_LS_COLORIZED=false
# exa is a modern color replacement for ls that also has some Git support
# Link: https://github.com/ogham/exa
_SKIP_EXA=false
# grc Generic Colouriser
# Link: https://github.com/garabik/grc
_SKIP_GRC=false
# If set to true, will not source bash completion scripts
_SCRIPT_BASH_COMPLETION=false
# If set to true, will show a calendar when Bash is started
_SHOW_BASH_CALENDAR=false
# If GNU gcal is installed, use this local for holidays
# To show the possible options type: gcal -hh | grep 'Holidays in'
# Link: https://www.gnu.org/software/gcal/manual/gcal.html
# Link: https://unix.stackexchange.com/questions/164555/how-to-emphasize-holidays-by-color-in-cal-command
_GCAL_COUNTRY_CODE=US_AK
# Skip the birthday/anniversary reminder that shows a message in your teminal?
# Reads the birthday CSV file: ~/.config/birthdays.csv
# The first line is ignored (header) and the format is (year is optional):
# Month,Day,Year,"Message"
# Jan,1,1985,"This is a message!"
#
# Toilet application is an optional dependency
# Install Arch/Manjaro: sudo pacman -S toilet
# Install Ubuntu/Debian: sudo apt-get install toilet
_SKIP_BDAY_REMINDER=false
# Set the location for the birthday/anniversary reminder CSV file
# The default location is "~/.config/birthdays.csv"
_BDAY_FILE="${HOME}/.config/birthdays.csv"
# Set the preferred birthday reminder font here (default is "future"):
_BDAY_FONT=future
# Set to have the built in prompt use a faster but less precise Git method
# This might be necessary on slow connections or networked directories
# Also if set to true, will remove exa's --git flag (use lsg for Git info)
_GIT_IS_SLOW=false
# Recognize the depreciated _PROMPT_BUILTIN_FASTER_GIT option
if [[ ${_PROMPT_BUILTIN_FASTER_GIT} = true ]]; then
_GIT_IS_SLOW=true
fi
# Optional original prompt from 2014 version now with newly added Git support
# download the optional .bashrc_prompt script file and place it in either your
# home directory or as the file ~/.config/bashrc/prompt
# You will also need to make sure this setting is set to false
_SKIP_PROMPT_ORIGINAL=false
# If false, the built-in prompt will be one single line with an abbreviated path
# If true, the built-in prompt will split into two lines with a full path
_PROMPT_BUILTIN_FULL_PATH=false
# Trueline Bash (true 24-bit color and glyph support)
# This is the prefered prompt since it looks amazing,
# has so many features, is easily extended using functions,
# and is a single Bash script file that is easy to install.
# Link: https://github.com/petobens/trueline
# Install: wget https://raw.githubusercontent.com/petobens/trueline/master/trueline.sh -P ~/
# Fonts: https://github.com/powerline/fonts
_SKIP_PROMPT_TRUELINE=false
# Powerline-Go (this prompt uses no special glyphs)
# Link: https://github.com/justjanne/powerline-go
_SKIP_PROMPT_POWERLINE_GO=false
# Powerline-Shell (details about git/svn/hg/fossil branch and Python virtualenv environment)
# Link: https://github.com/b-ryan/powerline-shell
_SKIP_PROMPT_POWERLINE_SHELL=false
# Pureline (256 color written in bash script)
# Link: https://github.com/chris-marsh/pureline
# Install:
# git clone https://github.com/chris-marsh/pureline.git
# cp pureline/configs/powerline_full_256col.conf ~/.pureline.conf
_SKIP_PROMPT_PURELINE=false
# Starship Cross Shell Prompt (focus on compatibility and written in Rust)
# Link: https://starship.rs
# Install: sh -c "$(curl -fsSL https://starship.rs/install.sh)"
_SKIP_PROMPT_STARSHIP=false
# Oh-My-Git (only used for Git but has huge support for it, requires font)
# Link: https://github.com/arialdomartini/oh-my-git
# Install: git clone https://github.com/arialdomartini/oh-my-git.git ~/.oh-my-git
_SKIP_PROMPT_OH_MY_GIT=false
# Bash Git Prompt (shows git repository, branch name, difference with remote branch, number of files staged, changed, etc)
# Link: https://github.com/magicmonty/bash-git-prompt
# Install: git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1
_SKIP_PROMPT_BASH_GIT_PROMPT=false
# Bash Powerline (no need for patched fonts, supports git, previous command execution status, platform-dependent prompt symbols)
# Link: https://github.com/riobard/bash-powerline
# Install: curl https://raw.githubusercontent.com/riobard/bash-powerline/master/bash-powerline.sh > ~/.bash-powerline.sh
_SKIP_PROMPT_BASH_POWERLINE=false
# Sexy Bash Prompt (supports git, 256 color)
# Link: https://github.com/twolfson/sexy-bash-prompt
# Install: (cd /tmp && ([[ -d sexy-bash-prompt ]] || git clone --depth 1 --config core.autocrlf=false https://github.com/twolfson/sexy-bash-prompt) && cd sexy-bash-prompt && make install)
_SKIP_PROMPT_SEXY_BASH_PROMPT=false
# Liquid Prompt (adaptive prompt with low color and no glyphs)
# Link: https://github.com/nojhan/liquidprompt
# Install: git clone --branch stable https://github.com/nojhan/liquidprompt.git ~/liquidprompt
_SKIP_PROMPT_LIQUIDPROMPT=false
# Original Powerline Status Line for Vim Bash Zsh fish tmux IPython Awesome i3 Qtile
# Link: https://github.com/powerline/powerline
# Install: https://medium.com/earlybyte/powerline-for-bash-6d3dd004f6fc
# NOTE: Requires Python and can be used with Trueline in Bash
# WARNING: This path may change or break in the future with new Python versions
_SKIP_PROMPT_POWERLINE=false
# Determine our kernel name
_KERNEL_NAME="$(expr substr $(uname -s) 1 5)"
#######################################################
# Add Common Binary Directories to Path
#######################################################
# Add directories to the end of the path if they exists and are not already in the path
# Link: https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
function pathappend() {
for ARG in "$@"
do
if [ -d "$ARG" ] && [[ ":$PATH:" != *":$ARG:"* ]]; then
PATH="${PATH:+"$PATH:"}$ARG"
fi
done
}
# Add directories to the beginning of the path if they exist and are not already in the path
function pathprepend() {
for ((i=$#; i>0; i--));
do
ARG=${!i}
if [ -d "$ARG" ] && [[ ":$PATH:" != *":$ARG:"* ]]; then
PATH="$ARG${PATH:+":$PATH"}"
fi
done
}
# Add the most common personal binary paths located inside the home folder
# (these directories are only added if they exist)
pathprepend "$HOME/bin" "$HOME/sbin" "$HOME/.local/bin" "$HOME/local/bin" "$HOME/.bin"
# Check for the Rust package manager binary install location
# Link: https://doc.rust-lang.org/cargo/index.html
pathappend "$HOME/.cargo/bin" "/root/.cargo/bin"
# If the GOPATH environment variable is not set, set it to the default
if [[ -x "$(command -v go)" ]] && [[ -z ${GOPATH+x} ]] && [[ -d $HOME/go ]]; then
export GOPATH="$HOME/go"
fi
#######################################################
# User Specific Environment Variables
#######################################################
if [[ -f "$HOME/.envrc" ]]; then
source "$HOME/.envrc"
fi
if [[ -f "$HOME/.env" ]]; then
source "$HOME/.env"
fi
if [[ -f "$HOME/.config/bashrc/config" ]]; then
source "$HOME/.config/bashrc/config"
fi
#######################################################
# Bashrc Support
#######################################################
# Alias to edit this .bashrc file
alias ebrc='edit ~/.bashrc'
# Find the help file for this .bashrc file (type hlp or press CONTROL-H)
if [[ -f "$HOME/.config/bashrc/help" ]]; then
_BASHRC_HELP="$HOME/.config/bashrc/help"
if [[ $_SKIP_HELP_KEYBIND = false ]]; then
bind -x '"\C-h":"less -f -r -n -S ~/.config/bashrc/help"'
fi
elif [[ -f "$HOME/.bashrc_help" ]]; then
_BASHRC_HELP="$HOME/.bashrc_help"
if [[ $_SKIP_HELP_KEYBIND = false ]]; then
bind -x '"\C-h":"less -f -r -n -S ~/.bashrc_help"'
fi
fi
# Alias to show the help file
alias hlp='\less -f -r -n -S "$_BASHRC_HELP"'
#######################################################
# Use these commands to keep the .bashrc immutable and write protected
# even from root so that other scripts and applications can't change it
#######################################################
alias bashrcprotect="sudo chattr +i $HOME/.bashrc"
alias bashrcunprotect="sudo chattr -i $HOME/.bashrc"
alias bashrccheckprotect='if [[ $(lsattr -R -l ~/.bashrc | grep " Immutable") ]]; then echo "Protected"; else echo "Not Protected"; fi;'
#######################################################
# Alias for Bashrc Updates
#######################################################
# Update this .bashrc and .bashrc_help files
if [[ -x "$(command -v aria2c)" ]]; then
if [[ -f "$HOME/.config/bashrc/help" ]]; then
alias bashrcupdate='if [[ $(lsattr -R -l ~/.bashrc | grep " Immutable") ]]; then sudo chattr -i ~/.bashrc; fi && aria2c --continue=true --async-dns=false --dir="${HOME}" --out=".bashrc" https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc/download && aria2c --continue=true --async-dns=false --dir="${HOME}/.config/bashrc" --out="help" https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc_help/download && echo "Restart your terminal to see the changes."'
else
alias bashrcupdate='if [[ $(lsattr -R -l ~/.bashrc | grep " Immutable") ]]; then sudo chattr -i ~/.bashrc; fi && aria2c --continue=true --async-dns=false --dir="${HOME}" --out=".bashrc" https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc/download && aria2c --continue=true --async-dns=false --dir="${HOME}" --out=".bashrc_help" https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc_help/download && echo "Restart your terminal to see the changes."'
fi
elif [[ -x "$(command -v curl)" ]]; then
if [[ -f "$HOME/.config/bashrc/help" ]]; then
alias bashrcupdate='if [[ $(lsattr -R -l ~/.bashrc | grep " Immutable") ]]; then sudo chattr -i ~/.bashrc; fi && curl -L https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc/download --output ~/.bashrc && curl -L https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc_help/download --output ~/.config/bashrc/help && echo "Restart your terminal to see the changes."'
else
alias bashrcupdate='if [[ $(lsattr -R -l ~/.bashrc | grep " Immutable") ]]; then sudo chattr -i ~/.bashrc; fi && curl -L https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc/download --output ~/.bashrc && curl -L https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc_help/download --output ~/.bashrc_help && echo "Restart your terminal to see the changes."'
fi
elif [[ -x "$(command -v wget)" ]]; then
if [[ -f "$HOME/.config/bashrc/help" ]]; then
alias bashrcupdate='if [[ $(lsattr -R -l ~/.bashrc | grep " Immutable") ]]; then sudo chattr -i ~/.bashrc; fi && wget -c -O ~/.bashrc https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc/download && wget -c -O ~/.config/bashrc/help https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc_help/download && echo "Restart your terminal to see the changes."'
else
alias bashrcupdate='if [[ $(lsattr -R -l ~/.bashrc | grep " Immutable") ]]; then sudo chattr -i ~/.bashrc; fi && wget -c -O ~/.bashrc https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc/download && wget -c -O ~/.bashrc_help https://sourceforge.net/projects/ultimate-bashrc/files/_bashrc_help/download && echo "Restart your terminal to see the changes."'
fi
else
if [[ -x "$(command -v xdg-open)" ]]; then
alias bashrcupdate='open https://sourceforge.net/projects/ultimate-bashrc/files/'
else
alias bashrcupdate='echo "Please install either wget, curl, aria2, or visit https://sourceforge.net/projects/ultimate-bashrc/ to update.'
fi
fi
#######################################################
# Change the default file and directory permissions for newly created files
# in the home directory
# The default is usually 022 blocking writes for non-users
# umask 022 # u=rwx,g=rx,o=rx
#######################################################
# Only if we are not the root user...
if [[ $_SKIP_UMASK_HOME = false ]] && [[ $EUID -ne 0 ]]; then
# Grant full access to the user, block write for group, and
# block read write for others. Leave execute for directories.
# (Also see fixuserhome function)
umask u=rwx,g=rx,o=x # umask 026
fi
#######################################################
# General Aliases
# NOTE: To temporarily bypass an alias, we proceed the command with a \
# EG: if the ls command is aliased, to use the normal command you would type \ls
#######################################################
# Show a list of available aliases and functions
alias a='_listcommands | \less -n -S'
function _listcommands() {
local COLOR="\033[1;31m" # Light Red
local NOCOLOR="\033[0m"
echo -e "${COLOR}Aliases:${NOCOLOR}"
# compgen -A alias
alias | awk -F'[ =]' '{print "\033[33m"$2"\033[0m\t\033[34m"$0"\033[0m";}'
echo
echo -e "${COLOR}Functions:${NOCOLOR}"
compgen -A function | grep -v '^_.*'
}
#######################################################
### GIT ALIASES
#######################################################
# If git is installed...
if [[ -x "$(command -v git)" ]]; then
# Git Alias: Provides many useful Git alias commands
# This alias will install/update the Git alias commands file
# Link: https://github.com/GitAlias/gitalias
# Edit ~/.gitconfig and then include the path to this file like this:
# [include]
# path = gitalias.txt
alias gitalias='curl -L --output "$HOME/gitalias.txt" https://raw.githubusercontent.com/GitAlias/gitalias/master/gitalias.txt && git config --global include.path "gitalias.txt"'
# When invoked without arguments gg will do a short Git status,
# otherwise it will just pass on the given arguments to the Git command.
# Status is likely to be the Git command one will execute the most,
# hence this simple enhancement does prove very useful in practice.
alias gg='_f() { if [[ $# == 0 ]]; then git status --short --branch; else git "$@"; fi }; _f'
# All Git aliases start with gg for speed
alias ggg='git status'
alias ggp='git pull' # Fetch and merge
alias ggf='git fetch'
alias ggm='git merge'
alias ggpu='git push'
alias ggr='git reset' # Specify a file to un-add or no file to unstage all
alias gga='git add'
alias ggap='git add -p' # Interactively choose hunks
alias ggac='git add --all && git commit --verbose -m' # Add "commit message"
alias ggc='git commit --verbose -m' # Add "commit message"
alias ggm='git commit --amend --verbose'
alias ggl='git log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short'
alias ggd='git diff'
alias ggds='git diff --stat'
alias ggdc='git diff --cached'
alias ggb='gitbranch' # Change branch
alias ggcb='git checkout -b' # Create new branch
alias ggst='git stash'
alias ggpop='git stash pop'
# Vacuum the local Git repository database, reduce it's size, and clean out logs
# Link: https://stackoverflow.com/questions/2116778/reduce-git-repository-size
alias gitclean='git reflog expire --all --expire=now && git gc --prune=now --aggressive'
# Find all Git repos in the current directory recursively
# Note: Excludes hidden and temp directories
# You can find all git repos on the entire system using: locate .git | grep "/.git$"
alias gitrepos="find . -type d -not -path '*/.git/*' -not -path '*/tmp/*' -not -path '*/temp/*' -not -path '*/.*' -exec test -e '{}/.git' ';' -print -prune"
# Git Auto-Completion
# Link: https://github.com/git/git/tree/master/contrib/completion
# Install: wget -O ~/git-completion.bash https://github.com/git/git/raw/master/contrib/completion/git-completion.bash
if [[ -f "$HOME/git-completion.bash" ]]; then
source "$HOME/git-completion.bash"
fi
# If exa (with Git support) is installed...
# Link: https://github.com/ogham/exa
if [[ -n $(which exa 2> /dev/null) ]]; then
# Add icons if unicode and the icon paramter is supported
if [[ ! $_SKIP_EXA = false ]] && [[ $(locale charmap) == 'UTF-8' ]] && [[ -n $(\exa --help | grep -e '--icons' 2> /dev/null) ]]; then
alias exa='exa --icons'
fi
alias lsg='exa --long --all --links --group --modified --classify --git --group-directories-first --color=auto --color-scale'
fi
# Nearly everything you can do in Git but in a terminal UI
# Link: https://github.com/Extrawurst/gitui
if [[ -x "$(command -v gitui)" ]]; then
alias ggu='gitui'
fi
# Tig ncurses-based text-mode interface for git
# Link: https://jonas.github.io/tig/
if [[ -x "$(command -v tig)" ]]; then
alias gitt='tig'
fi
# Git Commander
# Link: https://github.com/golbin/git-commander
# Install: npm install -g git-commander
if [[ -x "$(command -v git-commander)" ]]; then
alias gitc='git-commander'
fi
# GRV - Git Repository Viewer
# Link: https://github.com/rgburke/grv
if [[ -x "$(command -v grv)" ]]; then
alias gitrv='grv'
fi
# LazyGit - Terminal UI for git commands
# Link: https://github.com/jesseduffield/lazygit
if [[ -x "$(command -v lazygit)" ]]; then
alias lg='lazygit'
fi
# Ugit - Git Undo
# Link: https://github.com/Bhupesh-V/ugit
# Install: sh -c "$(curl -fsSL https://raw.githubusercontent.com/Bhupesh-V/ugit/master/install)"
if [[ -x "$(command -v ugit)" ]]; then
alias gitundo='ugit'
fi
# List Git files by last modified date
# Link: https://stackoverflow.com/questions/14141344/git-status-list-last-modified-date
alias gitmodifieddate='IFS=""; git status -s | while read -n2 mode; read -n1; read file; do echo $mode $(stat -c %y "$file") $file; done | sort -k1,4'
# Returns you to the Git project's top level
alias cg='cd `git rev-parse --show-toplevel`'
# Change the Git branch
# If the branch is not specified and a picker is installed, a list of
# branches is shown to choose from
# Supported pickers are: skim, fzy, fzf, peco, percol, pick, icepick, selecta, or sentaku
function gitbranch() {
if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
if [[ -z "${@}" ]]; then
local _FOUND_PICKER=false
for _PICKER in fzy sk fzf peco percol pick icepick selecta sentaku zf; do
if [[ -x "$(command -v $_PICKER)" ]]; then
_FOUND_PICKER=true
git checkout $(git branch --sort=-committerdate | cut -c 3- | $_PICKER)
break;
fi
done
if [[ $_FOUND_PICKER == false ]]; then
echo -e "\033[1;34mMost Recent Branches By Commit Date:\033[0m"
echo "$(git branch --sort=-committerdate | head -n 20)"
git checkout
fi
else
git checkout ${@}
fi
else
echo -e '\033[1;31mERROR:\033[1;37m Current directory is not a Git repository\033[0m'
fi
}
# Using the Git status short format information, here's a function that
# uses Awk and the column command to give you customized status output
# Link: https://stackoverflow.com/questions/8727003/enhanced-ls-with-git-status-information
function gitls() {
git status --porcelain | \
awk 'BEGIN {FS=" "}
{
xstat = substr($0, 1, 1);
ystat = substr($0, 2, 1);
f = substr($0, 4);
ri = index(f, " -> ");
if (ri > 0) f = substr(f, 1, ri);
if (xstat == " " && ystat ~ "M|D") stat = "not_updated";
else if (xstat == "M" && ystat ~ " |M|D") stat = "updated_in_index";
else if (xstat == "A" && ystat ~ " |M|D") stat = "added_to_index";
else if (xstat == "D" && ystat ~ " |M") stat = "deleted_from_index";
else if (xstat == "R" && ystat ~ " |M|D") stat = "renamed_in_index";
else if (xstat == "C" && ystat ~ " |M|D") stat = "copied_in_index";
else if (xstat ~ "M|A|R|C" && ystat == " ") stat = "index_and_work_tree_matches";
else if (xstat ~ " |M|A|R|C" && ystat == "M") stat = "work_tree_changed_since_index";
else if (xstat ~ " |M|A|R|C" && ystat == "D") stat = "deleted_in_work_tree";
else if (xstat == "D" && ystat == "D") stat = "unmerged,both_deleted";
else if (xstat == "A" && ystat == "U") stat = "unmerged,added_by_us";
else if (xstat == "U" && ystat == "D") stat = "unmerged,deleted_by_them";
else if (xstat == "U" && ystat == "A") stat = "unmerged,added_by_them";
else if (xstat == "D" && ystat == "U") stat = "unmerged,deleted_by_us";
else if (xstat == "A" && ystat == "A") stat = "unmerged,both_added";
else if (xstat == "U" && ystat == "U") stat = "unmerged,both_modified";
else if (xstat == "?" && ystat == "?") stat = "untracked";
else if (xstat == "!" && ystat == "!") stat = "ignored";
else stat = "unknown_status";
print f " " stat;
}' | \
column -t -s " " | "$PAGER"
}
# Forces Git to overwrite local files and resets the branch (or master)
# Important: If you have any local changes, they will be lost (if they're tracked)!
function gitresetbranch() {
local branch="${@}"
if [ -z "${branch}" ]; then
read -r -p "No branch was specified. Do you wish to use master? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
local branch="master"
;;
*)
echo "Please specify a branch."
return 1
;;
esac
fi
read -r -p "WARNING: If you have any local changes, they will be lost! Are you sure? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
echo git checkout ${branch} && git fetch --all && git reset --hard origin/${branch}
;;
*)
return 0
;;
esac
}
# Set defaults for Git (~/.gitconfig)
function gitfixsettings() {
local checkmark="\r\033[1;32m✓\033[0m"
# If GitAlias (see gitalias alias) is installed...
if [[ -f "$HOME/gitalias.txt" ]]; then
# Tell Git to include this file
git config --global include.path "gitalias.txt"
echo -e "${checkmark} Found gitalias.txt"
fi
# Set the user name
local GIT_USER_NAME
read -e -i "$(git config --get user.name)" -p "Enter your user name (ENTER to skip): " GIT_USER_NAME
if [ -z "${GIT_USER_NAME}" ]; then
GIT_USER_NAME="User"
fi
git config --global user.name "${GIT_USER_NAME}"
# Set the email address
local GIT_USER_EMAIL
read -e -i "$(git config --get user.email)" -p "Enter your email (ENTER to skip): " GIT_USER_EMAIL
if [ -z "${GIT_USER_EMAIL}" ]; then
GIT_USER_EMAIL="user@example.com"
fi
git config --global user.email "${GIT_USER_EMAIL}"
# You should add this manually with your own information
# git config --global user.signingkey <gpg-key-id>
# Set the default Git editor to your default Bash editor
git config --global core.editor "${EDITOR}"
echo -e "${checkmark} Default editor set to ${EDITOR}"
# Set the dafault pager
git config --global core.pager "less --ignore-case --LONG-PROMPT --LINE-NUMBERS"
# Set defaults for diff and merge
git config --global merge.conflictstyle "diff3"
git config --global diff.colorMoved "default"
# Set this if icdiff is installed
if [[ -x "$(command -v icdiff)" ]]; then
git config --global icdiff.options '--highlight --line-numbers --strip-trailing-cr'
echo -e "${checkmark} Found icdiff"
fi
# If delta is installed...
if [[ -x "$(command -v delta)" ]]; then
# delta - Beautiful side by side colored diff with Git support and syntax highlighting
# Link: https://github.com/dandavison/delta
# Info: Add listed settings to your ~/.gitconfig
# NOTE: use n and N to move between diff sections
git config --global core.pager "delta"
git config --global interactive.diffFilter "delta --color-only --features=interactive"
git config --global delta.features "decorations"
git config --global delta.side-by-side "true"
git config --global delta.line-numbers "true"
git config --global delta.interactive.keep-plus-minus-markers "false"
git config --global delta.decorations.commit-decoration-style "blue ol"
git config --global delta.decorations.commit-style "raw"
git config --global delta.decorations.file-style "omit"
git config --global delta.decorations.hunk-header-decoration-style "blue box"
git config --global delta.decorations.hunk-header-file-style "red"
git config --global delta.decorations.hunk-header-line-number-style "#067a00"
git config --global delta.decorations.hunk-header-style "file line-number syntax"
echo -e "${checkmark} Found delta"
fi
# If we are in a desktop environment and Ultracompare is not installed...
# You will be prompted when you launch Ultracompare to automatically set up
# Git, so just skip the other diff configurations since this app is paid
# Link: https://www.ultraedit.com/products/ultracompare-linux/
if [[ -n "${XDG_CURRENT_DESKTOP}" ]]; then
echo -e "${checkmark} User is in desktop environment ${XDG_CURRENT_DESKTOP}"
# If UltraCompare is installed...
# You will be prompted when you launch UltraCompare to automatically set up
# Git, so just skip the other diff configurations since this app is paid
# Link: https://www.ultraedit.com/products/ultracompare-linux/
if [[ -x "$(command -v ucx)" ]]; then
echo -e "${checkmark} Found UltraCompare"
# If Meld is installed...
# Link: https://meldmerge.org/
elif [[ -x "$(command -v meld)" ]]; then
# These settings will not alter the behaviour of "git diff"
# Link: https://stackoverflow.com/questions/34119866/setting-up-and-using-meld-as-your-git-difftool-and-mergetool
# You use "git difftool" in exactly the same way as you use git diff
# Example: git difftool <COMMIT_HASH> file_name
# Example: git difftool <BRANCH_NAME> file_name
# Example: git difftool <COMMIT_HASH_1> <COMMIT_HASH_2> file_name
git config --global diff.tool meld
git config --global difftool.meld.path "$(which meld)"
git config --global difftool.meld.cmd 'meld "$LOCAL" "$REMOTE"'
git config --global difftool.prompt false
# "git mergetool" allows you to use a GUI merge program to resolve merge conflicts
# Before using git mergetool you perform a merge in the usual way with git
# then Mergetool can now be used to resolve the merge conflicts
git config --global merge.tool meld
git config --global mergetool.meld.path "$(which meld)"
git config --global mergetool.prompt false
# Choose which starting edit position you'd prefer; $MERGED for the file
# which contains the partially merged file with the merge conflict info
# or $BASE for the shared commit ancestor of $LOCAL and $REMOTE
git config --global mergetool.meld.cmd 'meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"'
#git config --global mergetool.meld.cmd 'meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"'
# Also set up the alias "git meld" which works on Cygwin
git config --global alias.meld '!git difftool -t meld --dir-diff'
echo -e "${checkmark} Found meld"
# If KDiff3 is installed...
# Link: https://kdiff3.sourceforge.net/
elif [[ -x "$(command -v kdiff3)" ]]; then
git config --global diff.guitool kdiff3
git config --global difftool.kdiff3.path "$(which kdiff3)"
git config --global difftool.kdiff3.trustExitCode false
git config --global merge.tool kdiff3
git config --global mergetool.kdiff3.path "$(which kdiff3)"
git config --global mergetool.kdiff3.trustExitCode false
echo -e "${checkmark} Found KDiff3"
fi
fi
}
fi
#######################################################
### SYSTEMD ALIASES
#######################################################
if [[ -x "$(command -v systemctl)" ]]; then
# Get a list of all services
alias services='systemctl list-units --type=service --state=running,failed'
alias servicesall='systemctl list-units --type=service'
# Find what systemd services have failed
alias failed='systemctl --failed'
# Get the status of a services
alias servicestatus='sudo systemctl status'
# Start or stop services
alias servicestart='sudo systemctl start'
alias servicestop='sudo systemctl stop'
alias servicekill='sudo systemctl kill'
alias servicerestart='sudo systemctl restart' # Stop and start
alias servicereload='sudo systemctl reload' # Reload configuration
# Clear system log entries from the systemd journal
alias clearsystemlogs='echo -ne "\033[1;34mBefore\033[0m: "; journalctl --disk-usage; sudo journalctl --rotate; sudo journalctl --vacuum-time=1s; echo -ne "\033[1;34mAfter\033[0m: "; journalctl --disk-usage'
# If SSH is installed...
if [[ -x "$(command -v ssh)" ]]; then
# Create aliases to start/enable and stop/disable the SSH server
alias sshstatus='systemctl status sshd.service'
alias sshstart='sudo systemctl start sshd.service && sudo systemctl enable sshd.service'
alias sshstop='sudo systemctl stop sshd.service && sudo systemctl disable sshd.service'
alias sshrestart='sudo systemctl restart sshd.service && sudo systemctl enable sshd.service'
fi
# If gpm is installed...
# Link: https://github.com/telmich/gpm
if [[ -x "$(command -v gpm)" ]]; then
alias ttymouseon='sudo systemctl enable --now gpm'
alias ttymouseoff='sudo systemctl stop gpm && sudo systemctl disable gpm'
alias ttymousestatus='sudo systemctl status gpm'
fi
fi
#######################################################
### CHANGING AND LISTING DIRECTORIES
#######################################################
# Aliases for faster pushd and popd: type "p" for pushd and "p-" for popd
# Link: https://opensource.com/article/19/8/navigating-bash-shell-pushd-popd
alias p='pushd'
alias p-='popd'
# Allow us to clear the directory stack
alias dirsclear='dirs -c'
# If you want to see the numeric position of each directory in the stack,
# you can use the -v (vertical) option - as DT suggests, use this by default
alias dirs='dirs -v'
# Alias and bookmark the web folder (try to guess it's location)
# This will NOT overwrite a "web" alias previously definded in .bash_aliases
if [[ "$(type -t web)" != 'alias' ]]; then
if [[ -d /var/www/html ]]; then
alias web='cd /var/www/html'
export web="/var/www/html"
elif [[ -d /srv/http ]]; then
alias web='cd /srv/http'
export web="/srv/http"
fi
fi
# If lsx enhanced directory navigation is found, source it
# Link: https://github.com/souvikinator/lsx
if [[ -f "$HOME/.config/lsx/lsx.sh" ]]; then
source ~/.config/lsx/lsx.sh
fi
# If lsx is installed, alias it to see hidden directories
if [[ -x "$(command -v lsx)" ]]; then
alias lsx='lsx -a'
fi
# If nnn is installed, add an alias for a directory listing
# Link: https://github.com/jarun/nnn/
# The following command installs or updates all plugins:
# Install: curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh
# Plugins are installed to ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins
if [[ -x "$(command -v nnn)" ]]; then
if [[ -f "$HOME/.config/nnn/plugins/finder" ]]; then
export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview'
alias nnnplugins='curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh'
fi
#alias nnn='nnn -e'
alias nnn='nnn -Headr'
fi
# TUIFI Manager
# Link: https://github.com/GiorgosXou/TUIFIManager
# Install: pip3 install tuifimanager --upgrade
if [[ -x "$(command -v tuifi)" ]]; then
alias ff="tuifi"
fi
# List folders recursively in a tree
if [[ -x "$(command -v tree)" ]]; then
alias treed='\tree -CAFd'
fi
# List files recursively in a tree
if [[ -x "$(command -v broot)" ]]; then
# If broot is installed...
# Link: https://github.com/Canop/broot
# Link: https://computingforgeeks.com/broot-easy-directory-trees-navigation-in-linux/
# To generate this source file, type: broot --install
if [[ -f "$HOME/.config/broot/launcher/bash/br" ]]; then
# Source the br function
source "$HOME/.config/broot/launcher/bash/br"
# If Git is installed, enable the Git functionality
if [[ -x "$(command -v git)" ]]; then
alias {lb,tree}='br --sizes --dates --show-root-fs --hidden --show-git-info'
else
alias {lb,tree}='br --sizes --dates --show-root-fs --hidden'