~hokiegeek/dotfiles

ref: 4e6ab260a70c263d6e89767a6e2750dc1c6c22a9 dotfiles/zshrc -rw-r--r-- 5.1 KiB
4e6ab260HokieGeek Fixing issue with fzf-tab startup 1 year, 10 months ago
                                                                                
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
[[ $- != *i* ]] && return
[[ -z "$TMUX" && -z "$SSH_CLIENT" ]] && { `which tmux >/dev/null 2>&1` && exec tmux }

# Completion {{{
autoload -Uz compinit && compinit # Turn on tab completion
# autoload -Uz promptinit && promptinit # Prompt themes
setopt complete_in_word   # Allow tab completion in the middle of a word
setopt always_to_end      # When completing from the middle of a word, move the cursor to the end of the word
setopt auto_list          # Automatically list choices
setopt list_ambiguous     # Complete a word up to where it becomes ambiguous
setopt auto_remove_slash  # Remove an inserted slash when not needed
setopt complete_aliases   # ??

[ -f $HOME/.shell-plugins/zsh/fzf-tab/fzf-tab.plugin.zsh ] && {
    source $HOME/.shell-plugins/zsh/fzf-tab/fzf-tab.plugin.zsh
}

zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' menu select=2
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} 
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*:functions' ignored-patterns '_*' # Don't complete on commands I don't have

# Disable completion on CVS files
zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'

# Prettier kill auto completion
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*'   force-list always

zstyle ':completion:*:cd:*' ignore-parents parent pwd

[ -f $HOME/.shell-plugins/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh ] && {
    source $HOME/.shell-plugins/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
    zle -N autosuggest-start
}

[ -e /usr/share/doc/pkgfile/command-not-found.zsh ] && source /usr/share/doc/pkgfile/command-not-found.zsh

setopt correct # Spelling correction of commands
#enable-fzf-tab

# }}}

# History {{{
HISTFILE=~/.histfile
HISTSIZE=1024
SAVEHIST=1024
setopt append_history        # Append to the history file
setopt inc_append_history    # Add to history file as commands are typed
setopt hist_ignore_all_dups  # Do not add dupes
setopt hist_ignore_space     # Ignore commands which start with a space
setopt hist_no_store         # Remove the history command from the command history
# }}}

# Vimify {{{
export EDITOR="vim"
setopt vi

bindkey -M vicmd v edit-command-line
bindkey -M vicmd '?' history-incremental-search-backward
zle -N edit-command-line
autoload -Uz edit-command-line

# allow ctrl-p, ctrl-n for navigate history (standard behaviour)
bindkey '^P' up-history
bindkey '^N' down-history

# allow ctrl-h, ctrl-w, ctrl-? for char and word deletion (standard behaviour)
bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
# }}}

# Term Colors {{{
# Colorized man pages
export LESS_TERMCAP_mb=$(printf "\e[1;31m")     # being blinking
export LESS_TERMCAP_md=$(printf "\e[1;34m")     # begin bold
export LESS_TERMCAP_me=$(printf "\e[0m")        # end mode
export LESS_TERMCAP_se=$(printf "\e[0m")        # end standout-mode
export LESS_TERMCAP_so=$(printf "\e[1;44;33m")  # begin standout-mode - info box
export LESS_TERMCAP_ue=$(printf "\e[0m")        # end underline
export LESS_TERMCAP_us=$(printf "\e[1;32m")     # begin underline
# }}}

# PATHing {{{
export GOPATH=${HOME}/go
export PATH=${PATH}:/sbin:/usr/sbin:/usr/local/sbin
export PATH=${PATH}:${GOPATH}/bin:~/.bin
# }}}

# Misc {{{
## Get notified when someone logs in
# watch=all                       # watch all logins
# logcheck=30                     # every 30 seconds
# WATCHFMT="%n from %M has %a tty%l at %T %W"

alias fuckit="autoload -U tetris && tetris" # heh

# Changing directories
setopt auto_cd           # Just use the name of a directory to CD to it
setopt auto_pushd        # Uses pushd instead of cd
setopt pushd_ignore_dups # Don't push multiple copies of the same directory to the stack
setopt pushd_to_home     # pushd without an argument goes to home
setopt pushd_silent      # Do not print directory stack after pushd or popd

# Expansions
setopt extendedglob      # Use advanced expansion (#,~,^)
setopt nomatch           # Print error when filename pattern doesn't match

setopt hist_subst_pattern # Allow pattern matching with :s
unsetopt beep

# Job control
# unsetopt notify           # Wait until a prompt needs to be printing before notifying that bg job has stopped
unsetopt bg_nice          # Run bg'ed processes at regular priority

autoload zmv # Fancy mv command

## Fixes backspace "issue"
function zle-line-init () { echoti smkx }
function zle-line-finish () { echoti rmkx }
zle -N zle-line-init
zle -N zle-line-finish

which get-browser >/dev/null 2>&1 && export BROWSER=$(get-browser)

if [[ -f /usr/local/bin/z.sh ]]; then
    export _Z_CMD=d
    . /usr/local/bin/z.sh
fi

## Fixes issuse with fzf-tab not correctly intializing
[ -f $HOME/.shell-plugins/zsh/fzf-tab/fzf-tab.plugin.zsh ] && {
    disable-fzf-tab
    enable-fzf-tab
}
# }}}

# Source the things {{{
. $HOME/.aliases
. $HOME/.shell-plugins/prompt.zsh

[ -f $HOME/.zshrc_alt ] && . $HOME/.zshrc_alt
# }}}
# 
# # vim: set ft=sh foldmethod=marker:
# 
#