fixing merge

This commit is contained in:
Andrew Davidson 2023-01-11 09:26:59 -08:00
commit cc212353d2
11 changed files with 127 additions and 350 deletions

View file

@ -20,9 +20,8 @@ These are generic dotfiles intended for use across any platform.
Following the best practices of the local platform install `git` and `stow`.
```
$ git clone ssh://git@gitlab.com/amdavidson/dotfiles.git $HOME/.dotfiles
$ git clone git@git.sr.ht:~amdavidson/dotfiles $HOME/.dotfiles
$ cd $HOME/.dotfiles
$ ./update.sh
$ stow {scripts,bash,git,tmux,vim}
```

View file

@ -1,4 +1,51 @@
### @amdavidson's bashrc
### Andrew's .bashrc
# _ _
# ___ _ ____ _(_)_ __ ___ _ __ _ __ ___ ___ _ __ | |_
# / _ \ '_ \ \ / / | '__/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __|
# | __/ | | \ V /| | | | (_) | | | | | | | | | __/ | | | |_
# \___|_| |_|\_/ |_|_| \___/|_| |_|_| |_| |_|\___|_| |_|\__|
# Set some defaults.
export EDITOR="nvim"
export PATH=".:~/bin:~/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
# checks (stolen from zshuery)
if [[ $(uname) = 'Linux' ]]; then
IS_LINUX=1
fi
if [[ $(uname) = 'Darwin' ]]; then
IS_MAC=1
fi
if [[ -x `which brew >/dev/null 2>&1` ]]; then
HAS_BREW=1
fi
if [[ -x `which apt-get >/dev/null 2>&1` ]]; then
HAS_APT=1
fi
if [[ -x `which yum >/dev/null 2>&1` ]]; then
HAS_YUM=1
fi
# _
# _ __ _ __ ___ _ __ ___ _ __ | |_
# | '_ \| '__/ _ \| '_ ` _ \| '_ \| __|
# | |_) | | | (_) | | | | | | |_) | |_
# | .__/|_| \___/|_| |_| |_| .__/ \__|
# |_| |_|
# define useful aliases for color codes
sh_norm="\[\033[0m\]"
@ -19,15 +66,8 @@ sh_yellow="\[\033[1;33m\]"
sh_light_gray="\[\033[0;37m\]"
sh_white="\[\033[1;37m\]"
# Set some defaults.
export GOPATH="$HOME/go"
export EDITOR="nvim"
export PATH=".:$GOPATH/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:~/bin"
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
export DOTFILES_DIR=$HOME'/.dotfiles'
# Make a pretty prompt.
export PROMPT_COMMAND='history -a; if [ $? -ne 0 ];then ERROR_FLAG=1;else ERROR_FLAG=;fi;$DOTFILES_DIR/check_update.sh'
export PROMPT_COMMAND='history -a; if [ $? -ne 0 ];then ERROR_FLAG=1;else ERROR_FLAG=;fi;'
export PS1=${HOSTCOLOUR}${sh_light_gray}'\t | \h'${sh_green}':\w'${sh_light_gray}' '${sh_light_gray}'${ERROR_FLAG:+'${sh_light_red}'}\$ '${sh_norm}
# New files and folders should not be world readable
@ -41,6 +81,17 @@ PROMPT_DIRTRIM=2
# Update window size after every command
shopt -s checkwinsize
# _ _ _
# | |__ (_)___| |_ ___ _ __ _ _
# | '_ \| / __| __/ _ \| '__| | | |
# | | | | \__ \ || (_) | | | |_| |
# |_| |_|_|___/\__\___/|_| \__, |
# |___/
# Append history don't overwrite
shopt -s histappend
@ -58,12 +109,16 @@ HISTSIZE=500000
HISTFILESIZE=100000
# Aliases!
# _ _
# __ _| (_) __ _ ___ ___ ___
# / _` | | |/ _` / __|/ _ \/ __|
# | (_| | | | (_| \__ \ __/\__ \
# \__,_|_|_|\__,_|___/\___||___/
# jump down the tree.
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
# empty the screen (or use C-l)
alias c="clear"
@ -77,13 +132,6 @@ alias e="exit"
# grep shortie
alias g="grep --color=auto -i "
# get shortcuts.
alias ga="git add"
alias gc="git commit"
alias gd="git diff"
alias gp="git push"
alias gs="git status"
# shorter ls
alias l="ls -G"
@ -96,9 +144,6 @@ alias la="ls -alh"
# List directories.
alias ld="ls -Gd */"
# Find out what connections are happening.
alias lsconn="sudo lsof -i -P"
# add some color to grep.
alias grep="grep --color=auto"
@ -109,7 +154,7 @@ alias mkdir="mkdir -p -v "
#alias ping="ping -c5"
# refresh the shell customizations without opening a new one.
alias refresh="source ~/.bashrc"
alias refresh="source ~/.bashrc && hash -r"
# A python calculator
alias pc='python -ic "from __future__ import division; from math import *"'
@ -117,12 +162,24 @@ alias pc='python -ic "from __future__ import division; from math import *"'
# Start nano with line numbering no wrapping and autoindenting
alias nano='nano -ciw '
if [[ $(uname) = 'Darwin' ]]; then
# Open man file in Preview.app.
pman () {
man -t "${1}" | open -f -a /Applications/Preview.app
}
fi
# shortcut for tmux command
alias tm="tmux new-session -A -s main"
# always use nvim
alias vim='nvim'
alias vi='nvim'
alias nv='nvim'
# __ _ _
# / _|_ _ _ __ ___| |_(_) ___ _ __ ___
# | |_| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
# | _| |_| | | | | (__| |_| | (_) | | | \__ \
# |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
# General purpose extract command.
extract () {
@ -152,60 +209,45 @@ extract () {
# General purpose backup command.
bu () { tar czf ~/.backup/`basename $1`-`date +%Y%m%d%H%M`.tgz $1; }
# History Search
h () { grep "$1" ~/.history/*; }
# Search for a process:
p () {
if [ ! -z $1 ] ; then
ps aux | grep $1 | grep -v grep
else
echo "must provide search string"
fi
# create an archive of a list of files, compress the archive, and encrypt the compressed archive
function archive-and-encrypt {
echo -n "Enter desired output filename: "
read filename
tar cJ $1 | \
gpg -q -r andrew@amdavidson.com -s -e -o "$filename.tar.xz.gpg"
}
# Find a file in the current tree.
f () {
if [ ! -z $1 ] ; then
find . | grep $1
#find . -name $1 -print;
fi
# run mosh and tmux to a specific host
function mt {
mosh $1 -- tmux new-session -A -s main
}
# Repeat function, do something until you ^C out of it.
# Syntax: r sleep_time_in_seconds command_to_run
r () {
if [ ! -z $1 ]
then
if [ ! -z $2 ]
then
while [ yes ]
do
$2
echo ""
sleep $1
done
else
echo "Must have a command for second argument"
fi
else
echo "Simple function to loop a command."
echo "Example, to print the date every 5 seconds:"
echo "$ r 5 date"
fi
}
# Function to count IP address found in file(s)
count-IPs () {
grep -E -o -h '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' |\
sed -E 's/([0-9]*\.[0-9]*)\.[0-9]*\.[0-9]*/\1/' | \
uniq -c | \
sort -r
}
# _ _
# (_)_ __ ___ _ __ ___ _ __| |_ ___
# | | '_ ` _ \| '_ \ / _ \| '__| __/ __|
# | | | | | | | |_) | (_) | | | |_\__ \
# |_|_| |_| |_| .__/ \___/|_| \__|___/
# |_|
# import fzf if possible
# Debian
if [ -d /usr/share/doc/fzf/examples ]; then
source /usr/share/doc/fzf/examples/key-bindings.bash
source /usr/share/doc/fzf/examples/completion.bash
fi
# MacOS
if [ -d /opt/homebrew/opt/fzf/shell ]; then
source /opt/homebrew/opt/fzf/shell/key-bindings.bash
source /opt/homebrew/opt/fzf/shell/completion.bash
fi
# Import local extensions if needed.
if [ -f $HOME/.bashrc_local ]; then

View file

@ -1,81 +0,0 @@
background no
font Sans:size=8
#xftfont Sans:size=10
use_xft yes
xftalpha 0.8
update_interval 2.0
total_run_times 0
own_window yes
own_window_type normal
own_window_argb_visual true
own_window_transparent yes
#own_windiw_class conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 5
maximum_width 400
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color CDE0E7
default_shade_color black
default_outline_color green
alignment top_right
gap_y 35
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
uppercase yes # set to yes if you want all text to be in uppercase
TEXT
${color CDE0E7}${font OxygenSans:pixelsize=70}${time %l:%M %P}${font}
${hr 1}
${font OxygenSans:pixelsize=20}${time %A} $alignr${color white}${time %Y}-${color white}${time %m}-${color white}${time %d}${font}
${color white}SYSTEM ${hr 3}${color}
Hostname: $alignr$nodename
Uptime: $alignr$uptime
Kernel: $alignr$kernel
Load: $alignr$loadavg
CPU1 ${alignr}${cpu cpu1}%
${cpubar 4 cpu1}
CPU2 ${alignr}${cpu cpu2}%
${cpubar 4 cpu2}
Ram ${alignr}$mem / $memmax ($memperc%)
${membar 4}
Swap ${alignr} $swap / $swapmax ($swapperc%)
${swapbar 4}
Highest CPU $alignr CPU% MEM%
${color aaaaaa}${top name 1}$alignr${top cpu 1}${top mem 1}
${top name 2}$alignr${top cpu 2}${top mem 2}
${top name 3}$alignr${top cpu 3}${top mem 3}${color}
Highest MEM $alignr CPU% MEM%
${color aaaaaa}${top_mem name 1}$alignr${top_mem cpu 1}${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}
${top_mem name 3}$alignr${top_mem cpu 3}${top_mem mem 3}${color}
${color white}Filesystem ${hr 3}${color}
Root (/): ${alignr}${fs_used /} / ${fs_size /}
${fs_bar 4 /}
${color white}NETWORK ${hr 3}${color}
${if_existing /proc/sys/net/ipv4/conf/eth0}
eth0: ${addr eth0}${color aaaaaa}
Down ${downspeed eth0}/s ${alignr}Up ${upspeed eth0}/s
${downspeedgraph eth0 25,107} ${alignr}${upspeedgraph eth0 25,107}
Total ${totaldown eth0} ${alignr}Total ${totalup eth0}${color}
${endif}
${if_existing /proc/sys/net/ipv4/conf/eth1}
eth0: ${addr eth1}${color aaaaaa}
Down ${downspeed eth1} k/s ${alignr}Up ${upspeed eth1} k/s
${downspeedgraph eth1 25,107} ${alignr}${upspeedgraph eth1 25,107}
Total ${totaldown eth1} ${alignr}Total ${totalup eth1}${color}
${endif}

View file

@ -42,8 +42,4 @@
#diffFilter = delta --color-only
[commit]
gpgsign = true
[gpg]
program = /opt/homebrew/bin/gpg
[init]
defaultBranch = master
gpgsign = false

View file

@ -1,134 +0,0 @@
# i3 config file (v4)
#font pango:DejaVu Sans Mono 8
font pango:Droid Sans 8
# use these keys for focus, movement, and resize directions when reaching for
# the arrows is not convenient
set $up k
set $down j
set $left h
set $right l
# use Mouse+Mod4 to drag floating windows to their wanted position
floating_modifier Mod4
# start a terminal
bindsym Mod4+Return exec i3-sensible-terminal
# kill focused window
bindsym Mod4+Shift+q kill
# start dmenu (a program launcher)
bindsym Mod4+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym Mod4+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym Mod4+$left focus left
bindsym Mod4+$down focus down
bindsym Mod4+$up focus up
bindsym Mod4+$right focus right
# move focused window
bindsym Mod4+Shift+$left move left
bindsym Mod4+Shift+$down move down
bindsym Mod4+Shift+$up move up
bindsym Mod4+Shift+$right move right
# split in horizontal orientation
bindsym Mod4+Shift+v split h
# split in vertical orientation
bindsym Mod4+v split v
# enter fullscreen mode for the focused container
bindsym Mod4+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym Mod4+s layout stacking
bindsym Mod4+w layout tabbed
bindsym Mod4+e layout toggle split
# toggle tiling / floating
bindsym Mod4+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym Mod4+space focus mode_toggle
# focus the parent container
bindsym Mod4+a focus parent
# move the currently focused window to the scratchpad
bindsym Mod4+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym Mod4+minus scratchpad show
# switch to workspace
bindsym Mod4+1 workspace 1
bindsym Mod4+2 workspace 2
bindsym Mod4+3 workspace 3
bindsym Mod4+4 workspace 4
bindsym Mod4+5 workspace 5
bindsym Mod4+6 workspace 6
bindsym Mod4+7 workspace 7
bindsym Mod4+8 workspace 8
bindsym Mod4+9 workspace 9
bindsym Mod4+0 workspace 10
# move focused container to workspace
bindsym Mod4+Shift+1 move container to workspace 1
bindsym Mod4+Shift+2 move container to workspace 2
bindsym Mod4+Shift+3 move container to workspace 3
bindsym Mod4+Shift+4 move container to workspace 4
bindsym Mod4+Shift+5 move container to workspace 5
bindsym Mod4+Shift+6 move container to workspace 6
bindsym Mod4+Shift+7 move container to workspace 7
bindsym Mod4+Shift+8 move container to workspace 8
bindsym Mod4+Shift+9 move container to workspace 9
bindsym Mod4+Shift+0 move container to workspace 10
# kill focused window
#bindsym Mod4+Shift+q kill
# reload the configuration file
bindsym Mod4+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod4+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym Mod4+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
bindsym $left resize shrink width 1 px or 1 ppt
bindsym $down resize grow height 1 px or 1 ppt
bindsym $up resize shrink height 1 px or 1 ppt
bindsym $right resize grow width 1 px or 1 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod4+r mode "resize"
# Set window gaps
smart_borders on
smart_gaps on
gaps inner 10
gaps outer 0
focus_follows_mouse no
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
position top
status_command i3status
}

View file

@ -1,40 +0,0 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = false
interval = 5
}
order += "disk /"
order += "ethernet _first_"
order += "battery 0"
order += "load"
order += "tztime local"
ethernet _first_ {
# if you use %speed, i3status requires root privileges
format_up = "Ethernet: %ip (%speed)"
format_down = "Ethernet: down"
}
battery 0 {
format = "%status %percentage %remaining"
}
tztime local {
format = "%Y-%m-%d %H:%M:%S"
}
load {
format = "%1min"
}
disk "/" {
format = "HD: %avail"
}

View file

@ -137,7 +137,7 @@ endif " has("autocmd")
"let g:dracula_colorterm = 0
"silent! colorscheme dracula
set background=dark
colorscheme gruvbox
silent! colorscheme gruvbox
" ==================== Code Folding ====================

View file

@ -20,12 +20,6 @@ alias vim='nvim'
alias vi='nvim'
alias nv='nvim'
# remote access
alias mroyal='mosh royal -- tmux new-session -A -s main'
alias mari='mosh ari -- tmux new-session -A -s main'
alias muzi='mosh uzi -- tmux new-session -A -s main'
alias mnf='mosh amdavidson@needleandfoot.com -- tmux new-session -A -s main'
# fix sudo autocorrections
alias sudo="nocorrect sudo"

View file

@ -7,6 +7,10 @@ export TERM=xterm-256color
export CLICOLOR=1
export LSCOLORS=Gxfxcxdxbxegedabagacad
# Setup XDG
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
# Enable grep colors
export GREP_COLOR='3;33'
@ -19,6 +23,3 @@ export GPG_TTY=$(tty)
# Fix GOPATH
export GOPATH="$HOME/dev/go"
export PATH="$HOME/dev/go/bin:$PATH"
# tmux command for use with ssh / mosh commands
export TM="tmux new-session -A -s main"

View file

@ -87,10 +87,10 @@ unsetopt menu_complete
### Correction
# Enable spelling correction for commands
setopt correct
# setopt correct
# Enable spelling correciton for arguments
setopt correctall
# setopt correctall

View file

@ -61,5 +61,5 @@ function check_reboot {
test -f /var/run/reboot-required && echo "R "
}
PROMPT='${PR_BOLD_RED}$(check_reboot)%{$reset_color%}%m ${PR_BOLD_YELLOW}$(truncated_pwd 3)$(git_prompt)%(?.%F{magenta}.%F{red})%f%b '
PROMPT='${PR_BOLD_RED}$(check_reboot)%{$reset_color%}%m ${PR_BOLD_YELLOW}$(truncated_pwd 3)$(git_prompt)%(?.%F{magenta}.%F{red})%f %{$reset_color%}%'
#PROMPT='$(check_reboot)%m $(truncated_pwd 3) $(git_branch) $(git_unstaged)$(git_is_ahead)$(git_is_behind)> '