From 74e0a0b11e750133cfd8277a4ffcbf8a00f3f5b3 Mon Sep 17 00:00:00 2001 From: foo-dogsquared Date: Mon, 23 Dec 2019 11:45:41 +0800 Subject: [PATCH] Update alacritty, xorg, and zsh config --- alacritty/alacritty.yml | 2 +- xorg/.Xresources | 4 +- xorg/.xinitrc | 12 +-- xorg/.xprofile | 18 +++++ zsh/.profile | 23 ++++++ zsh/.zprofile | 11 ++- zsh/.zshrc | 169 ++++++++++++++++++---------------------- 7 files changed, 131 insertions(+), 108 deletions(-) create mode 100644 xorg/.xprofile create mode 100644 zsh/.profile diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml index 4f53360..25523a5 100644 --- a/alacritty/alacritty.yml +++ b/alacritty/alacritty.yml @@ -272,7 +272,7 @@ visual_bell: # # Window opacity as a floating point number from `0.0` to `1.0`. # The value `0.0` is completely transparent and `1.0` is opaque. -background_opacity: 1.0 +background_opacity: 0.875 # Mouse bindings # diff --git a/xorg/.Xresources b/xorg/.Xresources index 3030150..07e2636 100644 --- a/xorg/.Xresources +++ b/xorg/.Xresources @@ -1,5 +1,5 @@ *foreground: #e5e3e3 -*background: #221e21 +*background: #eeeeee *cursor: #e5e3e3 *color0: #0c080b @@ -26,6 +26,6 @@ *color7: #d1cfcf *color15: #eceaea -URxvt.font: xft:Iosevka:size=12 +URxvt.font: xft:FiraCode Nerd Font:size=12 URxvt.secondaryWheel: 1 diff --git a/xorg/.xinitrc b/xorg/.xinitrc index 11f9228..4f896a0 100644 --- a/xorg/.xinitrc +++ b/xorg/.xinitrc @@ -1,4 +1,8 @@ -#!/bin/sh +#!/usr/bin/env sh + +# Loading the xprofile since display managers also needs the said file. +# This prevents duplicating needed code. +[ -f ~/.xprofile ] && . ~/.xprofile userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap @@ -23,8 +27,4 @@ if [ -f "$usermodmap" ]; then xmodmap "$usermodmap" fi -/usr/bin/lxsession & -compton & -dunst & -udiskie & -exec i3 +exec bspwm diff --git a/xorg/.xprofile b/xorg/.xprofile new file mode 100644 index 0000000..e2bfaaf --- /dev/null +++ b/xorg/.xprofile @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +# Activate the LXSessions for mounting external filesystems. +# This is pretty much only used for accessing external filesystems +# from Thunar as far as practical application is concerned. +/usr/bin/lxsession & + +# Run the compositor and enable more advanced graphical effects. +picom & + +# Activate the notification server. +dunst & + +# Boot the mount filesystem helper. +udiskie & + +# Run the hotkey daemon. +sxhkd & \ No newline at end of file diff --git a/zsh/.profile b/zsh/.profile new file mode 100644 index 0000000..e59dbef --- /dev/null +++ b/zsh/.profile @@ -0,0 +1,23 @@ +# This is where environmental variables are set. +# If you're looking for the aliases, keybindings, and prompts, they are in the equivalent `.rc` (i.e., `.zshrc`, `.bashrc`) file. + +# For more information, see the following Unix Exchange thread (https://unix.stackexchange.com/q/71253). +# Or the Arch Linux Wiki on zsh (https://wiki.archlinux.org/index.php/Zsh#Startup/Shutdown_files). +# Also check the manual pages for `zshall` (i.e., `man zshall`). + +# My custom variables (only applicable at user level) +export PICTURES_DIRECTORY=$HOME/Pictures +export DOCUMENTS_DIRECTORY=$HOME/Documents +export BIN_DIRECTORY=$HOME/bin +export VIDEO_DIRECTORY=$HOME/recordings + +# If you come from bash you might have to change your $PATH. +export PATH="$BIN_DIRECTORY:/usr/local/bin:$HOME/.cargo/bin:$PATH" + +# Common environmental variables. +# Or at least that'll be used by my setup. +export EDITOR="vim" +export TERMINAL="alacritty" +export BROWSER="firefox" +export READ="zathura" +export FILE="ranger" diff --git a/zsh/.zprofile b/zsh/.zprofile index 92ceae6..d1efda3 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -1,7 +1,6 @@ -# -# ~/.zprofile -# +if [[ -f $HOME/.profile ]]; then + source $HOME/.profile +fi -[[ -f ~/.bashrc ]] && . ~/.bashrc - -export PATH="$HOME/.cargo/bin:$PATH" +# This is a program that `sudo -a` needs for prompting the user and password. +export SUDO_ASKPASS="$HOME/bin/askpass" diff --git a/zsh/.zshrc b/zsh/.zshrc index 6887fa0..e4effe9 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,111 +1,95 @@ -# My custom variables (only applicable at user level) -PICTURES_DIRECTORY=$HOME/Pictures -DOCUMENTS_DIRECTORY=$HOME/Documents -BIN_DIRECTORY=$HOME/bin -SCRIPTS_DIRECTORY=$HOME/.scripts/ +# This is the part that configures the interactive shell. -# If you come from bash you might have to change your $PATH. -export PATH=$BIN_DIRECTORY:$SCRIPTS_DIRECTORY:/usr/local/bin:$PATH +export function git_directory() { + git_branch=$(git branch --show-current 2>/dev/null) -# Path to your oh-my-zsh installation. -export ZSH="/home/foo-dogsquared/.oh-my-zsh" + return "$git_branch" +} -# Set name of the theme to load --- if set to "random", it will -# load a random theme each time oh-my-zsh is loaded, in which case, -# to know which specific one was loaded, run: echo $RANDOM_THEME -# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -ZSH_THEME="robbyrussell" +# Add pywal to the bootup of the interactive shell +cat ~/.cache/wal/sequences -# Set list of themes to pick from when loading at random -# Setting this variable when ZSH_THEME=random will cause zsh to load -# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ -# If set to an empty array, this variable will have no effect. -# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) +# The prompt. +# This is based from Luke Smith's setup. +# https://github.com/LukeSmithxyz/voidrice/blob/master/.config/zsh/.zshrc +autoload -U colors && colors +PS1="%F%(0?.%{$fg[red](T%}.%{$fg[green](F%})) %B%{$fg[magenta]%}%~%{$reset_color%} $%f%b " -# Uncomment the following line to use case-sensitive completion. -# CASE_SENSITIVE="true" +# Configuring the command history. +HISTSIZE=1000 +SAVEHIST=1000 +HISTFILE=~/.cache/zsh/history -# Uncomment the following line to use hyphen-insensitive completion. -# Case-sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" +# Shell keybindings in Vim mode. +# bindkey -v -# Uncomment the following line to disable bi-weekly auto-update checks. -# DISABLE_AUTO_UPDATE="true" +# Keybindings. +# create a zkbd compatible hash; +# to add other keys to this hash, see: man 5 terminfo +typeset -g -A key -# Uncomment the following line to automatically update without prompting. -# DISABLE_UPDATE_PROMPT="true" +key[Home]="${terminfo[khome]}" +key[End]="${terminfo[kend]}" +key[Insert]="${terminfo[kich1]}" +key[Backspace]="${terminfo[kbs]}" +key[Delete]="${terminfo[kdch1]}" +key[Up]="${terminfo[kcuu1]}" +key[Down]="${terminfo[kcud1]}" +key[Left]="${terminfo[kcub1]}" +key[Right]="${terminfo[kcuf1]}" +key[PageUp]="${terminfo[kpp]}" +key[PageDown]="${terminfo[knp]}" +key[ShiftTab]="${terminfo[kcbt]}" -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_ZSH_DAYS=13 +# setup key accordingly +[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line +[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line +[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode +[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char +[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char +[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history +[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history +[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char +[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char +[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history +[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history +[[ -n "${key[ShiftTab]}" ]] && bindkey -- "${key[ShiftTab]}" reverse-menu-complete -# Uncomment the following line if pasting URLs and other text is messed up. -# DISABLE_MAGIC_FUNCTIONS=true +# Finally, make sure the terminal is in application mode, when zle is +# active. Only then are the values from $terminfo valid. +if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then + autoload -Uz add-zle-hook-widget + function zle_application_mode_start { + echoti smkx + } + function zle_application_mode_stop { + echoti rmkx + } + add-zle-hook-widget -Uz zle-line-init zle_application_mode_start + add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop +fi -# Uncomment the following line to disable colors in ls. -# DISABLE_LS_COLORS="true" +# History searching. +autoload -Uz up-line-or-beginning-search down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search -# Uncomment the following line to disable auto-setting terminal title. -# DISABLE_AUTO_TITLE="true" +[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search +[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" +# Enable prompts +autoload -Uz promptinit +promptinit -# Uncomment the following line to display red dots whilst waiting for completion. -# COMPLETION_WAITING_DOTS="true" +# Loading completion feature. +autoload -Uz compinit +zstyle ':completion:*' menu select +zstyle ':completion::complete:*' gain-prvileges 1 +compinit -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" +setopt COMPLETE_ALIASES -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# You can set one of the optional three formats: -# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# or set a custom format using the strftime function format specifications, -# see 'man strftime' for details. -# HIST_STAMPS="mm/dd/yyyy" - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - -# Which plugins would you like to load? -# Standard plugins can be found in ~/.oh-my-zsh/plugins/* -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=(git) - -source $ZSH/oh-my-zsh.sh - -# User configuration - -# export MANPATH="/usr/local/man:$MANPATH" - -# You may need to manually set your language environment -# export LANG=en_US.UTF-8 - -# Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='mvim' -# fi - -# Compilation flags -# export ARCHFLAGS="-arch x86_64" - -# Set personal aliases, overriding those provided by oh-my-zsh libs, -# plugins, and themes. Aliases can be placed here, though oh-my-zsh -# users are encouraged to define aliases within the ZSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias zshconfig="mate ~/.zshrc" -# alias ohmyzsh="mate ~/.oh-my-zsh" - -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! +# This block is managed by conda. __conda_setup="$('/home/foo-dogsquared/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" @@ -117,4 +101,3 @@ else fi fi unset __conda_setup -# <<< conda initialize <<<