From b429a174e465f34b46c861d74caa3d63b412b5a1 Mon Sep 17 00:00:00 2001 From: Cheri Date: Tue, 20 Sep 2022 19:21:41 +0300 Subject: [PATCH] Moved from bash to zsh LOL --- .bash_profile | 9 --- .bashrc | 65 -------------------- .profile => .zprofile | 6 +- .zshrc | 138 ++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + install.sh | 5 +- 6 files changed, 144 insertions(+), 80 deletions(-) delete mode 100644 .bash_profile delete mode 100644 .bashrc rename .profile => .zprofile (76%) create mode 100644 .zshrc diff --git a/.bash_profile b/.bash_profile deleted file mode 100644 index 4256eb2..0000000 --- a/.bash_profile +++ /dev/null @@ -1,9 +0,0 @@ -# -# ~/.bash_profile -# - -[[ -f ~/.bashrc ]] && . ~/.bashrc -[[ -f ~/.profile ]] && . ~/.profile - -# If running from tty1 start sway -[ "$(tty)" = "/dev/tty1" ] && exec ~/.config/sway/start.sh diff --git a/.bashrc b/.bashrc deleted file mode 100644 index 2c27967..0000000 --- a/.bashrc +++ /dev/null @@ -1,65 +0,0 @@ -# -# ~/.bashrc -# - -#if not running interactively, don't do anything -[[ $- != *i* ]] && return - -set -o vi -PS1='\[\e[31m\]\W\[\e[m\] \[\e[32m\]>\[\e[m\] ' - -# I don't know what these do for now, might or might not break something if disabled -#unset use_color safe_term match_lhs sh -#use_color=true -#xhost +local:root > /dev/null 2>&1 -#complete -cf sudo - -alias cp='cp -i' # confirm before overwriting something -alias df='df -h' # human-readable sizes -alias du='du -h' -alias free='free -h' - -alias ls='ls --color=auto' -alias grep='grep --colour=auto' -alias egrep='egrep --colour=auto' -alias fgrep='fgrep --colour=auto' - -# [[ Not sure about these, guess I'll just keep them... - -# 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 - -# Enable history appending instead of overwriting. #139609 -shopt -s histappend -# ]] - -# # ext - archive extractor -# # usage: ext -ext () -{ - 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 ext()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - -# User added aliases -alias vim='nvim' diff --git a/.profile b/.zprofile similarity index 76% rename from .profile rename to .zprofile index 86abc93..67a7065 100644 --- a/.profile +++ b/.zprofile @@ -1,6 +1,3 @@ -# This runs at login. Normally environmental variables are set here. - -# Add ~/.local/bin to path export PATH=$PATH:$HOME/.local/bin # Default programs: @@ -14,3 +11,6 @@ export FILEMANAGER="pcmanfm-qt" #export QT_STYLE_OVERRIDE=kvantum export QT_QPA_PLATFORMTHEME=qt5ct #export DESKTOP_SESSION=KDE + +# If running from tty1 start sway +[ "$(tty)" = "/dev/tty1" ] && exec ~/.config/sway/start.sh diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..b2062a8 --- /dev/null +++ b/.zshrc @@ -0,0 +1,138 @@ +HISTFILE=~/.histfile +HISTSIZE=2200 +SAVEHIST=2000 +setopt extendedglob +bindkey -v # I do vi +bindkey '^R' history-incremental-search-backward + +autoload -Uz compinit +compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit +_comp_options+=(globdots) # Include hidden files. + +# COLORS +autoload -U colors && colors +# less settings +export LESS='--RAW-CONTROL-CHARS --LONG-PROMPT --ignore-case --use-color' +# Colors in man pages +export MANPAGER='less -R --use-color -Dd+177 -Du+45' +export MANROFFOPT='-c' + +# Print timing statistics of long running commands +REPORTTIME='10' + +stty stop undef # Disable ctrl-s to freeze terminal. + +## Aliases + +# GNU coreutils +alias ls='ls --all --color=auto --classify --group-directories-first --human-readable --sort=extension' +alias cp='cp -i' # confirm before overwriting something +alias df='df -h' # human-readable sizes +alias du='du -h' +alias free='free -h' +# GNU grep & frontends +function () { + local grepfrontend + for grepfrontend in grep xzgrep zgrep zstdgrep; alias "$grepfrontend"="${grepfrontend} --color=auto" +} + + +## Options + +# Changing Directories +setopt AUTO_CD + +# Completion +setopt COMPLETE_IN_WORD +setopt GLOB_COMPLETE +setopt LIST_PACKED + +# Expansion and Globbing +setopt EXTENDED_GLOB +setopt GLOB_DOTS +setopt WARN_CREATE_GLOBAL + +# Input/Output +setopt CORRECT +setopt CORRECT_ALL +setopt INTERACTIVE_COMMENTS +setopt RM_STAR_WAIT + +# Job Control +setopt LONG_LIST_JOBS + +# Prompting +setopt PROMPT_SUBST + +# Shell Emulation +setopt BSD_ECHO + +## Completion + +# Set up completion cache directories +[[ -d "${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/zcompcache" ]] || mkdir -p -- "${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/zcompcache" + +autoload -Uz compinit +compinit -d "${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/zcompdump" + +zstyle ':completion::complete:*' cache-path "${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/zcompcache" +zstyle ':completion::complete:*' use-cache true +#zstyle ':completion:*' rehash true + +zstyle ':completion:*' verbose yes +zstyle ':completion:*' menu select=1 select=long-list + +# Zsh sets directory color to red by default. Explicitly set directory color to blue when LS_COLORS is not set. +zstyle ':completion:*:default' list-colors "${(s.:.)LS_COLORS:-di=01;34:}" + +zstyle ':completion:*' list-dirs-first true +zstyle ':completion:*' list-grouped true +zstyle ':completion:*' group-name '' +zstyle ':completion:*' list-suffixes true + +zstyle ':completion:*:manuals' separate-sections true +zstyle ':completion:*:manuals.*' insert-sections true + +zstyle ':completion:*:descriptions' format '%U%F{cyan}%d%f%u' + +zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*' +zstyle ':completion:*' completer _complete _ignored _correct _approximate _expand + +# Ignore completion functions (until the _ignored completer) +zstyle ':completion:*:functions' ignored-patterns '_*' + +zstyle ':completion:*:*:-command-:*:*' ignored-patterns '_*' + +zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters + +zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' + +# Word characters are alphanumeric characters only. Despite the name it does not match the behaviour of Bash. +autoload -Uz select-word-style +select-word-style bash + +## Prompt + +function () { + local prompt_part_username='%B%F{red}%n%f$b' + local prompt_part_hostname='%B%F{red}%{${SSH_TTY+%B}%}%M%{${SSH_TTY+%b}%}%f%b' + local prompt_part_path='%F{blue}%(!.%/.%~)%f' + local prompt_part_priv='%#' + local prompt_part_exit='%F{blue}%(?..[%?])%f' + local prompt_part_vcs='${vcs_info_msg_0_}' + + typeset -g PROMPT="${prompt_part_username}@${prompt_part_hostname} ${prompt_part_path} ${prompt_part_priv} " + typeset -g RPROMPT="${prompt_part_exit} ${prompt_part_vcs}" +} + +autoload -Uz add-zsh-hook + +# Version control systems +if (( ${+commands[git]} )); then + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' check-for-changes true + add-zsh-hook -Uz precmd vcs_info +fi diff --git a/README.md b/README.md index b4427f0..5dde512 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ What I use right now (stuff I have to install on a fresh linux install): ------------------------------------------------------------------------ +* **shell**: ZSH * **Compositor**: sway (and swaybg, swayidle, swaylock) * **Bar info**: i3status-rust * **terminal**: foot diff --git a/install.sh b/install.sh index af56976..68e6d66 100755 --- a/install.sh +++ b/install.sh @@ -22,9 +22,8 @@ read choice if [ "$choice" = "y" ] then - gohome .bashrc - gohome .bash_profile - gohome .profile + gohome .zshrc + gohome .zprofile gohome .doom.d goconfig dunst