first commit

This commit is contained in:
Henrik Bakken
2020-04-07 18:49:42 +02:00
commit 55a49a6ee0
23 changed files with 5244 additions and 0 deletions
+142
View File
@@ -0,0 +1,142 @@
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
;;
screen*)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
;;
esac
use_color=true
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\w\[\033[01;31m\] [\t] \$\[\033[00m\] '
else
PS1='\[\033[01;32m\]\w\[\033[01;32m\] [\t] \$\[\033[00m\] '
fi
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \w [\t] \$ '
else
PS1='\u@\h \w [\t] \$ '
fi
fi
unset use_color safe_term match_lhs sh
alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less
xhost +local:root > /dev/null 2>&1
complete -cf sudo
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
shopt -s expand_aliases
# export QT_SELECT=4
# Enable history appending instead of overwriting. #139609
shopt -s histappend
#
# # ex - archive extractor
# # usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
+7
View File
@@ -0,0 +1,7 @@
[core]
autocrlf = input
fileMode = false
pager = diff-so-fancy | less --tabs=4 -RFX
[user]
name = Henrik Bakken
email = bakken.henrik@gmail.com
+14
View File
@@ -0,0 +1,14 @@
export VISUAL=/usr/bin/nvim
export EDITOR=/usr/bin/nvim
export BROWSER=/usr/bin/chromium
export QT_QPA_PLATFORMTHEME="qt5ct"
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
# cuda stuff
export CUDA_HOME=/opt/cuda
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CUDA_HOME}/lib64
PATH=${CUDA_HOME}/bin:${PATH}
export PATH
# MKL AMD fix
export MKL_DEBUG_CPU_TYPE=5
+182
View File
@@ -0,0 +1,182 @@
######################
### SETTINGS ###
######################
# loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none
# enable vi mode keys
setw -g mode-keys vi
# mouse control (clickable windows, panes, resizable panes)
setw -g mouse on
set -g mouse on
# clipboard control
set -g set-clipboard on
set -g history-limit 20000
# screen colors
set -g default-terminal "tmux-256color"
# Start with index 1
set -g base-index 1
setw -g pane-base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
######################
### KEYBINDS ###
######################
# Config that is very close to a i3 window manager's keybinding.
# Set new prefix
# Note : you can press super key by set M.
# (tested with tty only)
set -g prefix C-a
bind C-a send-prefix
# First remove *all* keybindings
unbind -a
# Basic bindings
bind ? list-keys
bind d detach-client
bind D choose-client
bind : command-prompt
#bind \ show-messages
# Copy mode
bind c copy-mode
# clipboard control
bind P paste-buffer
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection
bind -T copy-mode-vi r send-keys -X rectangle-toggle
bind y run-shell -b "tmux show-buffer | xclip -sel clip" \; display-message "Copied tmux buffer to system clipboard"
# Refresh client
bind R refresh-client \; display-message "Refresh already"
# Rename window
bind , command-prompt "rename-window %%"
# Clock mode
bind t clock-mode
# Show pane info
bind i display-panes
# Config Reloads
bind r source-file ~/.tmux.conf \; display-message "Config reloaded"
# resize controls
bind -r h resize-pane -L 2 \; display-message "Resize left"
bind -r l resize-pane -R 2 \; display-message "Resize right"
bind -r k resize-pane -U 2 \; display-message "Resize up"
bind -r j resize-pane -D 2 \; display-message "Resize down"
# zoom control
bind -n M-f resize-pane -Z
# split panes using | and -, make sure they open in the same path
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Change layouts
bind o rotate-window
bind Space next-layout
bind K swap-pane -s {up-of}
bind J swap-pane -s {down-of}
bind H swap-pane -s {left-of}
bind L swap-pane -s {right-of}
# Choose Window
bind w choose-window
# Change current pane to next window
bind 1 join-pane -t :1
bind 2 join-pane -t :2
bind 3 join-pane -t :3
bind 4 join-pane -t :4
bind 5 join-pane -t :5
bind 6 join-pane -t :6
bind 7 join-pane -t :7
bind 8 join-pane -t :8
bind 9 join-pane -t :9
bind 0 join-pane -t :10
# Switch windows alt+number
bind -n M-1 if-shell 'tmux select-window -t :1' '' 'new-window -t :1'
bind -n M-2 if-shell 'tmux select-window -t :2' '' 'new-window -t :2'
bind -n M-3 if-shell 'tmux select-window -t :3' '' 'new-window -t :3'
bind -n M-4 if-shell 'tmux select-window -t :4' '' 'new-window -t :4'
bind -n M-5 if-shell 'tmux select-window -t :5' '' 'new-window -t :5'
bind -n M-6 if-shell 'tmux select-window -t :6' '' 'new-window -t :6'
bind -n M-7 if-shell 'tmux select-window -t :7' '' 'new-window -t :7'
bind -n M-8 if-shell 'tmux select-window -t :8' '' 'new-window -t :8'
bind -n M-9 if-shell 'tmux select-window -t :9' '' 'new-window -t :9'
bind -n M-0 if-shell 'tmux select-window -t :10' '' 'new-window -t :10'
# Kill Selected Pane
bind Q kill-pane
# present a menu of URLs to open from the visible pane. sweet.
bind u capture-pane \;\
save-buffer /tmp/tmux-buffer \;\
split-window -l 10 "urlview /tmp/tmux-buffer"
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n M-h if-shell "$is_vim" "send-keys M-h" "select-pane -L"
bind-key -n M-j if-shell "$is_vim" "send-keys M-j" "select-pane -D"
bind-key -n M-k if-shell "$is_vim" "send-keys M-k" "select-pane -U"
bind-key -n M-l if-shell "$is_vim" "send-keys M-l" "select-pane -R"
#bind-key -n M-\ if-shell "$is_vim" "send-keys M-\\" "select-pane -l"
bind-key -T copy-mode-vi M-h select-pane -L
bind-key -T copy-mode-vi M-j select-pane -D
bind-key -T copy-mode-vi M-k select-pane -U
bind-key -T copy-mode-vi M-l select-pane -R
#bind-key -T copy-mode-vi M-\ select-pane -l
# fzf binding
set -g @tmux-fzf-launch-key 'f'
######################
### DESIGN CHANGES ###
######################
# various plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'sainnhe/tmux-fzf'
# note: fzf bound to 'F'
set -g @plugin 'odedlaz/tmux-onedark-theme'
# solarized plugin and options
# set -g @plugin 'seebi/tmux-colors-solarized'
# set -g @colors-solarized '256' (the default)
# set -g @colors-solarized 'dark'
# set -g @colors-solarized 'light'
# set -g @colors-solarized 'base16'
# tmux themepack
# set -g @plugin 'jimeh/tmux-themepack'
# set -g @themepack 'basic'
# set -g @themepack 'powerline/default/yellow'
# set -g @themepack 'powerline/default/orange'
# set -g @themepack 'powerline/block/blue'
# set -g @themepack 'powerline/block/cyan'
# set -g @themepack 'powerline/default/gray'
# set -g @themepack 'powerline/double/yellow'
# keep at bottom
run -b '~/.tmux/plugins/tpm/tpm'
+66
View File
@@ -0,0 +1,66 @@
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
DEFAULT_SESSION='i3 --shmlog-size 0'
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
get_session(){
local dbus_args=(--sh-syntax --exit-with-session)
case $1 in
awesome) dbus_args+=(awesome) ;;
bspwm) dbus_args+=(bspwm-session) ;;
budgie) dbus_args+=(budgie-desktop) ;;
cinnamon) dbus_args+=(cinnamon-session) ;;
deepin) dbus_args+=(startdde) ;;
enlightenment) dbus_args+=(enlightenment_start) ;;
fluxbox) dbus_args+=(startfluxbox) ;;
gnome) dbus_args+=(gnome-session) ;;
i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;;
jwm) dbus_args+=(jwm) ;;
kde) dbus_args+=(startkde) ;;
lxde) dbus_args+=(startlxde) ;;
lxqt) dbus_args+=(lxqt-session) ;;
mate) dbus_args+=(mate-session) ;;
xfce) dbus_args+=(xfce4-session) ;;
openbox) dbus_args+=(openbox-session) ;;
*) dbus_args+=($DEFAULT_SESSION) ;;
esac
echo "dbus-launch ${dbus_args[*]}"
}
exec $(get_session)
+14
View File
@@ -0,0 +1,14 @@
export VISUAL=/usr/bin/nvim
export EDITOR=/usr/bin/nvim
export BROWSER=/usr/bin/chromium
export QT_QPA_PLATFORMTHEME="qt5ct"
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
# cuda stuff
export CUDA_HOME=/opt/cuda
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CUDA_HOME}/lib64
PATH=${CUDA_HOME}/bin:${PATH}
export PATH
# MKL AMD fix
export MKL_DEBUG_CPU_TYPE=5
+44
View File
@@ -0,0 +1,44 @@
# Lines configured by zsh-newuser-install
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
setopt nomatch
unsetopt autocd
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/hjalmarlucius/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# more history stuff
REPORTTIME=3 # Report command running time if it is more than 3 seconds
setopt INC_APPEND_HISTORY # Add commands to history as they are entered, don't wait for shell to exit
setopt EXTENDED_HISTORY # Also remember command start time and duration
setopt HIST_IGNORE_ALL_DUPS # Do not keep duplicate commands in history
setopt HIST_IGNORE_SPACE # Do not remember commands that start with a whitespace
# default ls settings
alias ls='ls -hat --group-directories-first'
ls --color=auto &> /dev/null && alias ls='ls --color=auto'
export CLICOLOR=1
# fuzzy find
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
bindkey '^y' fzf-cd-widget
# configure custom command prompt
_setup_ps1() {
GLYPH="▲"
[ "x$KEYMAP" = "xvicmd" ] && GLYPH="▼"
PS1="%F{red}[%F{cyan}%*%F{red}] %(?.%F{cyan}.%F{red})$GLYPH%f %(1j.%F{cyan}[%j]%f .)%F{cyan}%~%f %(!.%F{red}#%f .)"
}
_setup_ps1
# Base16 Shell
BASE16_SHELL="$HOME/.config/base16-shell/"
[ -n "$PS1" ] && \
[ -s "$BASE16_SHELL/profile_helper.sh" ] && \
eval "$("$BASE16_SHELL/profile_helper.sh")"