Commit graph

544 commits

Author SHA1 Message Date
Marc Cornellà
dc190d872a Refactor grep.zsh file
- Move grep-alias path to variable.
- Use <<< "" instead of piped echo to check grep flags.
- Remove check for --color only since it's the same release as --exclude.
2020-03-01 20:40:27 +01:00
Marc Cornellà
8d814fdff6 Fast algorithm to determine grep alias flags
This version tries whether grep supports all the flags together
and progressively checks older flags if the grep test fails.
This means only one grep call if all flags are supported, and
one additional call for every flag that's not supported, up to
a maximum of 3 calls.
2020-03-01 14:05:01 +01:00
mattmc3
57b178102c Performance enhancement for lib/grep
- Use $ZSH_CACHE_DIR to store the grep alias with all the right features
- Expire the cache after 24 hours
- See issue #8444
2020-03-01 14:04:36 +01:00
Shi Yan
a8ed1c4e7a Ignore .tox folder in grep 2020-03-01 13:53:04 +01:00
Peter Vandenberk
b4b50f20ac Also set options for egrep and fgrep 2020-03-01 13:51:55 +01:00
Vital Kolas
b6f2cfdb93 Exclude .idea folder from grep search scope 2020-03-01 13:51:52 +01:00
Stephen Heuer
a2cad16790
lib: urlencode hostname in update_terminalapp_cwd (#6245)
Apple's Terminal doesn't open a new tab in your current directory if your hostname has UTF-8 characters in it. Percent encoding the host in addition to the path in update_terminalapp_cwd appears to solve this issue.

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-02-28 19:50:17 +01:00
Marc Cornellà
888ab9091c lib: add support for clippaste in WSL using powershell
Source: https://github.com/microsoft/WSL/issues/4852#issuecomment-579616808
2020-02-28 19:07:05 +01:00
j
2b499e1a9e lib: add termux commands to clipboard.zsh (#6243)
Closes #6243
2020-02-27 23:28:14 +01:00
Marc Cornellà
57739cbcb6 lib: add support for clip.exe clipboard copy in WSL 2020-02-27 23:24:23 +01:00
Marc Cornellà
18ee5dffdc
Merge branch 'master' into clipboard 2020-02-27 22:55:30 +01:00
Marc Cornellà
40b013f5f1 lib: delete upgrade lock in upgrade_oh_my_zsh
Provides a different solution to #8332 and #8333
2020-02-24 20:27:21 +01:00
Marc Cornellà
17428f3c9a lib: load bash completion functions automatically
Fixes #8614
2020-02-11 20:16:43 +01:00
Evan Chiu
1c300d3a76 lib: add git function to determine repository name (#4989)
Closes #4989

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-02-10 21:11:31 +01:00
Andras Svraka
56297902e9 lib: add MSYS2 support to clipboard integration (#8542) 2020-01-16 18:19:56 +01:00
Jacob Tomaw
1ba0af650a Use safer append to hook function arrays (#8406)
Use add-zsh-hook to add functions to hooks. That way they won't be added again
when doing `source ~/.zshrc` multiple times.

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2019-11-19 18:47:12 +01:00
Marc Cornellà
1546e1226a Fix badly resolved rebase conflict 2019-11-06 19:46:52 +01:00
Marc Cornellà
b7e37cea90 Clean up ignore submodules logic in parse_git_dirty 2019-11-06 19:41:13 +01:00
Wang Guan
7cc3a32bff Add an option about git submodules to ignore
$GIT_STATUS_IGNORE_SUBMODULES can be used to specify handling of
submodules. It can be:
not set : ignore dirty submodules (this was default zsh behavior)
"git"   : do not use "--ignore-submodules" and let git choose,
          this obeys setting in .gitmodules
other   : comes into "--ignore-submodules=$GIT_STATUS_IGNORE_SUBMODULES"
2019-11-06 19:39:17 +01:00
Shahin Sorkh
3e4d10c4f1 lib: allow alias expansion in _ sudo alias (#8268) 2019-10-16 18:01:15 +02:00
Marc Cornellà
095d56b5ea Fix WSL check for WSL 2 and simplify nohup in open_command
WSL 2 changes the output of `uname -r`. For instance,

  WSL 1: 4.4.0-18980-Microsoft
  WSL 2: 4.19.67-microsoft-standard

Since WSL 2 lowercases the M, we can match for the rest of the string
which remains lowercase throughout both versions. Another option would
be to match for both upper- and lower-case Ms, like that:

  $(uname -r) = *[Mm]icrosoft*

Fixed use of nohup in open_command where it was only necessary for
xdg-open (and actually harmful for cmd.exe in WSL 2). The current logic
is simpler and more future-proof.
2019-09-19 16:20:02 +02:00
Marc Cornellà
e604eaf55e
lib: delete LC_CTYPE locale setting which causes problems
Fixes #7942
2019-08-19 18:17:17 +02:00
Robert Estelle
d81cd753e0 clipboard: Fix bad expansion of exit-code test 2019-07-14 12:56:51 -04:00
Robert Estelle
841008c947 clipboard: Fix tmux clipcopy after testing
Tmux must have special handling for /dev/stdin since it's managing the
terminal itself. This was tested with tmux-2.9a on macOS.
2019-07-14 12:53:30 -04:00
Robert Estelle
d71d3d9905 clipboard: Fix "cilppaste" -> "clippaste" typo 2019-07-14 12:52:47 -04:00
Robert Estelle
01e934d634 clipboard: Add support for several more clipboards
This implements essentially the same heuristic as neovim, with the additional
(existing) special support for Cygwin.
See: e682d799fa/runtime/autoload/provider/clipboard.vim (L55-L121)
  - pbcopy, pbpaste (macOS)
  - cygwin (Windows running Cygwin)
  - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
  - xclip (if $DISPLAY is set)
  - xsel (if $DISPLAY is set)
  - lemonade (for SSH) https://github.com/pocke/lemonade
  - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
  - win32yank (Windows)
  - tmux (if $TMUX is set)
2019-07-12 17:45:57 -04:00
Robert Estelle
956ca639bb clipboard: Avoid unnecessary re-detection each time
Previously, OS detection would happen on each invocation. This makes it
happen once (unless it fails, in which case it will try again on the
next invocation).

This has the additional benefit of localizing the platform-specific
checks and commands, too, versus spreading them out in separate
functions.
2019-07-12 17:45:57 -04:00
Robert Estelle
d855547661 clipboard: Reduce unnecessary special-casing on stdin
Ideally the parameter would just be removed-users could always
just do "clipcopy < some-file". but removing the parameter would break
backwards compatibility.

In any case, this simplifies the logic considerably.
2019-07-12 17:45:57 -04:00
Marc Cornellà
486fa1010d lib: add ability to disable magic functions
Fixes #5499
Fixes #5569
Fixes #6338
Fixes #6654
Fixes #6255
Fixes #7632

Closes #7763

Co-authored-by: Daniel Galán y Martins <git@galan.de>
2019-05-11 13:47:12 +02:00
Andrew Janke
299cd4777a Themes: switch to using ruby_prompt_info()
Changes themes displaying RVM or other Ruby version info to use the central
ruby_prompt_info function. This supports more Ruby versioning mechanisms,
reduces copy-and-paste code, and avoids "zsh: no such file or directory: rvm-prompt"
when run on machines that do not have RVM installed.

Changes the prefix/suffix variable names to ZSH_THEME_RUBY_PROMPT_PREFIX and
ZSH_THEME_RUBY_PROMPT_SUFFIX, since they apply to all Ruby versioning mechanisms,
not just RVM.

Allows empty ZSH_THEME_RUBY_PROMPT_PREFIX and ZSH_THEME_RUBY_PROMPT_SUFFIX.
2019-05-08 08:45:34 +02:00
Marc Cornellà
ea3e666e04 init: run compinit before loading lib/ files 2019-05-07 21:30:06 +02:00
Marc Cornellà
239649ae6a
lib: pass arguments to d to dirs (#6924)
Replace the alias with a function. Call `dirs` if arguments are given to `d`.
2019-05-07 20:53:40 +02:00
Yannis Mitsos
cfd30e9e5c Colored ls output in FreeBSD #7565 2019-04-22 17:24:48 +03:00
Marc Cornellà
5911aea46c
lib: stop detecting git versions prior to 1.7.2
The 1.7.2 release was published in July 2010 [1]. It's about time to stop
supporting older versions.

Fixes #4583

[1] https://github.com/git/git/releases/tag/v1.7.2
2019-04-09 20:38:13 +02:00
David Remy
62abacebea lib: fix issues with nounset and parameters used before defined (#7433) 2019-04-09 12:58:45 +02:00
Marc Cornellà
30594886bf
lib: delete PS1 default
A default PS1 doesn't make sense: the user will either choose a theme or not
care about a default prompt since they can set it themselves.

Fixes #7054
2019-04-08 23:01:55 +02:00
Jeremy Armstrong
8aa8405ea2 termsupport: add support for tmux* $TERM values (#7622) 2019-03-21 20:41:55 +01:00
Konstantin Gizdov
de2395c678 compfix: fix check for empty string (#7674) 2019-03-21 20:35:00 +01:00
Marc Cornellà
55575b88f9 lib: optimize default and env_default 2019-02-25 23:20:47 +01:00
Marc Cornellà
6db298c57a
misc: remove please alias to sudo
Fixes #7527
2019-01-20 17:20:26 +01:00
Marc Cornellà
5a729f6667 lib: fix history wrapper when passing numbers
If a number is passed without explicitly passing `-l`, it will now behave
as if using the history builtin, instead of throwing an error.
2018-09-15 22:56:12 +02:00
Marc Cornellà
fe5fe81c8c
lib: quote arguments to env_default
Fixes #7117
2018-09-09 19:50:23 +02:00
Marc Cornellà
f75d096c1a
lib: small change to git_compare_version
Fixes #7118
2018-09-08 21:35:03 +02:00
John Burwell
e8b9958926 Add jenv plugin
Initializes jenv and provides the jenv_prompt_info funtion to add
Java version information to prompts.  This function is stubbed in
prompt_info_functions script to allow it to be safely called
regardless of whether or not the jenv plugin is loaded.

It also splits detection of the plugin/versions directory and bin directory
to suppport the way Homebrew splits the jenv bin and data directories
2018-08-19 19:12:24 +02:00
Marc Cornellà
2c1ff85bb2
core: fix alias_value function
Fixes #5835
2018-08-09 19:49:02 +02:00
Janosch Schwalm
19b925e741 use https everywhere (#6574)
* use https everywhere

* use https links on the files that are left

Also, removed some broken links and updated redirections.
2018-08-07 20:42:01 +02:00
Marc Cornellà
106f826075 Revert "add -F and -X to default $LESS environment variable (#6611)"
This reverts commit 9544316ef9.

This setting broke mouse / touchpad scroll on programs using `less` output
due to it not using the alternate screen buffer.

Fixes #7025
2018-08-02 21:21:20 +02:00
Lars Schneider
9544316ef9 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] 36438dc19d/Documentation/config.txt (L819-L821)
[2] https://public-inbox.org/git/2412A603-4382-4AF5-97D0-D16D5FAAFE28@eluvio.com/
2018-07-24 22:55:48 +02:00
Cristian Consonni
d3e3b2dd0d Add support for custom timestamp format in history (#6770) 2018-07-13 13:14:15 +02:00
sam-lunt
7cba6bb038 Enable passing multiple directories to take (#6900)
* enable passing multiple directories to take

* Update take function

Do not call cd if mkdir fails
2018-07-02 17:05:24 +02:00