Compare commits
4 Commits
updates
...
blesh-time
| Author | SHA1 | Date | |
|---|---|---|---|
| b0a87fb014 | |||
| 6e0d969d78 | |||
| 84018dbeec | |||
| e85e4bb65d |
28
.bash.d/.bash_aliases
Normal file
28
.bash.d/.bash_aliases
Normal file
@@ -0,0 +1,28 @@
|
||||
alias ,git='git config --global user.name "Shaun Reed" && git config --global user.email "shaunrd0@gmail.com"'
|
||||
# Some aliases don't make sense in the docker image, like shortcuts to fix plasmashell.
|
||||
if [ -f /.dockerenv ]; then
|
||||
alias ,update='apt update -y && apt upgrade -y && apt upgrade --fix-broken --fix-missing --auto-remove'
|
||||
alias ,init='apt update -y && apt install -y $DOT_PACKAGES'
|
||||
alias ,swap='swapoff -a && swapon -a'
|
||||
else
|
||||
alias ,update='sudo apt update -y && sudo apt upgrade -y && sudo apt upgrade --fix-broken --fix-missing --auto-remove'
|
||||
alias ,init='sudo apt update -y && sudo apt install -y $DOT_PACKAGES'
|
||||
# Clear kscreen cached settings
|
||||
alias ,kscreen='rm -rf ~/.local/share/kscreen/*'
|
||||
# Restart plasmashell
|
||||
alias ,plasmashell='plasmashell --replace &> /dev/null &'
|
||||
alias ,swap='sudo swapoff -a && sudo swapon -a'
|
||||
alias ,vbox="ps aux www |grep 'VBoxClient --draganddrop' | awk '{print $2}' | xargs kill"
|
||||
fi
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
|
||||
# Don't use tmux in vscode to avoid 'failure to resolve shell' errors.
|
||||
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
|
||||
if ! pstree -s $$ | grep -wq code; then
|
||||
exec tmux >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,34 +1,14 @@
|
||||
# Source rust things if they exist
|
||||
if [ -f ~/.cargo/env ]; then
|
||||
. ~/.cargo/env
|
||||
fi
|
||||
|
||||
alias ,git='git config --global user.name "Shaun Reed" && git config --global user.email "shaunrd0@gmail.com"'
|
||||
# Some aliases don't make sense in the docker image, like shortcuts to fix plasmashell.
|
||||
# Used in setup script and dockerfile.
|
||||
if [ -f /.dockerenv ]; then
|
||||
export DOT_PACKAGES='git stow vim tmux ranger clang wget curl golang-go'
|
||||
alias ,update='apt update -y && apt upgrade -y && apt upgrade --fix-broken --fix-missing --auto-remove'
|
||||
alias ,init='apt update -y && apt install -y $DOT_PACKAGES'
|
||||
alias ,swap='swapoff -a && swapon -a'
|
||||
else
|
||||
export DOT_PACKAGES='git stow vim vim-gtk3 xsel xclip tmux ranger clang yakuake wget curl golang-go'
|
||||
alias ,update='sudo apt update -y && sudo apt upgrade -y && sudo apt upgrade --fix-broken --fix-missing --auto-remove'
|
||||
alias ,init='sudo apt update -y && sudo apt install -y $DOT_PACKAGES'
|
||||
# Clear kscreen cached settings
|
||||
alias ,kscreen='rm -rf ~/.local/share/kscreen/*'
|
||||
# Restart plasmashell
|
||||
alias ,plasmashell='plasmashell --replace &> /dev/null &'
|
||||
alias ,swap='sudo swapoff -a && sudo swapon -a'
|
||||
alias ,vbox="ps aux www |grep 'VBoxClient --draganddrop' | awk '{print $2}' | xargs kill"
|
||||
alias ,assistant="nohup $HOME/Qt/6.9.0/gcc_64/bin/assistant > /dev/null 2>&1 &"
|
||||
# `vim-gtk3` is required to keep your system copy and paste buffers in sync with vim registers.
|
||||
export DOT_PACKAGES='git stow vim vim-gtk3 xsel xclip tmux ranger clang yakuake wget curl golang-go gawk'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||
export EDITOR="vim"
|
||||
export VISUAL="vim"
|
||||
export LS_COLORS="di=1;34:ln=31;47:so=32:pi=33:ex=1;32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
|
||||
@@ -38,17 +18,6 @@ export DOTNET_ROOT=$HOME/.dotnet
|
||||
# Example path for autocompletion using libclang-9-dev package, obtained by the following command
|
||||
export LIBCLANG="$(command -v clang &>/dev/null && ldconfig -p | sort | grep libclang-[0-9]. | awk -F "> " '{print$2}' | tail -n 1)"
|
||||
|
||||
# Source a top-secret alias file
|
||||
if [ -e ~/.bash_secrets ]; then
|
||||
. ~/.bash_secrets
|
||||
fi
|
||||
|
||||
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
|
||||
if ! pstree -s $$ | grep -wq code; then
|
||||
exec tmux >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set the default terminal to use konsole, with kapper profile
|
||||
# + Execute tmux on start
|
||||
if [ -e ~/.local/share/konsole/kapper.profile ]; then
|
||||
@@ -93,15 +62,6 @@ export LESS='--mouse --wheel-lines 2'
|
||||
# + -#2 to shift 2 columns horizontally when right / left arrow is pressed
|
||||
export LESS="$LESS -R -w -#2"
|
||||
|
||||
|
||||
if ! [ command -v conda &>/dev/null ] && [ -e ~/Code/Clones/mambaforge/bin/conda ] && ! grep -e conda ~/.bashrc &>/dev/null; then
|
||||
if ! (~/Code/Clones/mambaforge/bin/conda init | awk -F "==>" '{print $1}'); then
|
||||
echo "[dot] ERROR: Failed to initialize Conda."
|
||||
fi
|
||||
echo "[dot] WARN: Ran \`conda init\`; Conda was installed but not initialized"
|
||||
source ~/.bashrc
|
||||
fi
|
||||
|
||||
# For shared systems where history is not desired.
|
||||
# ln -sf /dev/null ~/.bash_history
|
||||
# HISTFILE=/dev/null
|
||||
8
.bash.d/.bash_functions
Normal file
8
.bash.d/.bash_functions
Normal file
@@ -0,0 +1,8 @@
|
||||
# $1: Version; defaults to 6.7.3
|
||||
# $2: Path to Qt; defaults to $HOME/Qt
|
||||
function assistant {
|
||||
local version=${1:-6\.7\.3}
|
||||
local path=${2:-$HOME/Qt}
|
||||
nohup ${path%/}/$version/gcc_64/bin/assistant > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
15
.bash.d/.bash_sources
Normal file
15
.bash.d/.bash_sources
Normal file
@@ -0,0 +1,15 @@
|
||||
# Source ble.sh if installed.
|
||||
if [ -f ~/.local/share/blesh/ble.sh ]; then
|
||||
source -- ~/.local/share/blesh/ble.sh
|
||||
fi
|
||||
|
||||
# Source rust things if they exist
|
||||
if [ -f ~/.cargo/env ]; then
|
||||
. ~/.cargo/env
|
||||
fi
|
||||
|
||||
# Source a top-secret alias file
|
||||
if [ -f ~/.bash.d/.bash_secrets ]; then
|
||||
. ~/.bash.d/.bash_secrets
|
||||
fi
|
||||
|
||||
11
.bashrc
11
.bashrc
@@ -100,11 +100,20 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# Source all files in ~/.bash.d, if it exists.
|
||||
# This can contain .bash_aliases, or other configs to append to your shell.
|
||||
if [ -d ~/.bash.d ]; then
|
||||
for f in ~/.bash.d/.*; do
|
||||
if [ -f $f ]; then
|
||||
. $f
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
|
||||
71
.blerc
Normal file
71
.blerc
Normal file
@@ -0,0 +1,71 @@
|
||||
# Insert date-time string within a bash prompt using `\dt<SP>`
|
||||
function blerc/define-sabbrev-dt {
|
||||
ble-sabbrev -m '\dt'='ble/util/assign COMPREPLY "date +%F_%H-%M-%S"'
|
||||
}
|
||||
blehook/eval-after-load complete blerc/define-sabbrev-dt
|
||||
|
||||
# Insert the time within a bash prompt using `\time<SP>`
|
||||
function blerc/define-sabbrev-time {
|
||||
ble-sabbrev -m '\time'='ble/util/assign COMPREPLY "date +%H-%M-%S"'
|
||||
}
|
||||
blehook/eval-after-load complete blerc/define-sabbrev-time
|
||||
|
||||
# Insert the date within a bash prompt using `\date<SP>`
|
||||
# https://github.com/akinomyoga/ble.sh/wiki/Recipes#r1-insert-date-through-sabbrev-date
|
||||
function blerc/define-sabbrev-date {
|
||||
ble-sabbrev -m '\date'='ble/util/assign COMPREPLY "date +%F"'
|
||||
}
|
||||
blehook/eval-after-load complete blerc/define-sabbrev-date
|
||||
|
||||
# Interactive git branch selection with `\branch<SP>`
|
||||
# https://github.com/akinomyoga/ble.sh/wiki/Recipes#r2-insert-git-branch-name-from-menu-through-sabbrev-branch
|
||||
function blerc/define-sabbrev-branch {
|
||||
function blerc/sabbrev-git-branch {
|
||||
ble/util/assign-array COMPREPLY "git branch | sed 's/^\*\{0,1\}[[:blank:]]*//'" 2>/dev/null
|
||||
}
|
||||
ble-sabbrev -m '\branch'=blerc/sabbrev-git-branch
|
||||
}
|
||||
blehook/eval-after-load complete blerc/define-sabbrev-branch
|
||||
|
||||
# Interactive git commit selection with `\commit<SP>`
|
||||
# https://github.com/akinomyoga/ble.sh/wiki/Recipes#r3-insert-git-commit-id-from-menu-through-sabbrev-commit
|
||||
function blerc/define-sabbrev-commit {
|
||||
ble/color/defface blerc_git_commit_id fg=63
|
||||
ble/complete/action#inherit-from blerc_git_commit_id word
|
||||
function ble/complete/action:blerc_git_commit_id/init-menu-item {
|
||||
local ret
|
||||
ble/color/face2g blerc_git_commit_id; g=$ret
|
||||
}
|
||||
function blerc/sabbrev-git-commit {
|
||||
bleopt sabbrev_menu_style=desc-raw
|
||||
bleopt sabbrev_menu_opts=enter_menu
|
||||
|
||||
local format=$'%h \e[1;32m(%ar)\e[m %s - \e[4m%an\e[m\e[1;33m%d\e[m'
|
||||
local arr; ble/util/assign-array arr 'git log --pretty=format:"$format"' &>/dev/null
|
||||
local line hash subject
|
||||
for line in "${arr[@]}"; do
|
||||
builtin read hash subject <<< "$line"
|
||||
ble/complete/cand/yield blerc_git_commit_id "$hash" "$subject"
|
||||
done
|
||||
}
|
||||
ble-sabbrev -m '\commit'='blerc/sabbrev-git-commit'
|
||||
}
|
||||
blehook/eval-after-load complete blerc/define-sabbrev-commit
|
||||
|
||||
# Show the timestamp aligned to the right after each command is entered.
|
||||
show_timestamp() {
|
||||
# 17:10:00 EST-05
|
||||
local ts="$(date +'%H:%M:%S %Z%:::z')"
|
||||
# Column to show timestamp.(COLUMNS - length_of_timestamp)
|
||||
local col=$((COLUMNS - ${#ts}))
|
||||
# Save current cursor position.
|
||||
printf '\033[s'
|
||||
# Move cursor to desired column.
|
||||
printf "\033[${col}G"
|
||||
# Print timestamp in gray.
|
||||
printf '\e[90m%s\e[0m' "$ts"
|
||||
# Restore previous cursor position.
|
||||
printf '\033[u'
|
||||
}
|
||||
|
||||
blehook PREEXEC=show_timestamp
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
.bash_secrets
|
||||
**/.bash_secrets
|
||||
.vim/.netrwhist
|
||||
.idea/
|
||||
.config/Code/Backups/*
|
||||
@@ -13,6 +13,9 @@
|
||||
.config/Code/rapid_render.json
|
||||
.config/Code/Network*
|
||||
**/.config/.brightness
|
||||
.local/share/fonts/.uuid
|
||||
.local/share/blesh
|
||||
.local/share/doc
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
*__pycache__/
|
||||
|
||||
6
.inputrc
6
.inputrc
@@ -1,2 +1,4 @@
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
# This will automatically trigger reverse search when using up / down in bash
|
||||
# However it doesn't feel natural with ble.sh, so it's commented out for now.
|
||||
#"\e[A": history-search-backward
|
||||
#"\e[B": history-search-forward
|
||||
|
||||
@@ -16,6 +16,9 @@ set -g @scroll-speed-num-lines-per-scroll 2
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'tmux-plugins/tmux-yank'
|
||||
set -g @yank_action 'copy-pipe-no-clear'
|
||||
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
||||
set -g @plugin 'tmux-plugins/tmux-continuum'
|
||||
set -g @continuum-restore 'on'
|
||||
bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
|
||||
bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
|
||||
# Other examples:
|
||||
|
||||
Submodule .vim/bundle/clang_complete updated: 293a106227...75946deff4
88
README.md
88
README.md
@@ -1,16 +1,20 @@
|
||||
## Dotfiles
|
||||
|
||||
Dotfiles configurations for headless Kubuntu linux environments. Be sure to clone recursively if you want to grab updated plugins / submodules included. For example, using Pathogen with Vim to manage plugins requires that the plugin to be installed are cloned to the `~/.vim/bundle/` directory. Cloning recursively allows git to clone these same nested repositories/submodules within this directory so Pathogen can handle running the Vim plugins.
|
||||
Dotfiles configurations for Kubuntu linux environments. Be sure to
|
||||
clone recursively if you want to grab updated plugins / submodules included. For
|
||||
example, using Pathogen with Vim to manage plugins requires that the plugin to
|
||||
be installed are cloned to the `~/.vim/bundle/` directory. Cloning recursively
|
||||
allows git to clone these same nested repositories/submodules within this
|
||||
directory so Pathogen can handle running the Vim plugins.
|
||||
|
||||
Once installed, editing source code in vim supports features displayed in the screenshot below
|
||||
Once installed, editing source code in vim supports features displayed in the
|
||||
screenshot below
|
||||
|
||||

|
||||
|
||||
### Install
|
||||
|
||||
If you don't install `vim-gtk3`, vim will not have access to your system clipboard, and your copy and paste buffers will not stay in sync.
|
||||
|
||||
Installation instructions -
|
||||
Installation instructions
|
||||
|
||||
```bash
|
||||
git clone --recursive https://github.com/shaunrd0/dot
|
||||
@@ -20,19 +24,18 @@ mv ~/.bashrc ~/.bashrc.backup
|
||||
stow . -t ~
|
||||
```
|
||||
|
||||
If you forget to clone recursively
|
||||
To uninstall
|
||||
|
||||
```bash
|
||||
git submodule update --init
|
||||
Submodule path '.vim/bundle/Colorizer': checked out '53ada285f0acc171acda4280b6144e468dded89f'
|
||||
Submodule path '.vim/bundle/ale': checked out '7265ceb6d050d1a4642741d248f11e4f2abd37e1'
|
||||
Submodule path '.vim/bundle/clang_complete': checked out '0b98d7533ad967aac3fc4c1a5b0508dafa8a676f'
|
||||
Submodule path '.vim/bundle/supertab': checked out '40fe711e088e2ab346738233dd5adbb1be355172'
|
||||
Submodule path '.vim/bundle/unicode.vim': checked out '29f43f7b1be94dccfac461f4da0a34410408111f'
|
||||
Submodule path '.vim/bundle/vim-airline': checked out '6d665580a3435f21ad560af192d854d4b608fff5'
|
||||
Submodule path '.vim/bundle/vim-airline-themes': checked out '0d5c5c1e2995126e76606a628316c8e3f5efb37a'
|
||||
Submodule path '.vim/bundle/vim-signify': checked out '16eee41d2b267523b84bd4ac111627588bfd1a47'
|
||||
stow -D . -t ~
|
||||
mv ~/.bashrc.backup ~/.bashrc
|
||||
```
|
||||
|
||||
If you have files other than `~/.bashrc` that conflict with these
|
||||
configurations,
|
||||
be sure to back them up so you can restore to your original state. If you do not
|
||||
provide the `-t` flag to stow, the files will be symlinked within the parent
|
||||
of your current directory.
|
||||
|
||||
### Docker
|
||||
|
||||
@@ -45,33 +48,42 @@ docker build -t dot .
|
||||
docker run -it dot bash
|
||||
```
|
||||
|
||||
This container has the following packages installed and uses `ubuntu:latest` as a base.
|
||||
Note that some features may not work properly in the container, like system
|
||||
clipboard integration with vim or certain font icons used in themes. Still, the
|
||||
base configurations work, and using the container as a clean environment is
|
||||
useful for testing things such as installation instructions for a personal
|
||||
project.
|
||||
|
||||
```
|
||||
git stow vim tmux ranger clang wget curl golang-go
|
||||
```
|
||||
### Configurations
|
||||
|
||||
#### Utilities
|
||||
|
||||
### Install Clang Completion
|
||||
| Tool | Description | Repository |
|
||||
|----------------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
|
||||
| ranger | Console-based file manager with Vim-like keybindings, previews, and customizable commands. | [https://github.com/ranger/ranger](https://github.com/ranger/ranger) |
|
||||
| ble.sh | Advanced Bash line editor providing syntax highlighting, autosuggestions, and improved interactive shell behavior. | [https://github.com/akinomyoga/ble.sh](https://github.com/akinomyoga/ble.sh) |
|
||||
| GNU Stow | Manages dotfiles using symlinks. Repository structure is organized for per-package Stow deployment. | [https://www.gnu.org/software/stow/](https://www.gnu.org/software/stow/) |
|
||||
| `.stow-local-ignore` | Stow configuration file that excludes specific files or patterns from being symlinked during deployment. | [https://www.gnu.org/software/stow/manual/stow.html](https://www.gnu.org/software/stow/manual/stow.html) |
|
||||
| `setup.sh` | Bootstrap script that automates symlink setup and environment initialization. | (Repository-local script) |
|
||||
|
||||
**These configurations require the installation of clang for clang completion**
|
||||
#### Tmux
|
||||
|
||||
If you don't want clang completion, just remove the plugin directory from `~/.vim/bundle/`.
|
||||
| Plugin | Description | Repository |
|
||||
|---------------------|--------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
|
||||
| tmux plugin manager | Manages tmux plugins directly from GitHub. | [https://github.com/tmux-plugins/tpm](https://github.com/tmux-plugins/tpm) |
|
||||
| tmux-resurrect | Saves and restores tmux sessions, panes, and layouts between restarts. | [https://github.com/tmux-plugins/tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect) |
|
||||
| tmux-continuum | Automatically saves tmux sessions and can restore them on system reboot. | [https://github.com/tmux-plugins/tmux-continuum](https://github.com/tmux-plugins/tmux-continuum) |
|
||||
| xclip | Integrates tmux copy mode with the system clipboard under X11. | [https://github.com/astrand/xclip](https://github.com/astrand/xclip) |
|
||||
|
||||
If you don't remove clang completion and skip the following steps, vim will show errors when opening source code files. This is because these configurations use clang completion for source code auto completion and drop-down menus within vim.
|
||||
|
||||
```bash
|
||||
sudo apt install clang
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
|
||||
### Gitmux
|
||||
|
||||
To enable the gitmux status bar in tmux sessions
|
||||
|
||||
```bash
|
||||
sudo apt install golang-go
|
||||
go install github.com/arl/gitmux@latest
|
||||
```
|
||||
#### Vim
|
||||
|
||||
| Plugin | Description | Repository |
|
||||
|--------------------|--------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
|
||||
| Colorizer | Highlights color codes in Vim buffers (useful for CSS/ web). | [https://github.com/chrisbra/Colorizer](https://github.com/chrisbra/Colorizer) |
|
||||
| ALE | Asynchronous Lint Engine - linting & fixing in Vim asynchronously. | [https://github.com/dense-analysis/ale](https://github.com/dense-analysis/ale) |
|
||||
| clang_complete | Auto-completion support for C/C++ using libclang. | [https://github.com/xavierd/clang_complete](https://github.com/xavierd/clang_complete) |
|
||||
| supertab | Expand completions using `<Tab>` in insert mode. | [https://github.com/ervandew/supertab](https://github.com/ervandew/supertab) |
|
||||
| unicode.vim | Unicode helpers (insert and inspect Unicode characters). | [https://github.com/chrisbra/unicode.vim](https://github.com/chrisbra/unicode.vim) |
|
||||
| vim-airline | Lean and fast status/tabline for Vim. | [https://github.com/vim-airline/vim-airline](https://github.com/vim-airline/vim-airline) |
|
||||
| vim-airline-themes | Additional themes for vim-airline. | [https://github.com/vim-airline/vim-airline-themes](https://github.com/vim-airline/vim-airline-themes) |
|
||||
| vim-signify | Shows VCS (git/hg) changes in the sign column. | [https://github.com/mhinz/vim-signify](https://github.com/mhinz/vim-signify) |
|
||||
|
||||
35
setup.sh
35
setup.sh
@@ -1,6 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
git submodule update --init
|
||||
set -Eeuo pipefail
|
||||
|
||||
# $1: Error message
|
||||
# $2: Error code
|
||||
# $3: Error line
|
||||
function fatal() {
|
||||
local msg=${1:-"Unspecified error"}
|
||||
local line=${3:-9}
|
||||
echo "[Error:$line] Could not install dotfiles: $msg"
|
||||
exit ${2:-1}
|
||||
}
|
||||
trap 'fatal "Trapped an unknown error" $? $LINENO' ERR
|
||||
|
||||
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
fatal "Run setup.sh from the root directory of the dotfiles repository." 2 $LINENO
|
||||
fi
|
||||
git submodule update --init --recursive
|
||||
|
||||
# Use alias for installing packages so we don't maintain several dependency lists.
|
||||
. .bash_aliases
|
||||
,init
|
||||
if ! [[ -f .bash.d/.bash_exports ]]; then
|
||||
fatal "Failed to locate .bash.d/.bash_exports in path: $(pwd)" 3 $LINENO
|
||||
fi
|
||||
. .bash.d/.bash_exports
|
||||
|
||||
if [[ -z ${DOT_PACKAGES:-} ]]; then
|
||||
fatal "DOT_PACKAGES variable not found after sourcing $(pwd)/.bash.d/.bash_aliases" 4 $LINENO
|
||||
fi
|
||||
sudo apt update -y && sudo apt install -y $DOT_PACKAGES
|
||||
go install github.com/arl/gitmux@latest
|
||||
|
||||
# Install bash line editor for auto completion.
|
||||
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
|
||||
make -C ble.sh install PREFIX=$(pwd)/.local
|
||||
rm -rf ble.sh
|
||||
|
||||
Reference in New Issue
Block a user