From d47a7221924b4fa0b1859913d505f50a6c276da1 Mon Sep 17 00:00:00 2001 From: Marco De Bortoli Date: Tue, 1 Nov 2016 15:49:50 +1100 Subject: PHP suffix alias should be removed PHP can be executed as CLI script but due to the automated attempt to add browser support to that extension such ability is prevented in certain circumstances. --- plugins/common-aliases/common-aliases.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 128db6e5f..0908c8a38 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -54,7 +54,7 @@ alias mv='mv -i' # depends on the SUFFIX :) if is-at-least 4.2.0; then # open browser on urls - _browser_fts=(htm html de org net com at cx nl se dk dk php) + _browser_fts=(htm html de org net com at cx nl se dk dk) for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) -- cgit v1.2.3-70-g09d2 From fc4e0cd7ba47bc87fe707f2bac8edb3461cfdd36 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 2 Nov 2016 11:02:58 +0100 Subject: common-aliases: check if $BROWSER is defined on browser aliases --- plugins/common-aliases/common-aliases.plugin.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 0908c8a38..e888ff076 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -54,8 +54,10 @@ alias mv='mv -i' # depends on the SUFFIX :) if is-at-least 4.2.0; then # open browser on urls - _browser_fts=(htm html de org net com at cx nl se dk dk) - for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done + if [[ -n "$BROWSER" ]]; then + _browser_fts=(htm html de org net com at cx nl se dk dk) + for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done + fi _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done -- cgit v1.2.3-70-g09d2 From cb26c2f6145ab36a2bb3b3d5392959cf741f2608 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 2 Nov 2016 11:03:47 +0100 Subject: common-aliases: minor style fixes --- plugins/common-aliases/common-aliases.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index e888ff076..d47b20e40 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -56,17 +56,17 @@ if is-at-least 4.2.0; then # open browser on urls if [[ -n "$BROWSER" ]]; then _browser_fts=(htm html de org net com at cx nl se dk dk) - for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done + for ft in $_browser_fts; do alias -s $ft=$BROWSER; done fi _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) - for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done + for ft in $_editor_fts; do alias -s $ft=$EDITOR; done _image_fts=(jpg jpeg png gif mng tiff tif xpm) - for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done + for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) - for ft in $_media_fts ; do alias -s $ft=mplayer ; done + for ft in $_media_fts; do alias -s $ft=mplayer; done #read documents alias -s pdf=acroread -- cgit v1.2.3-70-g09d2 From 0f62b7a8d8708910e75fedb9d7b8e3d8559a34da Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 2 Nov 2016 11:17:58 +0100 Subject: common-aliases: check if `$XIVIEWER` is defined and minor fixes --- plugins/common-aliases/common-aliases.plugin.zsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index d47b20e40..742798f27 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -55,15 +55,17 @@ alias mv='mv -i' if is-at-least 4.2.0; then # open browser on urls if [[ -n "$BROWSER" ]]; then - _browser_fts=(htm html de org net com at cx nl se dk dk) + _browser_fts=(htm html de org net com at cx nl se dk) for ft in $_browser_fts; do alias -s $ft=$BROWSER; done fi _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) for ft in $_editor_fts; do alias -s $ft=$EDITOR; done - _image_fts=(jpg jpeg png gif mng tiff tif xpm) - for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done + if [[ -n "$XIVIEWER" ]]; then + _image_fts=(jpg jpeg png gif mng tiff tif xpm) + for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done + fi _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) for ft in $_media_fts; do alias -s $ft=mplayer; done @@ -85,4 +87,3 @@ fi # Make zsh know about hosts already accessed by SSH zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' - -- cgit v1.2.3-70-g09d2 From 73591101b6db1e67ad3a0c2f90c81bc8174f4056 Mon Sep 17 00:00:00 2001 From: psprint Date: Wed, 2 Nov 2016 13:08:58 +0100 Subject: znt: Update to v2.2.7 (#5576) --- plugins/zsh-navigation-tools/NEWS | 17 +++++++ plugins/zsh-navigation-tools/README.md | 54 ++++++++++++++++++++++ plugins/zsh-navigation-tools/n-history | 32 +++++++++---- plugins/zsh-navigation-tools/n-list | 3 +- plugins/zsh-navigation-tools/znt-tmux.zsh | 50 ++++++++++++++++++++ .../zsh-navigation-tools.plugin.zsh | 35 ++++++++------ 6 files changed, 167 insertions(+), 24 deletions(-) create mode 100644 plugins/zsh-navigation-tools/NEWS create mode 100755 plugins/zsh-navigation-tools/znt-tmux.zsh (limited to 'plugins') diff --git a/plugins/zsh-navigation-tools/NEWS b/plugins/zsh-navigation-tools/NEWS new file mode 100644 index 000000000..acd9f2ebc --- /dev/null +++ b/plugins/zsh-navigation-tools/NEWS @@ -0,0 +1,17 @@ +------------------------------------- +CHANGES FROM PREVIOUS VERSIONS OF ZNT +------------------------------------- + +Changes from 2.2.1 to 2.2.7 +--------------------------- + +Tmux integration has been added – bind file znt-tmux.zsh in Tmux as +described in README.md and e.g. run local history on remote hosts. Tmux +opens new window with n-history, and pastes selected history entry into +immediate previous window (e.g. a remote session). Fixed plugin.zsh file +to not use (outer scope) positional parameters. This fixes problem with +Grlm's Zsh configuration. The file now doesn't use "test" builtin (but +[[ instead), because it can be shadowed by alias or command. Private +history has been fixed to not overwrite its history file with the same +content. This improves performance when switching to private history +view. diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 7a679fe67..ed532a161 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -34,6 +34,60 @@ want to copy your previous data (from e.g. ~/.zhistory) into the new location. ## News +* 06-10-2016 + - Tmux-integration – Ctrl-b-h in Tmux to open n-history in new window. + Then select history entry, it will be copied to the original Tmux window. + Use this to execute local commands on remote hosts. All that is needed is + this line added to ~/.tmux.conf: + + bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" + +* 16-05-2016 + - n-kill has completion. It proposes *words* from what's in `ps -A`. Giving n-kill + arguments means grepping – it will start only with matching `ps` entries. + +* 15-05-2016 + - Fixed problem where zsh-syntax-highlighting could render n-history slow (for + long history entries). + +* 14-05-2016 + - Configuration can be set from zshrc. Example: + + znt_list_instant_select=1 + znt_list_border=0 + znt_list_bold=1 + znt_list_colorpair="green/black" + znt_functions_keywords=( "zplg" "zgen" "match" ) + znt_cd_active_text="underline" + znt_env_nlist_coloring_color=$'\x1b[00;33m' + znt_cd_hotlist=( "~/.config/znt" "/usr/share/zsh/site-functions" "/usr/share/zsh" + "/usr/local/share/zsh/site-functions" "/usr/local/share/zsh" + "/usr/local/bin" ) + +* 10-05-2016 + - Search query rotation – use Ctrl-A to rotate entered words right. + Words `1 2 3` become `3 1 2`. + +* 09-05-2016 + - New feature: n-help tool, available also from n-history via H key. It + displays help screen with various information on ZNT. + +* 08-05-2016 + - Approximate matching – pressing f or Ctrl-F will enter FIX mode, in + which 1 or 2 errors are allowed in what is searched. This utilizes + original Zsh approximate matching features and is intended to be used + after entering search query, when a typo is discovered. + +* 06-05-2016 + - Private history can be edited. Use e key or Ctrl-E for that when in + n-history. Your $EDITOR will start. This is a way to have handy set + of bookmarks prepared in private history's file. + - Border can be disabled. Use following snippet in ~/.config/znt/n-list.conf + or any other tool-targetted config file: + + # Should draw the border? + local border=0 + * 30-04-2016 - New feature: color themes. Use Ctrl-T and Ctrl-G to browse predefined themes. They are listed in ~/.config/znt/n-list.conf. Use the file to diff --git a/plugins/zsh-navigation-tools/n-history b/plugins/zsh-navigation-tools/n-history index af475dcb8..b425ecd10 100644 --- a/plugins/zsh-navigation-tools/n-history +++ b/plugins/zsh-navigation-tools/n-history @@ -307,7 +307,7 @@ while (( 1 )); do elif [ "$active_view" = "1" ]; then if [ -s "$private_history_db" ]; then local title=$'\x1b[00;32m'"Private history:"$'\x1b[00;00m\0' - () { fc -ap -R "$private_history_db"; list=( "$title" ${history[@]} ) } + () { fc -Rap "$private_history_db" 20000 0; list=( "$title" ${history[@]} ) } else list=( "Private history - history entries selected via this tool will be put here" ) fi @@ -335,21 +335,37 @@ done if [ "$REPLY" -gt 0 ]; then selected="$reply[REPLY]" + + # Append to private history + if [[ "$active_view" = "0" ]]; then + local newline=$'\n' + local selected_ph="${selected//$newline/\\$newline}" + print -r -- "$selected_ph" >> "$private_history_db" + fi + + # TMUX? + if [[ "$ZNT_TMUX_MODE" = "1" ]]; then + tmux send -t "$ZNT_TMUX_ORIGIN_SESSION:$ZNT_TMUX_ORIGIN_WINDOW.$ZNT_TMUX_ORIGIN_PANE" "$selected" + tmux kill-window + return 0 # ZLE? - if [ "${(t)CURSOR}" = "integer-local-special" ]; then + elif [ "${(t)CURSOR}" = "integer-local-special" ]; then zle .redisplay zle .kill-buffer LBUFFER+="$selected" - - # Append to private history - local newline=$'\n' - selected="${selected//$newline/\\$newline}" - [ "$active_view" = "0" ] && print -r -- "$selected" >> "$private_history_db" else print -zr -- "$selected" fi else - [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay + # TMUX? + if [[ "$ZNT_TMUX_MODE" = "1" ]]; then + tmux kill-window + # ZLE? + elif [[ "${(t)CURSOR}" = "integer-local-special" ]]; then + zle redisplay + fi fi +return 0 + # vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index f3d2e5b3e..3fe5542a6 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -310,8 +310,9 @@ while (( 1 )); do colsearch_pattern="${search_buffer// ##/|(#a2)}" list=( "${(@M)list:#(#ia2)*$~search_pattern*}" ) else - # Patterns will be *foo*~^*bar* and (foo|bar) + # Pattern will be *foo*~^*bar* (inventor: Mikael Magnusson) search_pattern="${search_buffer// ##/*~^*}" + # Pattern will be (foo|bar) colsearch_pattern="${search_buffer// ##/|}" list=( "${(@M)list:#(#i)*$~search_pattern*}" ) fi diff --git a/plugins/zsh-navigation-tools/znt-tmux.zsh b/plugins/zsh-navigation-tools/znt-tmux.zsh new file mode 100755 index 000000000..6a96e97a1 --- /dev/null +++ b/plugins/zsh-navigation-tools/znt-tmux.zsh @@ -0,0 +1,50 @@ +#!/usr/bin/env zsh + +# Copyright (c) 2016, Zsolt Lengyel +# Modifications copyright (c) 2016, Sebastian Gniazdowski + +# +# This script opens a new, temporary tmux pane and runs n-history. When +# a selection is made, the result (history entry) is pasted back into +# original tmux pane, and the temporary pane is closed. This allows to +# use local history on remote machines. +# +# To use, put this line to your ~/.tmux.conf. The tool is invoked with: +# Ctrl+b h +# +# bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" +# + +# get and save the current active tmux pane id +active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) +a_active_pane=("${(@s/:/)active_pane}") + +active_session=${a_active_pane[2]//$} +active_window=$a_active_pane[3] +active_pane=$a_active_pane[4] + +# set variables for upcoming window +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" 1 +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" "$active_session" +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" "$active_window" +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" "$active_pane" + +# create a new window in the active session and call it znt-hist +tmux new-window -t $active_session: -n znt-hist + +# unset the variables, so only above single window has them +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" + +# znt's session id +znt_active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) +znt_a_active_pane=("${(@s/:/)znt_active_pane}") + +znt_active_session=${znt_a_active_pane[2]//$} +znt_active_window=$znt_a_active_pane[3] +znt_active_pane=$znt_a_active_pane[4] + +# call znt +tmux send -t "$znt_active_session:$znt_active_window.$znt_active_pane" n-history ENTER diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index b26549152..32b4ca064 100755 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -1,38 +1,43 @@ #!/usr/bin/env zsh -REPO_DIR="${0%/*}" -CONFIG_DIR="$HOME/.config/znt" +0="${(%):-%N}" # this gives immunity to functionargzero being unset +export ZNT_REPO_DIR="${0%/*}" +export ZNT_CONFIG_DIR="$HOME/.config/znt" # # Copy configs # -if ! test -d "$HOME/.config"; then - mkdir "$HOME/.config" +if [[ ! -d "$HOME/.config" ]]; then + command mkdir "$HOME/.config" fi -if ! test -d "$CONFIG_DIR"; then - mkdir "$CONFIG_DIR" +if [[ ! -d "$ZNT_CONFIG_DIR" ]]; then + command mkdir "$ZNT_CONFIG_DIR" fi # 9 files -set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf +unset __ZNT_CONFIG_FILES +typeset -ga __ZNT_CONFIG_FILES +set +A __ZNT_CONFIG_FILES n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf # Check for random 2 files if they exist # This will shift 0 - 7 elements -shift $(( RANDOM % 8 )) -if ! test -f "$CONFIG_DIR/$1" || ! test -f "$CONFIG_DIR/$2"; then +shift $(( RANDOM % 8 )) __ZNT_CONFIG_FILES +if [[ ! -f "$ZNT_CONFIG_DIR/${__ZNT_CONFIG_FILES[1]}" || ! -f "$ZNT_CONFIG_DIR/${__ZNT_CONFIG_FILES[2]}" ]]; then # Something changed - examine every file - set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf - for i; do - if ! test -f "$CONFIG_DIR/$i"; then - cp "$REPO_DIR/.config/znt/$i" "$CONFIG_DIR" + set +A __ZNT_CONFIG_FILES n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf + unset __ZNT_CONFIG_FILE + typeset -g __ZNT_CONFIG_FILE + for __ZNT_CONFIG_FILE in "${__ZNT_CONFIG_FILES[@]}"; do + if [[ ! -f "$ZNT_CONFIG_DIR/$__ZNT_CONFIG_FILE" ]]; then + command cp "$ZNT_REPO_DIR/.config/znt/$__ZNT_CONFIG_FILE" "$ZNT_CONFIG_DIR" fi done + unset __ZNT_CONFIG_FILE fi -# Don't leave positional parameters being set -set -- +unset __ZNT_CONFIG_FILES # # Load functions -- cgit v1.2.3-70-g09d2 From cf37697920019c44245ba3e5b69fed68c8c3fff4 Mon Sep 17 00:00:00 2001 From: Sachin George Thomas Date: Wed, 2 Nov 2016 20:22:14 +0530 Subject: node: open module-specific node documentation (#5572) --- plugins/node/node.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 2463815ac..e2f18a032 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -1,5 +1,6 @@ # Open the node api for your current version to the optional section. # TODO: Make the section part easier to use. function node-docs { - open_command "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1" + local section=${1:-all} + open_command "http://nodejs.org/docs/$(node --version)/api/$section.html" } -- cgit v1.2.3-70-g09d2