commit 4228e73cb341bd464b659363689c602eada78fe2
parent c2f540c5f81629ac22b32352cb4a8f0b38277929
Author: Anders Damsgaard <andersd@riseup.net>
Date: Tue, 10 Oct 2017 11:13:12 -0400
show syntax-highlighted preview in fzf
Diffstat:
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/init/30_macos_recipes.sh b/init/30_macos_recipes.sh
@@ -30,6 +30,7 @@ brews=(
gnupg
homebrew/science/paraview
htop-osx
+ highlight
id3v2
imagemagick
imapfilter
diff --git a/links/.tmux.conf b/links/.tmux.conf
@@ -116,8 +116,7 @@ set -g status-fg cyan
#set -g status-right "#[fg=green]#H"
set -g status-left-length 40
set -g status-left "#[fg=red]#(hostname|sed \"s/\\\\..*$//\") #[fg=green]s:#S #[fg=yellow]w:#I #[fg=cyan]p:#P"
-#set -g status-right-length 60
-set -g status-right-length "#(echo $COLUMNS/2|bc)"
+set -g status-right-length 60
if-shell 'uname | grep -qi Darwin' "set -g status-right \"#[fg=#81a2be]#(/usr/local/bin/mpc | head -n 1 | sed 's/volume.*$//' | cut -c 1-22) #[fg=cyan]#(~/bin/battery-osx) #(~/bin/mailstatus.sh) #[fg=yellow]#(uptime|sed 's/.* //') #[fg=green]%Y-%m-%d %R\""
if-shell 'uname | grep -qi Linux' "set -g status-right \"#[fg=cyan]#(acpi|sed 's/Battery//; s/0://; s/Discharging//; s/Full, //; s/remaining//; s/ , //; s/Charging, /+/; s/ until charged/ /; s/, / /; s/Unknown //; s/ $//;') #(~/bin/mailstatus.sh) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=green]%Y-%m-%d %R\""
@@ -202,3 +201,9 @@ bind-key M new-window -n mutt "mutt"
bind-key V new-window -n vim "vim"
bind-key P new-window -n vimpc "vimpc"
bind-key Enter new-window "tmux set status-right-length `echo $(tput cols)/3|bc|tr -d '\n'`; tmux set status-left-length `echo $(tput cols)/3|bc|tr -d '\n'`; $SHELL"
+#bind-key Enter new-window
+
+#set-hook client-resized "tmux set status-right-length `echo $(tmux display -p '#{client_width}')/3|bc|tr -d '\n'`; tmux set status-left-length `echo $(tmux display -p '#{client_width}'put cols)/3|bc|tr -d '\n'`"
+#set-hook client-resized "display '#{client_width}'"
+#set-hook client-resized 'display "#(tmux display -p \'#{client_width}/3\'|bc|tr -d \'\n\')"'
+#set-hook client-resized "display '#(tmux display -p \'#{client_width}\'|tr -d \'\n\')'"
diff --git a/links/.zshrc b/links/.zshrc
@@ -308,5 +308,7 @@ export GPG_TTY=`tty`
# trigger fzf completion by entering **<TAB> or <Pattern>**<TAB>
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
+#export FZF_DEFAULT_OPTS="--preview '[[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500'"
+export FZF_DEFAULT_OPTS="--preview '(highlight -O ansi -l {} || coderay {} || rougify{}) 2> /dev/null || head -500 {}'"
[ -d ~/code/tensorflow ] && alias tensorflow='source ~/code/tensorflow/bin/activate'