From 2bd0bb8bfd5b2fa232d42f70746b21cfea7ada3a Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sun, 21 Feb 2016 23:01:14 +0300 Subject: [PATCH] fixes --- .gitmodules | 3 +++ zsh/highlighting | 3 ++- zsh/prompt | 2 +- zsh/websearch | 25 +++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index a618dfd..447f5e6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "zsh/zsh-syntax-highlighting"] path = zsh/zsh-syntax-highlighting url = https://github.com/zsh-users/zsh-syntax-highlighting.git +[submodule "zsh/zsh-autosuggestions"] + path = zsh/zsh-autosuggestions + url = https://github.com/tarruda/zsh-autosuggestions diff --git a/zsh/highlighting b/zsh/highlighting index 54b1a44..cfed93c 100644 --- a/zsh/highlighting +++ b/zsh/highlighting @@ -5,7 +5,8 @@ else source "$HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" fi ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=black' - +bindkey '^ ' autosuggest-accept +bindkey '^B' autosuggest-clear # highlighting if [[ -a "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]]; then diff --git a/zsh/prompt b/zsh/prompt index 66d8e1a..c6ef34d 100644 --- a/zsh/prompt +++ b/zsh/prompt @@ -22,7 +22,7 @@ precmd() { local _bat_perc=0 local _num=0 local _bat - for _bat in /sys/class/power_supply/BAT*; do + for _bat in /sys/class/power_supply/BAT*; do let "_bat_perc += $(cat ${_bat}/capacity)" let "_num += 1" done diff --git a/zsh/websearch b/zsh/websearch index d3bf97d..a31afe5 100644 --- a/zsh/websearch +++ b/zsh/websearch @@ -1,5 +1,30 @@ # web_search from terminal +function open_command() { + emulate -L zsh + setopt shwordsplit + + local open_cmd + + # define the open command + case "$OSTYPE" in + darwin*) open_cmd='open' ;; + cygwin*) open_cmd='cygstart' ;; + linux*) open_cmd='xdg-open' ;; + msys*) open_cmd='start ""' ;; + *) echo "Platform $OSTYPE not supported" + return 1 + ;; + esac + + # don't use nohup on OSX + if [[ "$OSTYPE" == darwin* ]]; then + $open_cmd "$@" &>/dev/null + else + nohup $open_cmd "$@" &>/dev/null + fi +} + function web_search() { emulate -L zsh