From 3ed37f47cb1a9385e2238528839d7d91634f2c5b Mon Sep 17 00:00:00 2001 From: Derek Frank Date: Tue, 15 Nov 2016 15:38:32 -0800 Subject: fix(env): Do not override misc env set before sourcing oh-my-zsh (#5231) Sourcing oh-my-zsh happens in zshrc, which will override settings of profile and zshenv. Treat misc values, `PAGER` and `LESS`, as default settings without overriding existing values. Fixes: #1, robbyrussell/oh-my-zsh#3016 --- lib/misc.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/misc.zsh') diff --git a/lib/misc.zsh b/lib/misc.zsh index c81dab413..3052b7710 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -19,8 +19,8 @@ fi setopt long_list_jobs ## pager -export PAGER="less" -export LESS="-R" +env_default PAGER 'less' +env_default LESS '-R' ## super user alias alias _='sudo' -- cgit v1.2.3-70-g09d2 From 9544316ef95c2aa1e75101a7dce545b4604b3ca6 Mon Sep 17 00:00:00 2001 From: Lars Schneider Date: Tue, 24 Jul 2018 22:55:48 +0200 Subject: add -F and -X to default $LESS environment variable (#6611) The option '-F' causes 'less' to automatically quit if the contents fit the screen and the option '-X' causes 'less' to not clear the screen after quit. I think both options are generally useful for terminal applications. They are in particular useful for Git as it runs all output through a pager. Git will run 'less' with '-FRX' by default if the environment variable $LESS is not defined [1]. Since oh-my-zsh used to set $LESS to '-R', Git would not override this setting. Consequently, Git would display even a single line of output in a pager and the user would need to explicitly quit that pager (see mailing list discussion [2]). Therefore, lets change the oh-my-zsh default value for $LESS to '-FRX'. This would be useful for oh-my-zsh Git users and likely for users of other applications that use 'less' too. [1] https://github.com/git/git/blob/36438dc19dd2a305dddebd44bf7a65f1a220075b/Documentation/config.txt#L819-L821 [2] https://public-inbox.org/git/2412A603-4382-4AF5-97D0-D16D5FAAFE28@eluvio.com/ --- lib/misc.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/misc.zsh') diff --git a/lib/misc.zsh b/lib/misc.zsh index 3052b7710..90a8d62f3 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -20,7 +20,7 @@ setopt long_list_jobs ## pager env_default PAGER 'less' -env_default LESS '-R' +env_default LESS '-FRX' ## super user alias alias _='sudo' -- cgit v1.2.3-70-g09d2 From 106f826075979ef1a6875cedd2d098e601f2e3f2 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 2 Aug 2018 21:21:20 +0200 Subject: Revert "add -F and -X to default $LESS environment variable (#6611)" This reverts commit 9544316ef95c2aa1e75101a7dce545b4604b3ca6. This setting broke mouse / touchpad scroll on programs using `less` output due to it not using the alternate screen buffer. Fixes #7025 --- lib/misc.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/misc.zsh') diff --git a/lib/misc.zsh b/lib/misc.zsh index 90a8d62f3..3052b7710 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -20,7 +20,7 @@ setopt long_list_jobs ## pager env_default PAGER 'less' -env_default LESS '-FRX' +env_default LESS '-R' ## super user alias alias _='sudo' -- cgit v1.2.3-70-g09d2 From fe5fe81c8cfa66981c51d149a35fe545f2ef5016 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 9 Sep 2018 19:50:23 +0200 Subject: lib: quote arguments to env_default Fixes #7117 --- lib/misc.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/misc.zsh') diff --git a/lib/misc.zsh b/lib/misc.zsh index 3052b7710..f45c10757 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -18,9 +18,8 @@ fi ## jobs setopt long_list_jobs -## pager -env_default PAGER 'less' -env_default LESS '-R' +env_default 'PAGER' 'less' +env_default 'LESS' '-R' ## super user alias alias _='sudo' -- cgit v1.2.3-70-g09d2 From 6db298c57a5a8901cc280f00ec38fffb527ac86d Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 20 Jan 2019 17:20:26 +0100 Subject: misc: remove please alias to sudo Fixes #7527 --- lib/misc.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/misc.zsh') diff --git a/lib/misc.zsh b/lib/misc.zsh index f45c10757..b30822b50 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -23,7 +23,6 @@ env_default 'LESS' '-R' ## super user alias alias _='sudo' -alias please='sudo' ## more intelligent acking for ubuntu users if which ack-grep &> /dev/null; then -- cgit v1.2.3-70-g09d2 From 486fa1010df847bfd8823b4492623afc7c935709 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 11 May 2019 13:42:38 +0200 Subject: lib: add ability to disable magic functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #5499 Fixes #5569 Fixes #6338 Fixes #6654 Fixes #6255 Fixes #7632 Closes #7763 Co-authored-by: Daniel Galán y Martins --- lib/misc.zsh | 6 +++--- templates/zshrc.zsh-template | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/misc.zsh') diff --git a/lib/misc.zsh b/lib/misc.zsh index b30822b50..40ffa479d 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -1,7 +1,7 @@ -## Load smart urls if available -# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434 autoload -Uz is-at-least -if [[ $ZSH_VERSION != 5.1.1 ]]; then + +# *-magic is known buggy in some versions; disable if so +if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then for d in $fpath; do if [[ -e "$d/url-quote-magic" ]]; then if is-at-least 5.1; then diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 453daf8a2..3cc5ad46c 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -32,6 +32,9 @@ ZSH_THEME="robbyrussell" # Uncomment the following line to change how often to auto-update (in days). # export UPDATE_ZSH_DAYS=13 +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS=true + # Uncomment the following line to disable colors in ls. # DISABLE_LS_COLORS="true" -- cgit v1.2.3-70-g09d2 From e604eaf55e1c5b19035778c0e0adb0dd6e344b94 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 19 Aug 2019 18:17:17 +0200 Subject: lib: delete LC_CTYPE locale setting which causes problems Fixes #7942 --- lib/misc.zsh | 5 ----- 1 file changed, 5 deletions(-) (limited to 'lib/misc.zsh') diff --git a/lib/misc.zsh b/lib/misc.zsh index 40ffa479d..36c3ae2e5 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -31,10 +31,5 @@ else alias afind='ack -il' fi -# only define LC_CTYPE if undefined -if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then - export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG -fi - # recognize comments setopt interactivecomments -- cgit v1.2.3-70-g09d2 From 3e4d10c4f17b2fe57090a524d5d78781beda204a Mon Sep 17 00:00:00 2001 From: Shahin Sorkh Date: Wed, 16 Oct 2019 19:31:15 +0330 Subject: lib: allow alias expansion in _ sudo alias (#8268) --- lib/misc.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/misc.zsh') diff --git a/lib/misc.zsh b/lib/misc.zsh index 36c3ae2e5..61571afc9 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -22,7 +22,7 @@ env_default 'PAGER' 'less' env_default 'LESS' '-R' ## super user alias -alias _='sudo' +alias _='sudo ' ## more intelligent acking for ubuntu users if which ack-grep &> /dev/null; then -- cgit v1.2.3-70-g09d2