aboutsummaryrefslogtreecommitdiff
path: root/templates/.zsh/config.zsh
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-08-13 23:33:32 -0400
committerBen Burwell <ben@benburwell.com>2019-08-13 23:33:32 -0400
commit8e4d61fb77ed68f896b6fe3dc0bbbcd078668ede (patch)
treed521e523316d239caea0bf4a35ce851236dad53e /templates/.zsh/config.zsh
parent7d4c541a0d4f09eb421425f8d49b65308d9e6cfd (diff)
zsh: adopt
Diffstat (limited to 'templates/.zsh/config.zsh')
-rw-r--r--templates/.zsh/config.zsh47
1 files changed, 47 insertions, 0 deletions
diff --git a/templates/.zsh/config.zsh b/templates/.zsh/config.zsh
new file mode 100644
index 0000000..e4ee650
--- /dev/null
+++ b/templates/.zsh/config.zsh
@@ -0,0 +1,47 @@
+HISTFILE=~/.zsh_history
+HISTSIZE=10000
+SAVEHIST=10000
+
+setopt APPEND_HISTORY
+setopt AUTO_CD
+setopt COMPLETE_IN_WORD
+setopt CORRECT
+setopt EXTENDED_GLOB
+setopt EXTENDED_HISTORY
+setopt HIST_IGNORE_ALL_DUPS
+setopt HIST_REDUCE_BLANKS
+setopt HIST_VERIFY
+setopt INC_APPEND_HISTORY
+setopt LOCAL_OPTIONS
+setopt LOCAL_TRAPS
+setopt NO_BG_NICE
+setopt NO_HUP
+setopt NO_LIST_BEEP
+setopt PROMPT_SUBST
+
+# open a file for editing by choosing with fzf
+fzf-open-file-or-dir() {
+ local cmd="command find -L . \
+ \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \
+ -o -type f -print \
+ -o -type d -print \
+ -o -type l -print 2> /dev/null | sed 1d | cut -b3-"
+ local out=$(eval $cmd | fzf --exit-0)
+ if [ -f "$out" ]; then
+ $EDITOR "$out" < /dev/tty
+ elif [ -d "$out" ]; then
+ cd "$out"
+ zle reset-prompt
+ fi
+}
+zle -N fzf-open-file-or-dir
+
+bindkey '^[^[[D' backward-word
+bindkey '^[^[[C' forward-word
+bindkey '^[[5D' beginning-of-line
+bindkey '^[[5C' end-of-line
+bindkey '^[[3~' delete-char
+bindkey '^[^N' newtab
+bindkey '^?' backward-delete-char
+bindkey '^R' history-incremental-search-backward
+bindkey '^P' fzf-open-file-or-dir