DISABLE_UNTRACKED_FILES_DIRTY, DISABLE_AUTO_TITLE, GIT_STATUS_IGNORE_SUBMODULES are not set
Handle these variables not being set with conditional access.
If the user has set -u option to report attempts to use undeclared / unassigned variable, accessing the variables needs to be conditional.
oh-my-zsh Changes the HISTSIZE and SAVEHIST values to fixed sizes,
however if a bigger value is set in ~/.zshrc, it will override it,
potentially causing the user history to be deleted.
So, only set these values if no other is set and if it is lower than the
default ones.
* Automatic title: Replace fg with description from jobs
* Avoid error messages when there is no job
* Use $jobstates and $jobtexts to look for jobs
`jobs %string` doesn't work correctly when run inside `$()`. `$jobstates` and
`$jobtexts` is available in the current shell process, so even though we need
to replicate a bit more logic, every type of `fg` invocation works correctly.
* lib: clean up termsupport.zsh
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
`jobs %string` doesn't work correctly when run inside `$()`. `$jobstates` and
`$jobtexts` is available in the current shell process, so even though we need
to replicate a bit more logic, every type of `fg` invocation works correctly.
- 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.
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.
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>
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>
$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"
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.
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.
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.
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.
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
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
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/
- 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
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.
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/
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.
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.
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
`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.