From f73902496e768bd82ccd0d06d2af2633c5e30069 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Fri, 26 Jul 2013 15:16:15 +0200 Subject: [PATCH] Script: prepend + zshcd let ranger start a shell in current dir --- .config/ranger/rc.conf | 5 ++++- .scripts/prepend | 15 +++++++++++++++ .scripts/zshcd | 35 +++++++++++++++++++++++++++++++++++ .shell.d/options_zsh | 18 ++++++++++++------ 4 files changed, 66 insertions(+), 7 deletions(-) create mode 100755 .scripts/prepend create mode 100755 .scripts/zshcd diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 6291ab45..8e581e77 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -150,4 +150,7 @@ map K move up=5 map J move down=5 ## New tab in current folder. Use 'gn' for home folder. -map eval fm.tab_new('%d') \ No newline at end of file +map eval fm.tab_new('%d') + +## Start shell in current folder. Needs zshcd script. +map S shell zshcd %d \ No newline at end of file diff --git a/.scripts/prepend b/.scripts/prepend new file mode 100755 index 00000000..70d2879a --- /dev/null +++ b/.scripts/prepend @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ $# -eq 0 ] || [ "$1" = "-h" ]; then + cat < "$ZCACHE" + fi + prepend "$1" "$ZCACHE" + zsh +fi \ No newline at end of file diff --git a/.shell.d/options_zsh b/.shell.d/options_zsh index 5ce65e65..33048a95 100644 --- a/.shell.d/options_zsh +++ b/.shell.d/options_zsh @@ -1,13 +1,16 @@ ## -*- mode:sh -*- # ################################################################################ ## Zsh specific options -## Date 2011-11-19 +## Date 2013-07-26 ################################################################################ +ZCACHE=~/.cache/zsh/ +[ ! -e "$ZCACHE" ] && mkdir -p "$ZCACHE" + ##============================================================================== ## History options ##============================================================================== -HISTFILE=~/.zshistfile +HISTFILE="$ZCACHE/history" HISTSIZE=1000 SAVEHIST=1000 setopt hist_ignore_all_dups @@ -35,14 +38,16 @@ unsetopt flowcontrol ## VCS ##============================================================================== ## TODO: to be continued... -# autoload -Uz vcs_info zstyle ':vcs_info:*' enable git hg svn +# autoload -Uz vcs_info zstyle ':vcs_info:*' enable git hg # autoload -Uz vcs_info ##============================================================================== ## Directory stack ##============================================================================== -DIRSTACKFILE=~/.zdirs +## We use expanded path for DIRSTACKFILE since we need to locate it for the +## zshcd script. +DIRSTACKFILE="$HOME/.cache/zsh/dirs" if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then dirstack=( ${(f)"$(< $DIRSTACKFILE)"} ) [[ -d $dirstack[1] ]] && cd $dirstack[1] @@ -62,7 +67,7 @@ setopt pushdminus ##============================================================================== ## ??? ##============================================================================== -zstyle :compinstall filename "$HOME/.zshrc" +# zstyle :compinstall filename "$HOME/.zshrc" ##============================================================================== ## Completion @@ -72,7 +77,8 @@ zstyle :compinstall filename "$HOME/.zshrc" fpath=(~/.shell.d/completion $fpath) autoload -Uz compinit -compinit +# compinit +compinit -d "$ZCACHE/compdump" zstyle ':completion:*' menu select zstyle ':completion:*:descriptions' format '%U%B%d%b%u'