Commit graph

568 commits

Author SHA1 Message Date
Erik Demaine
902e3172c9 Avoid error messages when there is no job 2019-07-07 10:48:36 -04:00
Erik Demaine
c1446b4750 Automatic title: Replace fg with description from jobs 2019-07-06 12:10:30 -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
Yuri Parsons
55ab532e50 Don't correct cp commands (#4636) 2018-07-01 22:43:45 +02:00
Marc Cornellà
f898ada8e3 open_command: fix and improve command for WSL
- Add double quotes to command so that the next argument isn't
  interpreted as the title for the start command.

- If the first argument is a valid path, convert it to Windows path
  notation. If `wslpath` fails—because it's a path from inside WSL,
  which cannot be converted to Windows path notation— fail with an
  error code.

  This last circumstance will show an error like so:

    wslpath: path: Result not representable
2018-06-30 21:13:08 +02:00
Marc Cornellà
12086593a4 open_command: simplify code 2018-06-30 21:13:08 +02:00
Ben Klein
b0a149076f
Allow arguments to d to be passed to dirs
Replace the alias with a function. Call `dirs` if arguments are given to `d`.
2018-06-16 20:35:41 -04:00
Marc Cornellà
77b924b839 Give more helpful message and disable purge of caches
This error message will give information on what exactly has happened
and how to either solve ownership and permissions or disable the check
entirely.

Also gets rid of the purge of compinit caches since with the current
logic insecure completion directories are ignored and therefore haven't
tainted the cached files.
2018-05-26 21:33:24 +02:00
Nathan Robinson
de8ef8286a
Remove po alias
https://github.com/robbyrussell/oh-my-zsh/issues/6761
2018-05-25 23:46:18 -04:00
Marc Cornellà
6bff079332
Allow completion of dot directories (#6803)
Fixes #3775, fixes #6543
2018-05-07 18:15:01 +02:00
Marc Cornellà
93d9431890
Check for Microsoft's WSL in open_command (#6751)
This will work only on files and directories in a DrvFs mount, i.e.
that can be translated to a Windows drive path.
For example: /mnt/c/Users/user.

Files and folders inside the LXSS directory can't be handled in
Windows, they must be ONLY used by the WSL subsystem. That's why
you won't be able to open your $HOME directory, for instance.

See https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/
2018-04-24 23:47:26 +02:00
Marc Cornellà
2589cdd8f9 Increment HISTSIZE to fix hist_expire_dups_first
This fixes the old behavior which made it so all duplicates would be
deleted if the command history filled up with unique events.

> You should be sure to set the value of HISTSIZE to a larger number
> than SAVEHIST in order to give you some room for the duplicated
> events, otherwise this option will behave just like HIST_IGNORE_ALL_DUPS
> once the history fills up with unique events.
2018-04-22 15:33:12 +02:00
Marc Cornellà
9f2f22d953 Remove duplicate option append_history
The option inc_append_history already has the same effect.
2018-04-22 15:33:11 +02:00
Marc Cornellà
20d63be655 Use zparseopts to get passed arguments 2018-04-22 15:33:10 +02:00
Marc Cornellà
f8180c3a64 Allow overriding -l flag in history 2018-04-22 15:32:30 +02:00
Marc Cornellà
03758416fe Ensure builtin fc is used (see #3001) 2018-04-22 15:32:02 +02:00
Marc Cornellà
643bb25a0d Organize history.zsh file and improve comments 2018-04-22 15:32:02 +02:00
Marc Cornellà
94baa9eadd Simplify `if' into oneliner, allow spaces in HISTFILE 2018-04-22 15:32:01 +02:00
Marc Cornellà
d87d4331cf Change history alias into a function
This commit changes the history alias into a function which puts
the passed arguments before `-l 1`. It also provides a temporary
workaround to the lack of a `history -c` command in zsh.

For more information see issues 739 and 789.
2018-04-22 15:31:53 +02:00
Jacopo De Simoi
ccd02866f6 Fix git_commits_{ahead,before} when no upstream branch is defined (#6658)
If @{u} is not defined, git rev-list will give an error; redirect
to stderr the error and deal with this case in what follows.
2018-04-15 18:44:48 +02:00
Kimberly Zick
2b6c502aa5 Add match for MM (result of git commit -p on a single changed file) to git_prompt_status (#3632) 2018-01-22 19:14:05 -08:00
catull
d792b1114c With zsh 5.4 a simple "local FLAGS" meant as an array must be explicitly declared so. This fix avoids the dreaded "parse_git_dirty:3: FLAGS: attempt to assign array value to non-array". (#6414) 2017-11-14 06:36:53 -08:00
Patrick José Pereira
2a6c40f66f 'lib/functions.zsh: Solve typos'
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2016-12-30 10:34:16 -02:00
Patrick José Pereira
cedc4fce88 'lib/completion.zsh: Solve typos'
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2016-12-30 10:34:16 -02:00
Derek Frank
3ed37f47cb 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
2016-11-16 00:38:32 +01:00
mingang.he
0b340bc3a5 Fix #5604: No DIR ( directory ) colors (#5605) 2016-11-03 14:10:08 +01:00
Eduardo Cuomo
40544a1d5d Fix invalid "ls -G" alias. 2016-11-02 15:42:38 +01:00
Marc Cornellà
1b799e9762 Check dircolors settings before using gls on darwin (#5570)
`gls` seems to be installed by default or on most macOS systems, but its
default color scheme sucks. This fix will make sure to only use it if it
has been customised prior to running OMZ.

Related: #5516, #5520.
2016-11-02 15:39:28 +01:00
Marc Cornellà
c24dfa1ab4 Fix ls coloring in MacOS if gls is not installed
Fixes #5520.
2016-10-11 09:24:43 +02:00
rossmcf
628d0bb106 Fix ls colouring for Darwin. (#5516) 2016-10-10 23:08:54 +02:00
Hong
f7d4f985ac Use $+commands to check the existence of a command in clipboard.zsh. (#5519) 2016-10-10 23:01:37 +02:00
Hong
a56eac7a71 Use OSTYPE instead of uname whenever possible for better speed. (#5496) 2016-10-10 22:24:30 +02:00
Hong
98cd3973d2 Take advantage of LS_COLORS for the color of completion if GNU ls is used. (#5510) 2016-10-10 20:40:17 +02:00
Marc Cornellà
c2e3a410ea Fix style of theme-and-appearance.zsh 2016-10-04 01:30:01 +02:00
Marc Cornellà
6304a789ab Only set default LS_COLORS if not set before
Also, force the use of Bourne-style shell syntax with `dircolors -b`.
2016-10-04 01:29:47 +02:00
Marc Cornellà
6c08286c8e Use $commands[] to check for command existence 2016-10-04 01:27:19 +02:00
Hong Xu
efa7c7b7ff set better default colors for GNU ls instead of none.
GNU coreutils ship a color setup command by default which can be used to
set a good default color theme for ls:

  https://www.gnu.org/software/coreutils/manual/html_node/dircolors-invocation.html
2016-10-04 01:06:36 +02:00
Marc Cornellà
4e12024b0b Fix styling of lib/completion.zsh 2016-09-22 00:44:25 +02:00
Gravemind
0d897cca74 Fix hyphen and underscore filename completion
This deletes the previous hack that allowed completing files with
the extension: e.g. `abcd.z` to `abcdefg.z`.

It is still possible to use `abcd[TAB].z`, and hyphens or underscores
are very much more important than this other trick.

Source:
https://github.com/robbyrussell/oh-my-zsh/issues/1398#issuecomment-169163149

Signed-off-by: Marc Cornellà <marc.cornella@live.com>
2016-09-22 00:43:30 +02:00
Yuichi Tanikawa
27fff27253 Fix git_prompt_status() not showing ahead/behind/diverged status correctly (#5388) 2016-09-08 00:23:04 +02:00
Marc Cornellà
71201ffd67 git: output nothing when no commits ahead or behind
This fixes old git_commits_ahead behavior and changes git_commits_behind
to have the same behavior.

Fixes #5355
2016-09-05 11:22:48 +02:00
Fredrik Fornwall
9772f8e10d Replace /bin/sh with sh for portability (#5291)
This makes things work even on system lacking /bin/sh, such as on
non-rooted Android systems.
2016-08-09 02:39:11 +02:00
Luke Childs
a7de0fabd7 nvm plugin improvements (#5265)
* Export $NVM_DIR if it doesn't exist and use it when looking for nvm
* Use $NVM_DIR when looking for nvm for completion
* Use $NVM_DIR when looking for nvm in nvm_prompt_info
2016-08-07 19:36:44 +02:00
Steven
61981951b1 Updated git_commits_ahead function (#5247)
* Function wasn't returning correct value
* Updated underlying git command
* Kept echo command from previous function for backwards compatibility
* Kept function consistent with git_commits_behind
2016-08-01 17:48:46 +02:00
Steven
96a2092e37 lib/git.zsh: Added git_commits_behind function (#4450)
* Added git_commits_behind function
* Added 'command' to git_commits_behind function
* git_commits_behind code review changes
2016-07-15 11:05:39 +02:00
Marc Cornellà
cc36063cfd Cleanup theme-and-appearance.zsh 2016-05-12 13:23:46 +02:00
Marc Cornellà
ed484dfaf6 Delete cdablevars option by default
Fixes weird autocompletion of directories and named users.
Fix #4864
2016-05-12 13:22:27 +02:00
Aesop Wolf
69e1506ad9 Add git user profile functions for prompt display 2016-03-31 14:16:46 -07:00
Michele Bologna
87f8251388 Re-added $ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE
Re-added $ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE variable which was removed in 9f55213
2016-01-13 15:36:59 +01:00
Marc Cornellà
0842384987 Put local var declaration in its own line in lib/git.zsh
In places, the local statement will override the exit code and the written
command won't have the effect intended when it was written.

For example, when it's not inside a git repo the exit code won't be true,
but the local statement will make it true regardless. See #4708.
2015-12-17 18:37:49 +01:00
Andrew Janke
9f552130bd Move current_branch() from git plugin to core lib/git.zsh
Fixes #4085: core -> plugin dependency issue.
Rename it to git_current_branch for clarity that it's git-specific.
Update all plugins that were calling it to use new name.
Fix variable leaks by making more variables in lib/git.zsh local.
Have lib/git.zsh use [[ ]] instead of [ ] everywhere.
2015-12-14 20:28:37 -05:00
moyamo
71deb74552 Fix indentation 2015-12-14 13:05:51 +02:00
moyamo
d779750341 Default to using terminfo to set the terminal title
Currently, the title is only set on supported terminals (i.e. xterm,
urxvt, screen etc.). Using terminfo entries to set the terminal title
adds support for many more terminals.
2015-12-14 12:59:04 +02:00
desrum_m
95aa9bd97b Better research history with arrow keys
This change enables UP-arrow and DOWN-arrow full-line history completion.
For example, if you write `git clone` and press UP:

- Before this change,
  it will use the last command that starts with `git`.

- After this change,
  it will use the last command that starts with `git clone`.
2015-12-14 01:08:55 +01:00
Marc Cornellà
d54d896346 Merge pull request #3966 from apjanke/fix-spectrum-ls
Make spectrum_ls implementation consistent with $FG and spectrum_bls
2015-12-13 21:39:13 +01:00
Marc Cornellà
11de60fde9 Merge pull request #3965 from apjanke/spectrum-hide-codes
Hide spectrum.zsh var values to avoid junky output to terminal
2015-12-13 21:28:44 +01:00
Marc Cornellà
4fbfb149d3 Add back the - alias to go to the previous directory
The alias was removed in #3564. A couple of users were using
it, so I'm adding it back.
2015-12-13 20:36:31 +01:00
Marc Cornellà
4e306887c2 Cleanup update_terminalapp_cwd function 2015-12-01 14:05:38 +01:00
Marc Cornellà
eca912e51a Quote all variables in if statements 2015-12-01 14:05:18 +01:00
Marc Cornellà
103eb32721 Use a case structure to id terminal types 2015-12-01 14:04:12 +01:00
Dawid Ferenczy
63d7500cf1 Added setting of the window title in Cygwin 2015-12-01 13:52:52 +01:00
Marc Cornellà
b457ae2501 Merge pull request #4651 from ionelmc/patch-1
Add support for "putty" $TERM in termsupport.zsh
2015-12-01 00:05:17 +01:00
Ionel Cristian Mărieș
d55111f200 Support all kinds of putty-like terminal strings. 2015-12-01 00:59:35 +02:00
Marc Cornellà
584e0a6ef9 Use shwordsplit in open_command() 2015-11-30 21:27:58 +01:00
Marc Cornellà
afdfe2391e Add empty string parameter to start command
Otherwise `start` will confuse the first parameter as the title of
a new command prompt if the parameter contains whitespace. That is
because the command to be run will be:

    start "abc def"

which opens a new command prompt window with the title "abc def".
With the added empty string we force the start command to interpret
the passed parameter as the file / command:

    start "" "abc def"

which will be interpreted like `""` is the title and the rest is
the file or command to start.

-------

**NOTE:** this wouldn't be necessary if the start script in msys
was defined differently; that is, if it had the empty string
already incorporated in the script (/usr/bin/start), like so:

```diff
-cmd //c start "${@//&/^&}"
+cmd //c start "" "${@//&/^&}"
```

Notice however that this would make it impossible to use start
setting a different title, so it's probably best to leave it as is.

More info: http://sourceforge.net/p/msys2/tickets/14/

-------

The change `${(z)open_cmd}` is necessary to force zsh to split the
variable by the spaces and interpret it as separate words.

More info: http://zsh.sourceforge.net/FAQ/zshfaq03.html#l17
2015-11-30 21:21:28 +01:00
Mark Ingalls
0a79f1e836 make this work in the git-for-windows SDK
Added an option for the msys value of $OSTYPE
2015-11-30 21:01:15 +01:00
Ionel Cristian Mărieș
711c1bcb40 Add support for "putty" $TERM in termsupport.zsh 2015-11-30 15:16:47 +02:00
Marc Cornellà
fea74b4b34 Fix open_command nohup call
There a syntax error if $cmd_var contains more than one word,
so we drop the current way to prepend nohup and use a simpler
if-else form.
2015-11-29 19:34:10 +01:00
Andrew Janke
f0981d564a termsupport: protect subshell with quotes 2015-11-27 15:58:06 +01:00
Marc Cornellà
ebfba0e539 Drop the use of nohup on OSX for tmux compatibility
Apparently `nohup` is not needed in OSX, and using it has the side
that it may break under tmux with the error

  nohup: can't detach from console: No such file or directory

For now, this commit only drops the use of `nohup` in OSX. But it
*may* not be necessary under other similar platforms.
2015-11-27 15:40:31 +01:00
Marc Cornellà
56345c26fb Merge pull request #4473 from apjanke/5_1_1-bracketed-paste-hack
Disable bracketed-paste-magic in zsh 5.1.1, where it is buggy
2015-10-20 08:26:15 +02:00
Robby Russell
b28db6b475 Merge pull request #4475 from apjanke/diagdump-5.1-fix
diagnostics: fix for reserved-word changes in zsh 5.1
2015-10-13 18:01:52 -07:00
Robby Russell
dc06e96e9c Merge pull request #4254 from apjanke/copyfile-portability
Cross-platform clipboard clipcopy() and clippaste()
2015-10-09 07:15:53 -07:00
Andrew Janke
d15521d09d diagnostics: fix for reserved-word changes in zsh 5.1
Reference:
https://github.com/zsh-users/zsh/blob/zsh-5.1.1/NEWS#L20-L32
2015-10-08 22:31:39 -04:00
Andrew Janke
3551745792 Disable bracketed-paste-magic in zsh 5.1.1, where it is buggy
A bracketed-paste-magic bug breaks pasting of CJK and some other characters in zsh 5.1.1.
http://www.zsh.org/mla/workers/2015/msg02680.html
See #4434
2015-10-08 22:13:42 -04:00
Andrew Janke
b6d78df62c clip*: add xsel support 2015-10-05 05:13:11 -04:00
Jeff Smith
2d9df4468f Fix 'ack-grep' bug for non-ubuntu users
Redirect STDERR along with STDOUT when looking for ack-grep
2015-10-03 18:39:41 -07:00
Robby Russell
5d24ba4228 Merge pull request #3165 from hbin/fix-alias-afind-osx
The executable command on Mac OSX is 'ack' rather than 'ack-grep'.
2015-10-03 14:33:10 -07:00
Andrew Janke
e4fdb08365 Merge branch 'master' into copyfile-portability 2015-09-28 08:52:03 -04:00