Revert "Merge branch 'macOS'"
This reverts commitba6ceea30f
, reversing changes made to43a6b71d41
.
This commit is contained in:
75
zsh/.config/zsh/.zshrc
Executable file
75
zsh/.config/zsh/.zshrc
Executable file
@ -0,0 +1,75 @@
|
||||
# User-specific zsh configuration
|
||||
|
||||
# Default umask value
|
||||
umask 0027
|
||||
|
||||
# ========== Functions ==========
|
||||
# Fuzzy-find a file and open it in less
|
||||
_run_fless() {
|
||||
fless && zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N _run_fless
|
||||
bindkey -M viins '^n' _run_fless
|
||||
|
||||
# Fuzzy find a file and then edit it
|
||||
|
||||
_run_fedit() {
|
||||
fedit && zle reset-prompt
|
||||
}
|
||||
|
||||
_run_etcedit() {
|
||||
fedit --etc && zle reset-prompt
|
||||
}
|
||||
|
||||
zle -N _run_fedit
|
||||
bindkey -M viins '^o' _run_fedit
|
||||
|
||||
zle -N _run_etcedit
|
||||
bindkey -M viins '^e' _run_etcedit
|
||||
|
||||
# Fuzzy cd from anywhere
|
||||
# Dependencies
|
||||
# * fzf
|
||||
# * mlocate
|
||||
|
||||
cf() {
|
||||
[[ -z "${*}" ]] && return 1
|
||||
[[ ! -x $(which fzf) ]] && return 1
|
||||
|
||||
#dir="$(locate --all --ignore-case --null -- "${@}" | fzf --read0 --select-1 --exit-0)"
|
||||
#dir="$(locate -0i -- "${@}" | fzf --read0 --select-1 --exit-0)"
|
||||
dir="$(fd --ignore-file "${XDG_CONFIG_HOME}/fd_ignore" --print0 --type d -- "${@}" | fzf --read0 --select-1 --exit-0)"
|
||||
|
||||
[[ -z "${dir}" ]] && return 1
|
||||
|
||||
if [[ -f "${dir}" ]]; then
|
||||
cd "${dir%/*}"
|
||||
else
|
||||
cd "${dir}"
|
||||
fi
|
||||
}
|
||||
|
||||
autoload -Uz cf
|
||||
|
||||
# Make a directory, then change into it
|
||||
|
||||
mkcd() {
|
||||
[[ ! -d "${1}" ]] && mkdir --parents -- "${1}"
|
||||
cd "${1}" || exit
|
||||
}
|
||||
|
||||
autoload -Uz mkcd
|
||||
|
||||
# Detect OS to autoload uncommon config files
|
||||
if [[ "$(uname -a)" == "Darwin" ]]; then
|
||||
for dotfile in "${XDG_CONFIG_HOME}"/zsh-macos/**/*; do
|
||||
source $dotfile
|
||||
done
|
||||
[ -f "${ZDOTDIR}/conf.d/fzf.zsh" ] && source "${ZDOTDIR}/conf.d/fzf.zsh"
|
||||
test -e /Users/etorres/.config/zsh/.iterm2_shell_integration.zsh && source /Users/etorres/.config/zsh/.iterm2_shell_integration.zsh || true
|
||||
else
|
||||
for dotfile in "${XDG_CONFIG_HOME}"/zsh-linux/**/*; do
|
||||
source $dotfile
|
||||
done
|
||||
fi
|
4
zsh/.config/zsh/conf.d/00-keybindings.zsh
Normal file
4
zsh/.config/zsh/conf.d/00-keybindings.zsh
Normal file
@ -0,0 +1,4 @@
|
||||
# bindkey -M viins '^r' history-incremental-search-backward
|
||||
# bindkey -M vicmd '^r' history-incremental-search-backward
|
||||
|
||||
# vim: syntax=zsh
|
1
zsh/.config/zsh/conf.d/README
Normal file
1
zsh/.config/zsh/conf.d/README
Normal file
@ -0,0 +1 @@
|
||||
This directory (zsh) contains files that are common between all OS installations
|
27
zsh/.config/zsh/conf.d/completion.zsh
Normal file
27
zsh/.config/zsh/conf.d/completion.zsh
Normal file
@ -0,0 +1,27 @@
|
||||
## zsh-completion-generator
|
||||
#GENCOMPL_FPATH="${HOME}/zsh-completions"
|
||||
#source '/usr/share/zsh-completion-generator/zsh-completion-generator.plugin.zsh'
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
# Tab completion menu
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||
|
||||
zstyle ':completion:*:*:kill:*' menu yes select
|
||||
zstyle ':completion:*:kill:*' force-list always
|
||||
|
||||
zstyle ':completion:*:*:killall:*' menu yes select
|
||||
zstyle ':completion:*:killall:*' force-list always
|
||||
|
||||
# Disabling this option enables tab completion for aliases
|
||||
#setopt complete_aliases
|
||||
|
||||
# Case insensitive completion
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
|
||||
# Automatically load new executables
|
||||
zstyle ':completion:*' rehash true
|
||||
|
||||
# vim: syntax=zsh
|
14
zsh/.config/zsh/conf.d/kp.zsh
Normal file
14
zsh/.config/zsh/conf.d/kp.zsh
Normal file
@ -0,0 +1,14 @@
|
||||
### PROCESS
|
||||
# mnemonic: [K]ill [P]rocess
|
||||
# show output of "ps -ef", use [tab] to select one or multiple entries
|
||||
# press [enter] to kill selected processes and go back to the process list.
|
||||
# or press [escape] to go back to the process list. Press [escape] twice to exit completely.
|
||||
|
||||
kp() {
|
||||
local pid=$(ps -ef | sed 1d | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[kill:process]'" | awk '{print $2}')
|
||||
|
||||
if [[ -n "${pid}" && "${pid}" != "x" ]]; then
|
||||
echo ${pid} | xargs kill -${1:-9}
|
||||
kp
|
||||
fi
|
||||
}
|
14
zsh/.config/zsh/conf.d/options
Normal file
14
zsh/.config/zsh/conf.d/options
Normal file
@ -0,0 +1,14 @@
|
||||
# automatically cd into a given directory
|
||||
setopt autocd
|
||||
|
||||
# history options
|
||||
setopt append_history
|
||||
setopt hist_ignore_all_dups
|
||||
|
||||
# command correction
|
||||
setopt correctall
|
||||
|
||||
# prevent accidental overwriting of a file
|
||||
setopt noclobber
|
||||
|
||||
# vim: syntax=zsh
|
35
zsh/.config/zsh/conf.d/prompt.zsh
Normal file
35
zsh/.config/zsh/conf.d/prompt.zsh
Normal file
@ -0,0 +1,35 @@
|
||||
# allows substitution in the prompt
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
# ========== VCS info ==========
|
||||
autoload -Uz vcs_info
|
||||
zstyle ':vcs_info:*' enable git
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
#zstyle ':vcs_info:git*' formats "%{$fg[grey]%} %{$fg[blue]%}%b%{$reset_color%}%m %u %c%{$reset_color%}"
|
||||
zstyle ':vcs_info:git*' formats "%{$fg[grey]%}%{$fg[blue]%}%b%{$reset_color%}%m %u %c%{$reset_color%}"
|
||||
|
||||
# ========== Vim Command Mode ==========
|
||||
vim_ins_mode='ins'
|
||||
vim_cmd_mode='cmd'
|
||||
vim_mode=${vim_ins_mode}
|
||||
|
||||
zle-keymap-select() {
|
||||
vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}"
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N zle-keymap-select
|
||||
|
||||
zle-line-finish() {
|
||||
vim_mode=${vim_ins_mode}
|
||||
}
|
||||
zle -N zle-line-finish
|
||||
|
||||
# ========== Final Prompt ==========
|
||||
precmd() {
|
||||
vcs_info
|
||||
}
|
||||
|
||||
#PS1='%F{blue}%n%f@%m %F{green}%3~%f > '
|
||||
#RPS1='%F{green}${vim_mode}%f ${vcs_info_msg_0_} [%F{red}%?%f]'
|
||||
PS1='%F{green}%3~%f %F{blue}>%f '
|
||||
RPS1='${vcs_info_msg_0_} [%F{red}%?%f]'
|
23
zsh/.config/zsh/conf.d/sudo.zsh
Normal file
23
zsh/.config/zsh/conf.d/sudo.zsh
Normal file
@ -0,0 +1,23 @@
|
||||
# Press escape twice to prepend the previous command with "sudo"
|
||||
sudo-command-line() {
|
||||
[[ -z ${BUFFER} ]] && zle up-history
|
||||
if [[ ${BUFFER} == sudo\ * ]]; then
|
||||
LBUFFER="${LBUFFER#sudo }"
|
||||
elif [[ ${BUFFER} == $EDITOR\ * ]]; then
|
||||
LBUFFER="${LBUFFER#$EDITOR }"
|
||||
LBUFFER="sudoedit $LBUFFER"
|
||||
elif [[ ${BUFFER} == sudoedit\ * ]]; then
|
||||
LBUFFER="${LBUFFER#sudoedit }"
|
||||
LBUFFER="$EDITOR $LBUFFER"
|
||||
else
|
||||
LBUFFER="sudo $LBUFFER"
|
||||
fi
|
||||
}
|
||||
|
||||
zle -N sudo-command-line
|
||||
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey -M viins "\e\e" sudo-command-line
|
||||
bindkey -M vicmd "\e\e" sudo-command-line
|
||||
|
||||
# vim: syntax=zsh
|
13
zsh/.config/zsh/conf.d/tmux.zsh
Normal file
13
zsh/.config/zsh/conf.d/tmux.zsh
Normal file
@ -0,0 +1,13 @@
|
||||
## load a tmux session
|
||||
_load_tmux() {
|
||||
if [[ -n "${TMUX}" ]]; then
|
||||
echo "Already in a tmux session."
|
||||
else
|
||||
tmux
|
||||
fi
|
||||
}
|
||||
|
||||
zle -N _load_tmux
|
||||
bindkey -M viins "^y" _load_tmux
|
||||
|
||||
# vim: syntax=zsh
|
Reference in New Issue
Block a user