test
This commit is contained in:
commit
022533d7f3
15
.config/nvim/init.vim
Normal file
15
.config/nvim/init.vim
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
set number
|
||||||
|
set relativenumber
|
||||||
|
set shiftwidth=4
|
||||||
|
set autoindent
|
||||||
|
set mouse=a
|
||||||
|
set ic
|
||||||
|
set nocompatible
|
||||||
|
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'vim-scripts/xoria256.vim'
|
||||||
|
Plug 'vim-airline/vim-airline'
|
||||||
|
Plug 'manasthakur/vim-commentor'
|
||||||
|
Plug 'ap/vim-css-color'
|
||||||
|
call plug#end()
|
||||||
|
|
124
.zshrc
Normal file
124
.zshrc
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
# Theme
|
||||||
|
source ~/zsh/themes/minimal.zsh
|
||||||
|
|
||||||
|
# Plugins
|
||||||
|
source ~/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||||
|
source ~/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
|
||||||
|
|
||||||
|
### Aliases
|
||||||
|
|
||||||
|
# Editor
|
||||||
|
alias nv='nvim'
|
||||||
|
alias v='nvim'
|
||||||
|
alias vim='nvim'
|
||||||
|
alias dv='doas nvim'
|
||||||
|
|
||||||
|
# Pacman
|
||||||
|
alias paci='doas pacman -S'
|
||||||
|
alias pacs='pacman -Ss'
|
||||||
|
alias pacr='doas pacman -Rns'
|
||||||
|
alias pacupd='doas pacman -Syuu'
|
||||||
|
|
||||||
|
# ls
|
||||||
|
alias ls='exa'
|
||||||
|
alias ll='exa -lha'
|
||||||
|
alias la='exa -lha'
|
||||||
|
alias l='exa -lh'
|
||||||
|
|
||||||
|
# Sally
|
||||||
|
alias sally='~/sally/sally.sh'
|
||||||
|
|
||||||
|
# Fixed Ctrl + left/right arrow keys issue
|
||||||
|
bindkey "^[[1;5C" forward-word
|
||||||
|
bindkey "^[[1;5D" backward-word
|
||||||
|
|
||||||
|
# Fixed Alt + left/right arrow keys issue
|
||||||
|
bindkey "^[[1;3C" forward-word
|
||||||
|
bindkey "^[[1;3D" backward-word
|
||||||
|
|
||||||
|
# ~/.zshrc file for zsh interactive shells.
|
||||||
|
# see /usr/share/doc/zsh/examples/zshrc for examples
|
||||||
|
|
||||||
|
setopt autocd # change directory just by typing its name
|
||||||
|
#setopt correct # auto correct mistakes
|
||||||
|
setopt interactivecomments # allow comments in interactive mode
|
||||||
|
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
|
||||||
|
setopt nonomatch # hide error message if there is no match for the pattern
|
||||||
|
setopt notify # report the status of background jobs immediately
|
||||||
|
setopt numericglobsort # sort filenames numerically when it makes sense
|
||||||
|
setopt promptsubst # enable command substitution in prompt
|
||||||
|
|
||||||
|
WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
|
||||||
|
|
||||||
|
# hide EOL sign ('%')
|
||||||
|
PROMPT_EOL_MARK=""
|
||||||
|
|
||||||
|
# configure key keybindings
|
||||||
|
bindkey ' ' magic-space # do history expansion on space
|
||||||
|
bindkey '^U' backward-kill-line # ctrl + U
|
||||||
|
bindkey '^[[3;5~' kill-word # ctrl + Supr
|
||||||
|
bindkey '^[[3~' delete-char # delete
|
||||||
|
bindkey '^[[1;5C' forward-word # ctrl + ->
|
||||||
|
bindkey '^[[1;5D' backward-word # ctrl + <-
|
||||||
|
bindkey '^[[5~' beginning-of-buffer-or-history # page up
|
||||||
|
bindkey '^[[6~' end-of-buffer-or-history # page down
|
||||||
|
bindkey '^[[H' beginning-of-line # home
|
||||||
|
bindkey '^[[F' end-of-line # end
|
||||||
|
bindkey '^[[Z' undo # shift + tab undo last action
|
||||||
|
|
||||||
|
# enable completion features
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit -d ~/.cache/zcompdump
|
||||||
|
zstyle ':completion:*:*:*:*:*' menu select
|
||||||
|
zstyle ':completion:*' auto-description 'specify: %d'
|
||||||
|
zstyle ':completion:*' completer _expand _complete
|
||||||
|
zstyle ':completion:*' format 'Completing %d'
|
||||||
|
zstyle ':completion:*' group-name ''
|
||||||
|
zstyle ':completion:*' list-colors ''
|
||||||
|
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
|
||||||
|
zstyle ':completion:*' rehash true
|
||||||
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||||
|
zstyle ':completion:*' use-compctl false
|
||||||
|
zstyle ':completion:*' verbose true
|
||||||
|
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
||||||
|
|
||||||
|
# History configurations
|
||||||
|
HISTFILE=~/.zsh_history
|
||||||
|
HISTSIZE=1000
|
||||||
|
SAVEHIST=2000
|
||||||
|
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||||
|
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||||
|
setopt hist_ignore_space # ignore commands that start with space
|
||||||
|
setopt hist_verify # show command with history expansion to user before running it
|
||||||
|
#setopt share_history # share command history data
|
||||||
|
|
||||||
|
# force zsh to show the complete history
|
||||||
|
alias history="history 0"
|
||||||
|
|
||||||
|
# configure `time` format
|
||||||
|
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
|
||||||
|
|
||||||
|
# enable color support of ls, less and man, and also add handy aliases
|
||||||
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
|
export LS_COLORS="$LS_COLORS:ow=30;44:" # fix ls color for folders with 777 permissions
|
||||||
|
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
alias diff='diff --color=auto'
|
||||||
|
alias ip='ip --color=auto'
|
||||||
|
|
||||||
|
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
|
||||||
|
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
|
||||||
|
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
|
||||||
|
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
|
||||||
|
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
|
||||||
|
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
|
||||||
|
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
|
||||||
|
|
||||||
|
# Take advantage of $LS_COLORS for completion as well
|
||||||
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||||
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||||
|
fi
|
1
zsh/plugins/zsh-autosuggestions
Submodule
1
zsh/plugins/zsh-autosuggestions
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c3d4e576c9c86eac62884bd47c01f6faed043fc5
|
1
zsh/plugins/zsh-syntax-highlighting
Submodule
1
zsh/plugins/zsh-syntax-highlighting
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 143b25eb98aa3227af63bd7f04413e1b3e7888ec
|
300
zsh/themes/minimal.zsh
Normal file
300
zsh/themes/minimal.zsh
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
# Global settings
|
||||||
|
MNML_OK_COLOR="${MNML_OK_COLOR:-2}"
|
||||||
|
MNML_ERR_COLOR="${MNML_ERR_COLOR:-1}"
|
||||||
|
|
||||||
|
MNML_USER_CHAR="${MNML_USER_CHAR:-λ}"
|
||||||
|
MNML_INSERT_CHAR="${MNML_INSERT_CHAR:-›}"
|
||||||
|
MNML_NORMAL_CHAR="${MNML_NORMAL_CHAR:-·}"
|
||||||
|
MNML_ELLIPSIS_CHAR="${MNML_ELLIPSIS_CHAR:-..}"
|
||||||
|
MNML_BGJOB_MODE=${MNML_BGJOB_MODE:-4}
|
||||||
|
|
||||||
|
[ "${+MNML_PROMPT}" -eq 0 ] && MNML_PROMPT=(mnml_ssh mnml_pyenv mnml_status mnml_keymap)
|
||||||
|
[ "${+MNML_RPROMPT}" -eq 0 ] && MNML_RPROMPT=('mnml_cwd 2 0' mnml_git)
|
||||||
|
[ "${+MNML_INFOLN}" -eq 0 ] && MNML_INFOLN=(mnml_err mnml_jobs mnml_uhp mnml_files)
|
||||||
|
|
||||||
|
[ "${+MNML_MAGICENTER}" -eq 0 ] && MNML_MAGICENTER=(mnml_me_dirs mnml_me_ls mnml_me_git)
|
||||||
|
|
||||||
|
|
||||||
|
# Components
|
||||||
|
function mnml_status {
|
||||||
|
local okc="$MNML_OK_COLOR"
|
||||||
|
local errc="$MNML_ERR_COLOR"
|
||||||
|
local uchar="$MNML_USER_CHAR"
|
||||||
|
|
||||||
|
local job_ansi="0"
|
||||||
|
if [ -n "$(jobs | sed -n '$=')" ]; then
|
||||||
|
job_ansi="$MNML_BGJOB_MODE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local err_ansi="$MNML_OK_COLOR"
|
||||||
|
if [ "$MNML_LAST_ERR" != "0" ]; then
|
||||||
|
err_ansi="$MNML_ERR_COLOR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '%b' "%{\e[$job_ansi;3${err_ansi}m%}%(!.#.$uchar)%{\e[0m%}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_keymap {
|
||||||
|
local kmstat="$MNML_INSERT_CHAR"
|
||||||
|
[ "$KEYMAP" = 'vicmd' ] && kmstat="$MNML_NORMAL_CHAR"
|
||||||
|
printf '%b' "$kmstat"
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_cwd {
|
||||||
|
local echar="$MNML_ELLIPSIS_CHAR"
|
||||||
|
local segments="${1:-2}"
|
||||||
|
local seg_len="${2:-0}"
|
||||||
|
|
||||||
|
local _w="%{\e[0m%}"
|
||||||
|
local _g="%{\e[38;5;244m%}"
|
||||||
|
|
||||||
|
if [ "$segments" -le 0 ]; then
|
||||||
|
segments=0
|
||||||
|
fi
|
||||||
|
if [ "$seg_len" -gt 0 ] && [ "$seg_len" -lt 4 ]; then
|
||||||
|
seg_len=4
|
||||||
|
fi
|
||||||
|
local seg_hlen=$((seg_len / 2 - 1))
|
||||||
|
|
||||||
|
local cwd="%${segments}~"
|
||||||
|
cwd="${(%)cwd}"
|
||||||
|
cwd=("${(@s:/:)cwd}")
|
||||||
|
|
||||||
|
local pi=""
|
||||||
|
for i in {1..${#cwd}}; do
|
||||||
|
pi="$cwd[$i]"
|
||||||
|
if [ "$seg_len" -gt 0 ] && [ "${#pi}" -gt "$seg_len" ]; then
|
||||||
|
cwd[$i]="${pi:0:$seg_hlen}$_w$echar$_g${pi: -$seg_hlen}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
printf '%b' "$_g${(j:/:)cwd//\//$_w/$_g}$_w"
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_git {
|
||||||
|
local statc="%{\e[0;3${MNML_OK_COLOR}m%}" # assume clean
|
||||||
|
local bname="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"
|
||||||
|
|
||||||
|
if [ -n "$bname" ]; then
|
||||||
|
if [ -n "$(git status --porcelain 2> /dev/null)" ]; then
|
||||||
|
statc="%{\e[0;3${MNML_ERR_COLOR}m%}"
|
||||||
|
fi
|
||||||
|
printf '%b' "$statc$bname%{\e[0m%}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_hg {
|
||||||
|
local statc="%{\e[0;3${MNML_OK_COLOR}m%}" # assume clean
|
||||||
|
local bname="$(hg branch 2> /dev/null)"
|
||||||
|
if [ -n "$bname" ]; then
|
||||||
|
if [ -n "$(hg status 2> /dev/null)" ]; then
|
||||||
|
statc="%{\e[0;3${MNML_ERR_COLOR}m%}"
|
||||||
|
fi
|
||||||
|
printf '%b' "$statc$bname%{\e[0m%}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_hg_no_color {
|
||||||
|
# Assume branch name is clean
|
||||||
|
local statc="%{\e[0;3${MNML_OK_COLOR}m%}"
|
||||||
|
local bname=""
|
||||||
|
# Defines path as current directory
|
||||||
|
local current_dir=$PWD
|
||||||
|
# While current path is not root path
|
||||||
|
while [[ $current_dir != '/' ]]
|
||||||
|
do
|
||||||
|
if [[ -d "${current_dir}/.hg" ]]
|
||||||
|
then
|
||||||
|
if [[ -f "$current_dir/.hg/branch" ]]
|
||||||
|
then
|
||||||
|
bname=$(<"$current_dir/.hg/branch")
|
||||||
|
else
|
||||||
|
bname="default"
|
||||||
|
fi
|
||||||
|
printf '%b' "$statc$bname%{\e[0m%}"
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
# Defines path as parent directory and keeps looking for :)
|
||||||
|
current_dir="${current_dir:h}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_uhp {
|
||||||
|
local _w="%{\e[0m%}"
|
||||||
|
local _g="%{\e[38;5;244m%}"
|
||||||
|
local cwd="%~"
|
||||||
|
cwd="${(%)cwd}"
|
||||||
|
|
||||||
|
printf '%b' "$_g%n$_w@$_g%m$_w:$_g${cwd//\//$_w/$_g}$_w"
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_ssh {
|
||||||
|
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
||||||
|
printf '%b' "$(hostname -s)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_pyenv {
|
||||||
|
if [ -n "$VIRTUAL_ENV" ]; then
|
||||||
|
_venv="$(basename $VIRTUAL_ENV)"
|
||||||
|
printf '%b' "${_venv%%.*}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_err {
|
||||||
|
local _w="%{\e[0m%}"
|
||||||
|
local _err="%{\e[3${MNML_ERR_COLOR}m%}"
|
||||||
|
|
||||||
|
if [ "${MNML_LAST_ERR:-0}" != "0" ]; then
|
||||||
|
printf '%b' "$_err$MNML_LAST_ERR$_w"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_jobs {
|
||||||
|
local _w="%{\e[0m%}"
|
||||||
|
local _g="%{\e[38;5;244m%}"
|
||||||
|
|
||||||
|
local job_n="$(jobs | sed -n '$=')"
|
||||||
|
if [ "$job_n" -gt 0 ]; then
|
||||||
|
printf '%b' "$_g$job_n$_w&"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_files {
|
||||||
|
local _ls="$(env which ls)"
|
||||||
|
local _w="%{\e[0m%}"
|
||||||
|
local _g="%{\e[38;5;244m%}"
|
||||||
|
|
||||||
|
local a_files="$($_ls -1A | sed -n '$=')"
|
||||||
|
local v_files="$($_ls -1 | sed -n '$=')"
|
||||||
|
local h_files="$((a_files - v_files))"
|
||||||
|
|
||||||
|
local output="${_w}[$_g${v_files:-0}"
|
||||||
|
if [ "${h_files:-0}" -gt 0 ]; then
|
||||||
|
output="$output $_w($_g$h_files$_w)"
|
||||||
|
fi
|
||||||
|
output="$output${_w}]"
|
||||||
|
|
||||||
|
printf '%b' "$output"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Magic enter functions
|
||||||
|
function mnml_me_dirs {
|
||||||
|
local _w="\e[0m"
|
||||||
|
local _g="\e[38;5;244m"
|
||||||
|
|
||||||
|
if [ "$(dirs -p | sed -n '$=')" -gt 1 ]; then
|
||||||
|
local stack="$(dirs)"
|
||||||
|
echo "$_g${stack//\//$_w/$_g}$_w"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_me_ls {
|
||||||
|
if [ "$(uname)" = "Darwin" ] && ! ls --version &> /dev/null; then
|
||||||
|
COLUMNS=$COLUMNS CLICOLOR_FORCE=1 ls -C -G -F
|
||||||
|
else
|
||||||
|
env ls -C -F --color="always" -w $COLUMNS
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function mnml_me_git {
|
||||||
|
git -c color.status=always status -sb 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wrappers & utils
|
||||||
|
# join outpus of components
|
||||||
|
function _mnml_wrap {
|
||||||
|
local -a arr
|
||||||
|
arr=()
|
||||||
|
local cmd_out=""
|
||||||
|
local cmd
|
||||||
|
for cmd in ${(P)1}; do
|
||||||
|
cmd_out="$(eval "$cmd")"
|
||||||
|
if [ -n "$cmd_out" ]; then
|
||||||
|
arr+="$cmd_out"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
printf '%b' "${(j: :)arr}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# expand string as prompt would do
|
||||||
|
function _mnml_iline {
|
||||||
|
echo "${(%)1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# display magic enter
|
||||||
|
function _mnml_me {
|
||||||
|
local -a output
|
||||||
|
output=()
|
||||||
|
local cmd_out=""
|
||||||
|
local cmd
|
||||||
|
for cmd in $MNML_MAGICENTER; do
|
||||||
|
cmd_out="$(eval "$cmd")"
|
||||||
|
if [ -n "$cmd_out" ]; then
|
||||||
|
output+="$cmd_out"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
printf '%b' "${(j:\n:)output}" | less -XFR
|
||||||
|
}
|
||||||
|
|
||||||
|
# capture exit status and reset prompt
|
||||||
|
function _mnml_zle-line-init {
|
||||||
|
MNML_LAST_ERR="$?" # I need to capture this ASAP
|
||||||
|
zle reset-prompt
|
||||||
|
}
|
||||||
|
|
||||||
|
# redraw prompt on keymap select
|
||||||
|
function _mnml_zle-keymap-select {
|
||||||
|
zle reset-prompt
|
||||||
|
}
|
||||||
|
|
||||||
|
# draw infoline if no command is given
|
||||||
|
function _mnml_buffer-empty {
|
||||||
|
if [ -z "$BUFFER" ]; then
|
||||||
|
_mnml_iline "$(_mnml_wrap MNML_INFOLN)"
|
||||||
|
_mnml_me
|
||||||
|
zle redisplay
|
||||||
|
else
|
||||||
|
zle accept-line
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# properly bind widgets
|
||||||
|
# see: https://github.com/zsh-users/zsh-syntax-highlighting/blob/1f1e629290773bd6f9673f364303219d6da11129/zsh-syntax-highlighting.zsh#L292-L356
|
||||||
|
function _mnml_bind_widgets() {
|
||||||
|
zmodload zsh/zleparameter
|
||||||
|
|
||||||
|
local -a to_bind
|
||||||
|
to_bind=(zle-line-init zle-keymap-select buffer-empty)
|
||||||
|
|
||||||
|
typeset -F SECONDS
|
||||||
|
local zle_wprefix=s$SECONDS-r$RANDOM
|
||||||
|
|
||||||
|
local cur_widget
|
||||||
|
for cur_widget in $to_bind; do
|
||||||
|
case "${widgets[$cur_widget]:-""}" in
|
||||||
|
user:_mnml_*);;
|
||||||
|
user:*)
|
||||||
|
zle -N $zle_wprefix-$cur_widget ${widgets[$cur_widget]#*:}
|
||||||
|
eval "_mnml_ww_${(q)zle_wprefix}-${(q)cur_widget}() { _mnml_${(q)cur_widget}; zle ${(q)zle_wprefix}-${(q)cur_widget} }"
|
||||||
|
zle -N $cur_widget _mnml_ww_$zle_wprefix-$cur_widget
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
zle -N $cur_widget _mnml_$cur_widget
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Setup
|
||||||
|
autoload -U colors && colors
|
||||||
|
setopt prompt_subst
|
||||||
|
|
||||||
|
PROMPT='$(_mnml_wrap MNML_PROMPT) '
|
||||||
|
RPROMPT='$(_mnml_wrap MNML_RPROMPT)'
|
||||||
|
|
||||||
|
_mnml_bind_widgets
|
||||||
|
|
||||||
|
bindkey -M main "^M" buffer-empty
|
||||||
|
bindkey -M vicmd "^M" buffer-empty
|
Loading…
Reference in New Issue
Block a user