Commit graph

72 commits

Author SHA1 Message Date
Michele Bologna 58ff4e1d2e
lib: follow standards in window title (#9320)
In Ubuntu and Debian, in scp, and in rsync the prompt is by default specified as in

  user@hostname:/path/to/directory

while the previous title in ohmyzsh was

  user@hostname: /path/to/directory
2020-10-08 19:20:47 +02:00
Marc Cornellà 274df9dc29 lib: support simple terminal in title function
Fixes #9295
2020-09-29 18:34:35 +02:00
Marc Cornellà 4ec055b890 lib: support alacritty $TERM in title function 2020-09-28 22:25:10 +02:00
Marc Cornellà 765966606d lib: correct :q syntax in title function for clarity 2020-09-27 14:15:50 +02:00
Marc Cornellà 9521837240 lib: support mlterm-256color
Co-authored-by: Peter J. Schroeder <peterjschroeder@gmail.com>
2020-07-23 12:55:22 +02:00
Patrick Moore e606ac7051
Handle unset variables in various parts of the codebase (#8944)
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.
2020-06-30 18:54:27 +02:00
joshuashaffer b706a91917
core: add title support for mlterm (#8303) 2020-06-19 23:16:31 +02:00
Marc Cornellà 2eb3e9d57c
lib: support konsole* $TERM in title function (#8035) 2020-03-05 17:26:16 +01:00
Marc Cornellà b9d5ee7913
lib: automatic title: replace fg with description from jobs (#7982)
* 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>
2020-03-03 20:21:29 +01:00
Marc Cornellà 02d1253809
lib: clean up termsupport.zsh 2020-03-03 20:17:01 +01:00
Marc Cornellà d7825313cc
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.
2020-03-03 20:10:43 +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
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
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
Jeremy Armstrong 8aa8405ea2 termsupport: add support for tmux* $TERM values (#7622) 2019-03-21 20:41:55 +01: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
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
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
Ionel Cristian Mărieș d55111f200 Support all kinds of putty-like terminal strings. 2015-12-01 00:59:35 +02:00
Ionel Cristian Mărieș 711c1bcb40 Add support for "putty" $TERM in termsupport.zsh 2015-11-30 15:16:47 +02:00
Andrew Janke f0981d564a termsupport: protect subshell with quotes 2015-11-27 15:58:06 +01:00
Andrew Janke 00eb465830 Merge branch 'master' into fold-terminalapp-plugin-into-termsupport 2015-08-17 20:59:39 -04:00
Andrew Janke 47d19cc564 Add defensive emulate -L zsh to termsupport functions 2015-08-17 20:55:41 -04:00
Robby Russell 7c60da9e1f Merge pull request #4233 from apjanke/apple-term-no-dupe-folder-in-title
termsupport: avoid repeated dir in window title in Terminal.app
2015-08-12 21:15:59 -07:00
Robby Russell f6a2b97356 Merge pull request #4203 from apjanke/title-protect-promptsubst
termsupport: protect title() with `emulate -L zsh` for portability
2015-08-12 21:12:21 -07:00
Robby Russell d1ea849fdd Merge pull request #2106 from adepasquale/master
Added ssh-like mosh window title
2015-08-12 21:01:00 -07:00
Andrew Janke 14b4ba83c3 Move urlencode/urldecode functions to core lib 2015-08-09 16:28:47 -04:00
Andrew Janke 17da983442 termsupport: avoid repeated dir in window title in Terminal.app 2015-08-09 15:15:12 -04:00
Andrew Janke 90ea67edf0 termsupport: protect title() with emulate -L zsh
This prevents it from malfunctioning when `setopt prompt_subst` is off.
2015-07-31 22:23:12 -04:00
Andrew Janke 88f42b6132 Add support for variant "utf8" locale suffix spelling. Fix dumb bug in iconv call that would cause it to hang. 2015-02-21 16:25:28 -05:00
Andrew Janke cb37c934c0 Remove unnecessary braces. 2015-02-21 16:00:40 -05:00
Andrew Janke 187cf07c91 For unspecified encodings, assume it's UTF-8 or compatible (e.g. ASCII) and muddle through without character encoding conversion. 2015-02-17 00:54:54 -05:00
Andrew Janke 702ff1ca91 Add support for non-UTF-8 encodings in caller's locale. 2015-02-17 00:49:53 -05:00
Andrew Janke 3a18c33f17 In termsupport, use LC_CTYPE instead of LANG to enable byte-by-byte text processing. LANG doesn't seem to actually work. 2015-02-14 20:30:03 -05:00
Andrew Janke a9e97e5d2d Remove terminalapp plugin and fold its implementation in to lib/termsupport.zsh. Replaces the redundant Terminal.app support that was recently added to termsupport. 2015-02-14 19:05:27 -05:00
Marc Cornellà 3704fbb71e Extract CWD notifier back out of auto-title hooks 2015-02-13 15:57:18 +01:00
Marc Cornellà 2e41d06b76 Use quoted $TERM value everywhere 2015-02-10 19:53:40 +01:00
Marc Cornellà b7e5dd35ef Quick-fix code style 2015-02-10 19:52:58 +01:00
Andrew Janke 4fc6dccb42 term: Move DISABLE_AUTO_TITLE check to hooks
Move the DISABLE_AUTO_TITLE check from title() to the preX hook
functions that call it, to allow the title() function to be used
directly by user or other callers.
2015-02-10 19:38:11 +01:00
Andrew Janke be7028012e Reword comments on termsupport internal functions. 2015-02-04 01:00:51 -05:00
Andrew Janke 5f79ab5547 Move chpwd update output from chpwd hook to precmd to avoid
contaminating script/function output
2015-01-27 21:00:07 -06:00
Andrew Janke 7295e38885 termsupport: add chpwd hook for setting pwd in Apple Terminal.app 2014-12-21 15:05:22 -05:00
Jingwen Owen Ou dc9e1764cf Fix missing add-zsh-hook
In older version of zsh, `add-zsh-hook` is not available, causing issues like:

```
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found
/Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found
```

See https://github.com/robbyrussell/oh-my-zsh/issues/748. This patch pulls in the changes suggested in https://github.com/robbyrussell/oh-my-zsh/issues/748#issuecomment-37862691 by @mcornella and I have tested it on RHEL 5.
2014-08-22 15:59:17 -07:00
Andrea De Pasquale 12324856c6 Added ssh-like mosh window title
Display the hostname when running Mosh (http://mosh.mit.edu/).
Same thing as displaying "hostname" when running "ssh hostname".
2014-06-05 23:27:59 +02:00
Marc Cornellà 5137e0e509 Escape % in $CMD variable
Fixes formatting on some rare cases when a percent ends up
in the $CMD variable, like these below:

- When assigning a variable, $CMD ends up with the second parameter;
in this case, $CMD will contain '+%s%N', messing with the syntax:

 $ a=`date +%s%N`

- A function (or command in general) that contains a percent symbol:

 $ to\%() { echo $(( $1 * 100 / $3))\% } # $CMD=to%()
 $ to% 2 of 10 # $CMD=to%
2014-03-25 21:14:20 +01:00