forked from sorin-ionescu/prezto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
82 lines (65 loc) · 2.63 KB
/
zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- mode: sh; eval: (sh-set-shell "zsh") -*-
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# simple plain prompt for emacs tramp sessions
[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# add any other locals to fpath BEFORE running zprezto init (compinit caching)
if [[ -f ${ZDOTDIR:-$HOME}/.zsh/completions.zsh ]] ; then
source ${ZDOTDIR:-$HOME}/.zsh/completions.zsh
fi
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# custom aliases in ~/.zsh/aliases.zsh
if [[ -f ${ZDOTDIR:-$HOME}/.zsh/aliases.zsh ]] ; then
source ${ZDOTDIR:-$HOME}/.zsh/aliases.zsh
fi
# Customize to your needs.
# Turn off all beeps
#unsetopt BEEP
# Turn off autocomplete beeps
unsetopt LIST_BEEP
# # Use emacs keybindings even if our EDITOR is set to vi
# bindkey -e
# https://github.com/mika/zsh-pony#remove-last-part-from-directory-name
# Remove last part from directory name
slash-backward-kill-word() {
local WORDCHARS="${WORDCHARS:s@/@}"
zle backward-kill-word
}
zle -N slash-backward-kill-word
# bind to <esc>-<backspace>
bindkey '\e^?' slash-backward-kill-word
# https://github.com/mika/zsh-pony#insert-a-timestamp-on-the-command-line-yyyy-mm-dd
# Insert a Date timestamp on the command line (yyyy-mm-dd)
insert-datestamp() { LBUFFER+=${(%):-'%D{%Y-%m-%d}'}; }
zle -N insert-datestamp
bindkey '^Ed' insert-datestamp
# https://iterm2.com/documentation-shell-integration.html
# only source if we are on macOS, for now
if [[ "$(uname -s)" == 'Darwin' ]] ; then
# handles xterm-256color tmux-256color
# shellcheck source=/dev/null
[[ "$TERM" == *-256color ]] && test -e "${shell_config}/.iterm2_shell_integration.zsh" && source "${shell_config}/.iterm2_shell_integration.zsh"
fi
# Secure shellfish (iOS app) integration
if [[ "$LC_TERMINAL" = "ShellFish" ]]; then
unalias pbcopy 2> /dev/null
# unalias avoids error:
# .shellfishrc: defining function based on alias `pbcopy`
#[[ ! -f ~/.shellfishrc ]] || source ~/.shellfishrc
test -e "$HOME/.shellfishrc" && source "$HOME/.shellfishrc"
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh