diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d869ee2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +config/git/config/* +!config/git/config/.gitkeep +!config/git/config/README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cae7643 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Dan Anglin + +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. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2db6481 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +check_xdg_settings: + @./helpers/xdg/check-xdg-settings + +.PHONY: ansible_configs +ansible_configs: check_xdg_settings + @./helpers/ansible/generate-ansible-config + +.PHONY: bash_configs +bash_configs: + @./helpers/bash/generate-bash-config + +.PHONY: git_configs +git_configs: check_xdg_settings + @./helpers/git/generate-git-config + +.PHONY: tmux_configs +tmux_configs: check_xdg_settings + @./helpers/tmux/generate-tmux-config + +.PHONY: xdg_configs +xdg_configs: check_xdg_settings + @./helpers/xdg/generate-user-dirs-config + +.PHONY: x11_configs +x11_configs: check_xdg_settings + @./helpers/X11/generate-x11-config + +.PHONY: lf_configs +lf_configs: check_xdg_settings + @./helpers/lf/generate-lf-config + +.PHONY: amfora_configs +amfora_configs: check_xdg_settings + @./helpers/amfora/generate-amfora-config diff --git a/README.md b/README.md index 8da9173..d8d4a93 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # config -The configuration of my home Linux environment. \ No newline at end of file +The configuration of my home Linux environment. diff --git a/config/X11/xinitrc b/config/X11/xinitrc new file mode 100644 index 0000000..2ba8916 --- /dev/null +++ b/config/X11/xinitrc @@ -0,0 +1,2 @@ +nitrogen --restore & +exec dwm diff --git a/config/amfora/config.toml b/config/amfora/config.toml new file mode 100644 index 0000000..bc0dc3d --- /dev/null +++ b/config/amfora/config.toml @@ -0,0 +1,328 @@ +[a-general] +# Press Ctrl-Space to access it +home = "gemini://gemini.circumlunar.space" + +# Follow up to 5 Gemini redirects without prompting. +# A prompt is always shown after the 5th redirect and for redirects to protocols other than Gemini. +# If set to false, a prompt will be shown before following redirects. +auto_redirect = true + +# What command to run to open a HTTP(S) URL. +# Set to "default" to try to guess the browser, or set to "off" to not open HTTP(S) URLs. +# If a command is set, than the URL will be added (in quotes) to the end of the command. +# A space will be prepended to the URL. +# +# The best to define a command is using a string array. +# Examples: +# http = ['firefox'] +# http = ['custom-browser', '--flag', '--option=2'] +# http = ['/path/with spaces/in it/firefox'] +# +# Note the use of single quotes, so that backslashes will not be escaped. +# Using just a string will also work, but it is deprecated, and will degrade if +# you use paths with spaces. +http = ['firefox'] + +# Any URL that will accept a query string can be put here +search = "gemini://geminispace.info/search" + +# Whether colors will be used in the terminal +color = true + +# Whether ANSI color codes from the page content should be rendered +ansi = true + +# Whether to replace list asterisks with unicode bullets +bullets = true + +# Whether to show link after link text +show_link = false + +# A number from 0 to 1, indicating what percentage of the terminal width the left margin should take up. +left_margin = 0.10 + +# The max number of columns to wrap a page's text to. Preformatted blocks are not wrapped. +max_width = 140 + +# 'downloads' is the path to a downloads folder. +# An empty value means the code will find the default downloads folder for your system. +# If the path does not exist it will be created. +# Note the use of single quotes, so that backslashes will not be escaped. +downloads = '' + +# Max size for displayable content in bytes - after that size a download window pops up +page_max_size = 2097152 # 2 MiB + +# Max time it takes to load a page in seconds - after that a download window pops up +page_max_time = 10 + +# Whether to replace tab numbers with emoji favicons, which are cached. +emoji_favicons = true + +# When a scrollbar appears. "never", "auto", and "always" are the only valid values. +# "auto" means the scrollbar only appears when the page is longer than the window. +scrollbar = "never" + + +[auth] +# Authentication settings +# Note the use of single quotes for values, so that backslashes will not be escaped. + +[auth.certs] +# Client certificates +# Set domain name equal to path to client cert +# "example.com" = 'mycert.crt' + +[auth.keys] +# Client certificate keys +# Set domain name equal to path to key for the client cert above +# "example.com" = 'mycert.key' + +[keybindings] +# If you have a non-US keyboard, use bind_tab1 through bind_tab0 to +# setup the shift-number bindings: Eg, for US keyboards (the default): +bind_tab1 = '!' +bind_tab2 = '"' +bind_tab3 = '£' +bind_tab4 = '$' +bind_tab5 = '%' +bind_tab6 = '^' +bind_tab7 = '&' +bind_tab8 = '*' +bind_tab9 = '(' +bind_tab0 = ')' + +# The bind_link[1-90] options are for the commands to go to the first 10 links on a page, +# typically these are bound to the number keys: +bind_link1 = "1" +bind_link2 = "2" +bind_link3 = "3" +bind_link4 = "4" +bind_link5 = "5" +bind_link6 = "6" +bind_link7 = "7" +bind_link8 = "8" +bind_link9 = "9" +bind_link0 = "0" + +bind_bottom = ":" +bind_quit = "Ctrl-Q" +bind_home = "Ctrl-Space" +bind_reload = "Ctrl-R" +bind_back = "H" +bind_forward = "L" +bind_new_tab = "Ctrl-T" +bind_close_tab = "Ctrl-C" +bind_next_tab = "J" +bind_prev_tab = "K" +bind_edit = "e" +bind_bookmarks = "b" +bind_add_bookmark = "B" +bind_save = "Ctrl-S" +bind_help = "F1" +bind_pgup = "PgUp" +bind_pgdn = "PgDn" +# bind_sub: for viewing the subscriptions page +# bind_add_sub + +[url-handlers] +# Allows setting the commands to run for various URL schemes. +# E.g. to open FTP URLs with FileZilla set the following key: +# ftp = 'filezilla' +# You can set any scheme to "off" or "" to disable handling it, or +# just leave the key unset. +# +# DO NOT use this for setting the HTTP command. +# Use the http setting in the "a-general" section above. +# +# NOTE: These settings are overrided by the ones in the proxies section. +# Note the use of single quotes, so that backslashes will not be escaped. + +# This is a special key that defines the handler for all URL schemes for which +# no handler is defined. +other = 'off' + +# [[mediatype-handlers]] section +# --------------------------------- +# +# Specify what applications will open certain media types. +# By default your default application will be used to open the file when you select "Open". +# You only need to configure this section if you want to override your default application, +# or do special things like streaming. +# +# Note the use of single quotes for commands, so that backslashes will not be escaped. +# +# +# To open jpeg files with the feh command: +# +# [[mediatype-handlers]] +# cmd = ['feh'] +# types = ["image/jpeg"] +# +# Each command that you specify must come under its own [[mediatype-handlers]]. You may +# specify as many [[mediatype-handlers]] as you want to setup multiple commands. +# +# If the subtype is omitted then the specified command will be used for the +# entire type: +# +# [[mediatype-handlers]] +# command = ['vlc', '--flag'] +# types = ["audio", "video"] +# +# A catch-all handler can by specified with "*". +# Note that there are already catch-all handlers in place for all OSes, +# that open the file using your default application. This is only if you +# want to override that. +# +# [[mediatype-handlers]] +# cmd = ['some-command'] +# types = [ +# "application/pdf", +# "*", +# ] +# +# You can also choose to stream the data instead of downloading it all before +# opening it. This is especially useful for large video or audio files, as +# well as radio streams, which will never complete. You can do this like so: +# +# [[mediatype-handlers]] +# cmd = ['vlc', '-'] +# types = ["audio", "video"] +# stream = true +# +# This uses vlc to stream all video and audio content. +# By default stream is set to off for all handlers +# +# +# If you want to always open a type in its viewer without the download or open +# prompt appearing, you can add no_prompt = true +# +# [[mediatype-handlers]] +# cmd = ['feh'] +# types = ["image"] +# no_prompt = true +# +# Note: Multiple handlers cannot be defined for the same full media type, but +# still there needs to be an order for which handlers are used. The following +# order applies regardless of the order written in the config: +# +# 1. Full media type: "image/jpeg" +# 2. Just type: "image" +# 3. Catch-all: "*" +[[mediatype-handlers]] +cmd = ['st', '-e', 'mpv', '--no-video'] +types = ["audio"] + +[[mediatype-handlers]] +cmd = ['mpv'] +types = ["video"] + +[[mediatype-handlers]] +cmd = ['feh'] +types = ["image"] +no_prompt = true + +[cache] +# Options for page cache - which is only for text pages +# Increase the cache size to speed up browsing at the expense of memory +# Zero values mean there is no limit + +max_size = 0 # Size in bytes +max_pages = 30 # The maximum number of pages the cache will store + +# How long a page will stay in cache, in seconds. +timeout = 1800 # 30 mins + +[proxies] +# Allows setting a Gemini proxy for different schemes. +# The settings are similar to the url-handlers section above. +# E.g. to open a gopher page by connecting to a Gemini proxy server: +# gopher = "example.com:123" +# +# Port 1965 is assumed if no port is specified. +# +# NOTE: These settings override any external handlers specified in +# the url-handlers section. +# +# Note that HTTP and HTTPS are treated as separate protocols here. + +[subscriptions] +# For tracking feeds and pages + +# Whether a pop-up appears when viewing a potential feed +popup = true + +# How often to check for updates to subscriptions in the background, in seconds. +# Set it to 0 to disable this feature. You can still update individual feeds +# manually, or restart the browser. +# +# Note Amfora will check for updates on browser start no matter what this setting is. +update_interval = 1800 # 30 mins + +# How many subscriptions can be checked at the same time when updating. +# If you have many subscriptions you may want to increase this for faster +# update times. Any value below 1 will be corrected to 1. +workers = 3 + +# The number of subscription updates displayed per page. +entries_per_page = 20 + +[theme] + +# Atom One Dark theme ported to Amfora +# by Serge Tymoshenko +# Link: https://github.com/makeworld-the-better-one/amfora/blob/master/contrib/themes/one_dark.toml + +bg = "#282c34" +fg = "#abb2bf" +tab_num = "#abb2bf" +tab_divider = "#abb2bf" +bottombar_bg = "#abb2bf" +bottombar_text = "#282c34" +bottombar_label = "#282c34" + +hdg_1 = "#e06c75" +hdg_2 = "#c678dd" +hdg_3 = "#c678dd" +amfora_link = "#61afef" +foreign_link = "#56b6c2" +link_number = "#abb2bf" +regular_text = "#abb2bf" +quote_text = "#98c379" +preformatted_text = "#e5c07b" +list_text = "#abb2bf" + +btn_bg = "#282c34" +btn_text = "#abb2bf" + +dl_choice_modal_bg = "#98c379" +dl_choice_modal_text = "#282c34" + +dl_modal_bg = "#98c379" +dl_modal_text = "#282c34" + +info_modal_bg = "#98c379" +info_modal_text = "#282c34" + +error_modal_bg = "#e06c75" +error_modal_text = "#282c34" + +yesno_modal_bg = "#e5c07b" +yesno_modal_text = "#282c34" + +tofu_modal_bg = "#e5c07b" +tofu_modal_text = "#282c34" + +input_modal_bg = "#98c379" +input_modal_text = "#282c34" +input_modal_field_bg = "#282c34" +input_modal_field_text = "#abb2bf" + +bkmk_modal_bg = "#98c379" +bkmk_modal_text = "#282c34" +bkmk_modal_label = "#282c34" +bkmk_modal_field_bg = "#282c34" +bkmk_modal_field_text = "#abb2bf" + +subscription_modal_bg = "#c678dd" +subscription_modal_text = "#282c34" diff --git a/config/ansible/ansible.cfg b/config/ansible/ansible.cfg new file mode 100644 index 0000000..5bc6cbe --- /dev/null +++ b/config/ansible/ansible.cfg @@ -0,0 +1,10 @@ +[defaults] + +nocows = 1 +cow_selection = default +interpreter_python = /usr/bin/python3 + +[persistent_connection] + +connect_timeout = 30 +command_timeout = 60 diff --git a/config/ansible/hosts.yml b/config/ansible/hosts.yml new file mode 100644 index 0000000..3840406 --- /dev/null +++ b/config/ansible/hosts.yml @@ -0,0 +1,5 @@ +--- +all: + hosts: + localhost: + ansible_connection: local diff --git a/config/bash/bash_profile b/config/bash/bash_profile new file mode 100644 index 0000000..3a27f3a --- /dev/null +++ b/config/bash/bash_profile @@ -0,0 +1,5 @@ +[[ -f ~/.bashrc ]] && source ~/.bashrc + +if [[ ! $DISPLAY && $XDG_VTNR && $XDG_VTNR -le 3 ]]; then + exec startx "$XINITRC" +fi diff --git a/config/bash/bashrc b/config/bash/bashrc new file mode 100644 index 0000000..f28b817 --- /dev/null +++ b/config/bash/bashrc @@ -0,0 +1,21 @@ +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# == Add personal bin directory to PATH +if [ -d ${HOME}/.local/bin ]; then + export PATH=${HOME}/.local/bin:${PATH} +fi + +export XDG_CONFIG_HOME=${HOME}/.local/config +export XDG_DATA_HOME=${HOME}/.local/share +export XDG_CACHE_HOME=${HOME}/.local/cache +export XDG_STATE_HOME=${HOME}/.local/state + +# == load all enabled scripts in ~/.bashrc.d +# == any scripts with the .disabled extension won't be loaded +for f in $(find ${XDG_CONFIG_HOME}/bash/bashrc.d -mindepth 1 -maxdepth 1 -type f -not -iname *.disabled | sort); do source $f; done + +# == Run tmux in the default session whenever a terminal session starts +if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then + exec tmux new-session -A -s main +fi diff --git a/config/bash/bashrc.d/X11 b/config/bash/bashrc.d/X11 new file mode 100644 index 0000000..1d8aa87 --- /dev/null +++ b/config/bash/bashrc.d/X11 @@ -0,0 +1,4 @@ +## Description: Bash configuration for X11. +## vim: ft=sh : + +export XINITRC=${XDG_CONFIG_HOME}/X11/xinitrc diff --git a/config/bash/bashrc.d/aliases b/config/bash/bashrc.d/aliases new file mode 100644 index 0000000..79a39d7 --- /dev/null +++ b/config/bash/bashrc.d/aliases @@ -0,0 +1,29 @@ +## Description: All aliases are defined here. +## vim: ft=sh : + +alias ls='ls --color=auto' +alias ll='ls -laF' +alias la='ls -A' +alias l='ls -CF' + +alias rm='rm -i' +alias mv='mv -i' + +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' + +alias systemctl='sudo systemctl' +alias journalctl='sudo journalctl' + +# aliases for pacman +if [[ -x $( command -v pacman ) ]]; then + alias pacman='sudo pacman' + alias pacupdate='sudo pacman -Syu --noconfirm' +fi + +alias tmux="tmux -f ${XDG_CONFIG_HOME}/tmux/tmux.conf" +alias pwgen="pwgen -s -c -n" +alias dc="docker-compose" + +alias vim=nvim diff --git a/config/bash/bashrc.d/ansible b/config/bash/bashrc.d/ansible new file mode 100644 index 0000000..71e1b40 --- /dev/null +++ b/config/bash/bashrc.d/ansible @@ -0,0 +1,7 @@ +## Description: Bash configuration for Ansible. +## vim: ft=sh : + +export ANSIBLE_CONFIG=${XDG_CONFIG_HOME}/ansible/ansible.cfg +export ANSIBLE_INVENTORY=${XDG_CONFIG_HOME}/ansible/hosts.yml +export ANSIBLE_LOCAL_TEMP=${XDG_CACHE_HOME}/ansible +export ANSIBLE_COLLECTIONS_PATH=${XDG_DATA_HOME}/ansible/collections diff --git a/config/bash/bashrc.d/exercism b/config/bash/bashrc.d/exercism new file mode 100644 index 0000000..fe62a5a --- /dev/null +++ b/config/bash/bashrc.d/exercism @@ -0,0 +1,8 @@ +## File: ~/.bashrc.d/exercism +## Description: Bash completion for exercism +## vim: ft=sh : + +# == Bash completion for exercism +if [ -f ${HOME}/.config/exercism/exercism_completion.bash ]; then + source ~/.config/exercism/exercism_completion.bash +fi diff --git a/config/bash/bashrc.d/functions b/config/bash/bashrc.d/functions new file mode 100644 index 0000000..ed14e41 --- /dev/null +++ b/config/bash/bashrc.d/functions @@ -0,0 +1,39 @@ +## Description: All aliases are defined here. +## vim: ft=sh : + +# mkcd creates a new directory (including the parent directories if they don't exist) +# and makes it the current directory. +mkcd() { + mkdir -p $1 + cd $1 +} + +# go_up() navigates up a specified number of parent directories. +# Inspired from DT's up() function: +# https://gitlab.com/dwt1/dotfiles/-/blob/80632c5cad56ac96955e0ca1d582a4b59741bace/.bashrc#L109 +go_up() { + local d="" + local steps="$1" + + if [ -z "$steps" ] || [ "$steps" -lt 1 ]; then + steps=1 + fi + + for ((i=1; i<=steps; i++)); do + d="../$d" + done + + if ! cd "$d"; then + echo "Unable to go up $steps directories." + fi +} + +# run_package_updates() ensures all apt packages are updated +# and runs autoremove to remove any unused packages. +run_package_updates() { + sudo apt update + apt list --upgradable + sleep 5 + sudo apt dist-upgrade + sudo apt autoremove +} diff --git a/config/bash/bashrc.d/git b/config/bash/bashrc.d/git new file mode 100644 index 0000000..55c8e42 --- /dev/null +++ b/config/bash/bashrc.d/git @@ -0,0 +1,10 @@ +## File: ~/.bashrc.d/git +## Description: Bash configuration for Git +## vim: ft=sh : + +if [ -f /usr/share/bash-completion/completions/git ]; then + source /usr/share/bash-completion/completions/git +fi + +alias g="git" +complete -o bashdefault -o default -o nospace -F __git_wrap__git_main g diff --git a/config/bash/bashrc.d/go b/config/bash/bashrc.d/go new file mode 100644 index 0000000..b8a30ae --- /dev/null +++ b/config/bash/bashrc.d/go @@ -0,0 +1,16 @@ +## Description: Bash configuration for the Go setup +## vim: ft=sh : + +if [ -f "${HOME}/.local/software/go/bin/go" ]; then + export GOPATH=${XDG_DATA_HOME}/go + export GOROOT=${HOME}/.local/software/go + export PATH=${PATH}:${GOPATH}/bin + + if ! [ -d "${GOPATH}" ]; then + mkdir ${GOPATH} + fi + + export GOOS=linux + export GOARCH=amd64 + export CGO_ENABLED=0 +fi diff --git a/config/bash/bashrc.d/history b/config/bash/bashrc.d/history new file mode 100644 index 0000000..78113eb --- /dev/null +++ b/config/bash/bashrc.d/history @@ -0,0 +1,21 @@ +## File: ~/.bashrc.d/history +## Description: Configuration for Bash history +## vim: ft=sh : + +# The name of the history file. +HISTFILE=${XDG_DATA_HOME}/bash/history + +# Don't put duplicate lines or lines starting with space in the history. +HISTCONTROL=ignoreboth + +# The maximum number of lines in the history file. +HISTFILESIZE=10000 + +# The number of commands to remember in the command history. +HISTSIZE=1000 + +# Display the timestamp of each command in history using the below format. +HISTTIMEFORMAT="%d/%m/%y %T: " + +# Append to the history file, don't overwrite it. +shopt -s histappend diff --git a/config/bash/bashrc.d/kubectl b/config/bash/bashrc.d/kubectl new file mode 100644 index 0000000..60ec097 --- /dev/null +++ b/config/bash/bashrc.d/kubectl @@ -0,0 +1,9 @@ +## Description: Bash settings for kubectl +## vim: ft=sh : +export KUBECONFIG=${XDG_CONFIG_HOME}/kube/config + +if [ -x "$( command -v kubectl )" ]; then + source <(kubectl completion bash) + alias k='kubectl' + complete -F __start_kubectl k +fi diff --git a/config/bash/bashrc.d/lf b/config/bash/bashrc.d/lf new file mode 100644 index 0000000..2945ea5 --- /dev/null +++ b/config/bash/bashrc.d/lf @@ -0,0 +1,16 @@ +#!/bin/bash + +lf () { + tmp="$(mktemp)" + + command lf --last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" + if [ -d "$dir" ]; then + if [ "$dir" != "$(pwd)" ]; then + cd "$dir" + fi + fi + fi +} diff --git a/config/bash/bashrc.d/local_software b/config/bash/bashrc.d/local_software new file mode 100644 index 0000000..8aea101 --- /dev/null +++ b/config/bash/bashrc.d/local_software @@ -0,0 +1,9 @@ +if [[ -d "$HOME/.local/software" ]]; then + for dir in ${HOME}/.local/software/*; do + dir=${dir:A} + if [[ -d "$dir/bin" ]]; then + export PATH="$dir/bin:$PATH" + fi + done +fi +unset dir diff --git a/config/bash/bashrc.d/misc b/config/bash/bashrc.d/misc new file mode 100644 index 0000000..c1273b9 --- /dev/null +++ b/config/bash/bashrc.d/misc @@ -0,0 +1,21 @@ +## Description: Bash configuration where we can't categorize anywhere else. +## vim: ft=sh : + +export BROWSER=firefox +export EDITOR=nvim +export TERMINAL=st +export LANG=en_GB.UTF-8 +export MANPAGER="nvim -c 'set ft=man' -" + +# == vi mode in Bash +set -o vi + +# == make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# == ensure that programmable completion features are enabled. +if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion +elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion +fi diff --git a/config/bash/bashrc.d/pass b/config/bash/bashrc.d/pass new file mode 100644 index 0000000..fbd244e --- /dev/null +++ b/config/bash/bashrc.d/pass @@ -0,0 +1,9 @@ +## Description: Bash configuration for pass +## vim: ft=sh : + +export PASSWORD_STORE_DIR=${XDG_DATA_HOME}/pass + +if ! [ -d "${PASSWORD_STORE_DIR}" ]; then + mkdir ${PASSWORD_STORE_DIR} + chmod 0700 ${PASSWORD_STORE_DIR} +fi diff --git a/config/bash/bashrc.d/prompt b/config/bash/bashrc.d/prompt new file mode 100644 index 0000000..91d0d88 --- /dev/null +++ b/config/bash/bashrc.d/prompt @@ -0,0 +1,32 @@ +## File: ~/.bashrc.d/prompt +## Description: Configuration for the Bash prompt +## vim: ft=sh : + +get_date() { + date '+%d.%m.%Y' +} + +if [ -f /usr/share/git/completion/git-prompt.sh ]; then + source /usr/share/git/completion/git-prompt.sh +elif [ -f /usr/share/git/git-prompt.sh ]; then + source /usr/share/git/git-prompt.sh +elif [ -f /usr/lib/git-core/git-sh-prompt ]; then + source /usr/lib/git-core/git-sh-prompt +elif [ -f /etc/bash_completion.d/git-prompt ]; then + source /etc/bash_completion.d/git-prompt +elif [ -f ${HOME}/.git-prompt ]; then + source ${HOME}/.git-prompt +fi + +GIT_PS1_SHOWDIRTYSTATE="true" +GIT_PS1_SHOWUPSTREAM="auto" +GIT_PS1_STATESEPARATOR=": " + +DATE_BG="$(tput setab 68)" +GREY_BG="$(tput setab 240)" +RESET="$(tput sgr0)" +FILEPATH_TC="$(tput setaf 81)" +WHITE_TC="$(tput setaf 255)" +GREEN_TC="$(tput setaf 2)" +PS1='${DATE_BG}${WHITE_TC}$(get_date) ${GREY_BG} \u • ${FILEPATH_TC}\033[1m\w ${RESET} ${GREEN_TC}\033[3m$(__git_ps1 "git:(%s)")${RESET}\n\$ ' +PS2=" -> " diff --git a/config/bash/bashrc.d/vault b/config/bash/bashrc.d/vault new file mode 100644 index 0000000..38beb89 --- /dev/null +++ b/config/bash/bashrc.d/vault @@ -0,0 +1,8 @@ +## File: ~/.bashrc.d/vault +## Description: Bash configuration for vault setup. +## vim: ft=sh : + +# bash autocompletion for vault +if [ -f "${HOME}/.local/bin/vault" ]; then + complete -C /home/dananglin/.local/bin/vault vault +fi diff --git a/config/git/gitconfig b/config/git/gitconfig new file mode 100644 index 0000000..4ea6e79 --- /dev/null +++ b/config/git/gitconfig @@ -0,0 +1,36 @@ +[alias] + br = branch + cm = commit + co = checkout + df = diff + gr = log --all --graph --decorate --format=format:'%C(bold "#62ccff")%h%C(reset) %C(bold "#fa9c43")(%ai)%C(reset) %C(auto)%d%C(reset)%n%C(italic "#929292")%an:%C(reset) %C("#ffffff")%s%C(reset)%n' + # mr allows you to checkout a merge request locally. + # $1 is the name of the remote + # $2 is the ID of the merge request + # e.g. git mr origin 3 + # e.g. git mr upstream 5 + mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' - + pl = pull + ps = push + sr = reset --soft + st = status + up = !sh -c 'git checkout $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') && git fetch --all && git pull origin $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')' +[commit] + gpgsign = true + template = $gitmessage_output +[core] + excludesFile = $gitignore_output +[diff] + tool = vimdiff +[fetch] + prune = true +[gpg] + program = gpg2 +[pull] + rebase = false +[user] + email = $git_user_email + name = $git_user_name + signingkey = $git_user_signingkey +[init] + defaultBranch = main diff --git a/config/git/gitignore b/config/git/gitignore new file mode 100644 index 0000000..5dca9c5 --- /dev/null +++ b/config/git/gitignore @@ -0,0 +1,6 @@ +/tags +/notes/* +/tmp/* + +library/__pycache__/ +library/*.pyc diff --git a/config/git/gitmessage b/config/git/gitmessage new file mode 100644 index 0000000..1ad2cce --- /dev/null +++ b/config/git/gitmessage @@ -0,0 +1,34 @@ + + +# (): +# +# +# +#