Selaa lähdekoodia

sfz prompt customisation

Tom McKenzie 7 vuotta sitten
vanhempi
sitoutus
a044a51611
5 muutettua tiedostoa jossa 62 lisäystä ja 5 poistoa
  1. 6 0
      .rc.d/aliases.sh
  2. 3 0
      .zshrc.d/bindkey.sh
  3. 28 5
      .zshrc.d/zgen.zsh
  4. 20 0
      bin/chrome-tabs
  5. 5 0
      bin/get-iterm2-buffer

+ 6 - 0
.rc.d/aliases.sh

@@ -5,3 +5,9 @@ alias l='ls -CF'
 
 # http
 alias start-http='python -m SimpleHTTPServer'
+
+# osx-only aliases
+if [[ "$(uname -s)" = 'Darwin' ]]; then
+  alias get-buffer="$HOME/dotfiles/bin/get-iterm2-buffer"
+  alias chrome-tabs="$HOME/dotfiles/bin/chrome-tabs"
+fi

+ 3 - 0
.zshrc.d/bindkey.sh

@@ -19,3 +19,6 @@ bindkey '^[[1~' beginning-of-line # tmux
 
 bindkey '^[[F' end-of-line # iterm
 bindkey '^[[4~' end-of-line # tmux
+
+export HIST_IGNORE_DUPS="1"
+export HIST_REDUCE_BLANKS="1"

+ 28 - 5
.zshrc.d/zgen.zsh

@@ -10,22 +10,26 @@ source "${HOME}/.zgen/zgen.zsh"
 
 # if the init scipt doesn't exist
 if ! zgen saved; then
-  echo "Saving zgen config"
+  echo "setting up zgen"
+
+  # completions
+  zgen load zsh-users/zsh-completions src
 
   # bulk load
   zgen loadall <<EOPLUGINS
     mreinhardt/sfz-prompt.zsh
+    zsh-users/zsh-autosuggestions
+    zsh-users/zsh-history-substring-search
+    zsh-users/zsh-syntax-highlighting
 EOPLUGINS
   # ^ can't indent this EOPLUGINS
 
-  # completions
-  zgen load zsh-users/zsh-completions src
-
   # save all to init script
   zgen save
 fi
 
-# customise sfz-prompt color palette
+# customise sfz-prompt
+
 PROMPT_SFZ_CHAR="›"
 
 prompt_sfz_colors () {
@@ -51,3 +55,22 @@ prompt_sfz_colors () {
     esac
 }
 
+prompt_sfz_git_dirty() {
+  # too expensive
+}
+
+# customise zsh-history-substring-search
+HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bold"
+HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND="none"
+bindkey '^[[A' history-substring-search-up
+bindkey '^[[B' history-substring-search-down
+setopt HIST_FIND_NO_DUPS
+
+# customise zsh-syntax-highlighting
+ZSH_HIGHLIGHT_STYLES[unknown-token]='none'
+ZSH_HIGHLIGHT_STYLES[path]='bold'
+
+ZSH_HIGHLIGHT_STYLES[builtin]='fg=82'
+ZSH_HIGHLIGHT_STYLES[command]='fg=121'
+ZSH_HIGHLIGHT_STYLES[alias]='fg=193'
+ZSH_HIGHLIGHT_STYLES[globbing]='fg=white'

+ 20 - 0
bin/chrome-tabs

@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Originally by @philsnow on the xooglers slack
+
+ts () {
+  date +'%Fz%T'
+}
+
+chrome_tabs () {
+  for win in $(seq 0 $(osascript -e 'tell application "Chrome" to get count every window'))
+  do
+    for tab in $(seq 0 $(osascript -e "tell application \"Chrome\" to get count every tab of window ${win}"))
+    do
+      echo -n "win $win tab $tab: "
+      osascript -e "tell application \"Chrome\" to get URL of tab $tab of window $win"
+    done
+  done
+}
+
+chrome_tabs

+ 5 - 0
bin/get-iterm2-buffer

@@ -0,0 +1,5 @@
+#! /usr/bin/env osascript
+
+tell app "iTerm2" to tell current session of first window
+    contents
+end tell