From 6d05ea08cca7bd1f042c8129e7b93ba7266e80bc Mon Sep 17 00:00:00 2001 From: dx Date: Tue, 12 May 2020 17:26:38 +0100 Subject: ~Broke zshrc into .zprofile and .config/zsh/.zshrc --- zsh/.config/zsh/.zshrc | 103 +++++++++++++++++++++++++++++++++++++++++ zsh/.zprofile | 40 ++++++++++++++++ zsh/.zshrc | 122 ------------------------------------------------- 3 files changed, 143 insertions(+), 122 deletions(-) create mode 100644 zsh/.config/zsh/.zshrc create mode 100644 zsh/.zprofile delete mode 100644 zsh/.zshrc (limited to 'zsh') diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..63fa757 --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,103 @@ +# zshrc -*- mode: sh; lexical-binding: t; -*- + +## ZSH +export ZSH_THEME="af-magic" +PS1="%F{8}[δx@%m%k] %B%F{14}[%(4~|...|)%3~]%F{white} +λ %b%f%k" +setopt histignorealldups sharehistory + +autoload -U colors && colors +autoload -U compinit +HISTSIZE=10000 +SAVEHIST=10000 +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit +_comp_options+=(globdots) + +zstyle ':completion:*' auto-description 'specify: %d' +zstyle ':completion:*' completer _expand _complete _correct _approximate +zstyle ':completion:*' format 'Completing %d' +zstyle ':completion:*' group-name '' +zstyle ':completion:*' menu select=2 eval "$(dircolors -b)" +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' +zstyle ':completion:*' menu select=long +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle ':completion:*' use-compctl false +zstyle ':completion:*' verbose true +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,' + +## Vim binds +bindkey -v +# Menu +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'j' vi-up-line-or-history +bindkey -M menuselect 'k' vi-down-line-or-history +bindkey -M menuselect 'l' vi-forward-char + +# Cursor +function zle-keymap-select { + if [[ ${KEYMAP} == vicmd ]] || + [[ $1 = 'block' ]]; then + echo -ne '\e[1 q' + elif [[ ${KEYMAP} == main ]] || + [[ ${KEYMAP} == viins ]] || + [[ ${KEYMAP} = '' ]] || + [[ $1 = 'beam' ]]; then + echo -ne '\e[5 q' + fi +} + +zle -N zle-keymap-select +zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" +} +zle -N zle-line-init +echo -ne '\e[5 q' # Use beam shape cursor on startup. +preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + +## Programming +editor() { + nohup emacs $@ > /dev/null & +} + +gentemplate() { + for var in ${@:2}; do + case $1 in + 'c') git clone https://github.com/Oreodave/CTemplate $var;; + 'cpp') git clone https://github.com/Oreodave/CPPTemplate $var;; + 'python') git clone https://github.com/Oreodave/PythonTemplate $var;; + 'node') git clone https://github.com/Oreodave/NodeTemplate $var;; + 'ard') git clone https://github.com/Oreodave/ArduinoTemplate $var;; + 'java') git clone https://github.com/Oreodave/JavaTemplate $var;; + *) return;; + esac + rm -rf $var/.git; + done +} + +gentemplateoff () { + for var in ${@:2}; do + case $1 in + 'c') cp -r ~/Code/Templates/CTemplate $var;; + 'cpp') cp -r ~/Code/Templates/CPPTemplate $var;; + 'python') cp -r ~/Code/Templates/PythonTemplate $var;; + 'node') cp -r ~/Code/Templates/NodeTemplate $var;; + 'ard') cp -r ~/Code/Templates/ArduinoTemplate $var;; + 'java') cp -r ~/Code/Templates/JavaTemplate $var;; + *) return;; + esac + rm -rf $var/.git; + done +} + +## NVM config +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh diff --git a/zsh/.zprofile b/zsh/.zprofile new file mode 100644 index 0000000..783dcb5 --- /dev/null +++ b/zsh/.zprofile @@ -0,0 +1,40 @@ +# .zprofile -*- mode: sh; lexical-binding: t; -*- + +# Standard Variables +export EDITOR="nvim" +export TERMINAL="st" +export BROWSER="qutebrowser" +export PF_INFO="ascii title os memory uptime editor wm shell" +export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:~/.local/bin:~/.emacs.d/bin:~/.cargo/bin:~/.local/scripts +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true +export DOTNET_CLI_TELEMTRY_OPTOUT=1 +export force_color_prompt=yes +export guile=guile2.2 + +# Aliases +alias yapf='python2 -m yapf' +alias clip="xclip -sel clip" +alias paste="xclip -o" +alias ls="ls --color=auto" +alias l="ls -la" +alias md="mkdir" +alias fzf="fzf --layout=reverse --height=20" +alias suctl="systemctl --user" + +# XDG variables +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_RUNTIME_DIR=/run/user/`id -u` + +# Dotfolders +export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh" +export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo" + +# Run some programs +setxkbmap gb +figlet dx +/usr/bin/pfetch +if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then + exec startx +fi diff --git a/zsh/.zshrc b/zsh/.zshrc deleted file mode 100644 index a8f6e63..0000000 --- a/zsh/.zshrc +++ /dev/null @@ -1,122 +0,0 @@ -# zshrc -*- mode: sh; lexical-binding: t; -*- - -## Important variables and stuff -export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:~/.local/bin:~/.emacs.d/bin:~/.cargo/bin:~/.local/scripts -export guile=guile2.2 -export PF_INFO="ascii title os memory uptime editor wm shell" -export EDITOR="emacs" -export SHELL="zsh" -alias yapf='python2 -m yapf' -alias clip="xclip -sel clip" -alias paste="xclip -o" -alias ls="ls --color=auto" -alias l="ls -la" -alias md="mkdir" -alias fzf="fzf --layout=reverse --height=20" -alias suctl="systemctl --user" -export force_color_prompt=yes -export ZSH_THEME="af-magic" -export XDG_RUNTIME_DIR=/run/user/`id -u` -export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true -export DOTNET_CLI_TELEMTRY_OPTOUT=1 - -## ZSH -PS1="%F{8}[δx@%m%k] %B%F{14}[%(4~|...|)%3~]%F{white} -λ %b%f%k" -setopt histignorealldups sharehistory - -autoload -U colors && colors -autoload -U compinit -HISTSIZE=10000 -SAVEHIST=10000 -zstyle ':completion:*' menu select -zmodload zsh/complist -compinit -_comp_options+=(globdots) - -zstyle ':completion:*' auto-description 'specify: %d' -zstyle ':completion:*' completer _expand _complete _correct _approximate -zstyle ':completion:*' format 'Completing %d' -zstyle ':completion:*' group-name '' -zstyle ':completion:*' menu select=2 eval "$(dircolors -b)" -zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} -zstyle ':completion:*' list-colors '' -zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' -zstyle ':completion:*' menu select=long -zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s -zstyle ':completion:*' use-compctl false -zstyle ':completion:*' verbose true -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' -zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,' - -## Vim binds -bindkey -v -# Menu -bindkey -M menuselect 'h' vi-backward-char -bindkey -M menuselect 'j' vi-up-line-or-history -bindkey -M menuselect 'k' vi-down-line-or-history -bindkey -M menuselect 'l' vi-forward-char - -# Cursor -function zle-keymap-select { - if [[ ${KEYMAP} == vicmd ]] || - [[ $1 = 'block' ]]; then - echo -ne '\e[1 q' - elif [[ ${KEYMAP} == main ]] || - [[ ${KEYMAP} == viins ]] || - [[ ${KEYMAP} = '' ]] || - [[ $1 = 'beam' ]]; then - echo -ne '\e[5 q' - fi -} - -zle -N zle-keymap-select -zle-line-init() { - zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) - echo -ne "\e[5 q" -} -zle -N zle-line-init -echo -ne '\e[5 q' # Use beam shape cursor on startup. -preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. - -## Programming -editor() { - nohup emacs $@ > /dev/null & -} - -gentemplate() { - for var in ${@:2}; do - case $1 in - 'c') git clone https://github.com/Oreodave/CTemplate $var;; - 'cpp') git clone https://github.com/Oreodave/CPPTemplate $var;; - 'python') git clone https://github.com/Oreodave/PythonTemplate $var;; - 'node') git clone https://github.com/Oreodave/NodeTemplate $var;; - 'ard') git clone https://github.com/Oreodave/ArduinoTemplate $var;; - 'java') git clone https://github.com/Oreodave/JavaTemplate $var;; - *) return;; - esac - rm -rf $var/.git; - done -} - -gentemplateoff () { - for var in ${@:2}; do - case $1 in - 'c') cp -r ~/Code/Templates/CTemplate $var;; - 'cpp') cp -r ~/Code/Templates/CPPTemplate $var;; - 'python') cp -r ~/Code/Templates/PythonTemplate $var;; - 'node') cp -r ~/Code/Templates/NodeTemplate $var;; - 'ard') cp -r ~/Code/Templates/ArduinoTemplate $var;; - 'java') cp -r ~/Code/Templates/JavaTemplate $var;; - *) return;; - esac - rm -rf $var/.git; - done -} - -## NVM config -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion - -source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -- cgit v1.2.3-13-gbd6f