Commit graph

33 commits

Author SHA1 Message Date
Fabian Boehm
612e66af0f prompt_pwd: Escape $HOME
This is used with a regex, so if it contained any metacharacters
they'd be used.
2022-09-04 09:18:57 +02:00
Johannes Altmanninger
7fb4b7c8bd prompt_pwd: stop clobbering global/universal fish_prompt_pwd_full_dirs
Closes #9123
2022-08-07 20:24:51 +02:00
Aaron Gyes
4a6dbe0922 prompt_* functions: shorten their descriptions 2022-01-22 20:06:37 -08:00
Fabian Homborg
6c1ec98e92 prompt_pwd: full-dirs set to 0 means not even last component is safe
Alternative is to print an error.
2021-08-09 17:42:00 +02:00
Fabian Homborg
af2952dd2f Allow passing directories to prompt_pwd
This allows us to test it without cd-ing about the place.
2021-08-09 17:42:00 +02:00
Fabian Homborg
7a8feb4656 prompt_pwd: Allow keeping components full length
And allow passing the parameters as options.
2021-08-09 17:42:00 +02:00
Johannes Altmanninger
49c5f96470 Use set -l to force use of a local variable
Bare set overwrites a global/universal variable if it exists.
2020-05-15 08:25:07 +02:00
Fabian Homborg
9367d4ff71 Reindent functions to remove useless quotes
This does not include checks/function.fish because that currently
includes a "; end" in a message that indent would remove, breaking the test.
2020-03-09 19:46:43 +01:00
Kurtis Rader
30940916bd update prompt_pwd to use argparse 2017-07-13 14:12:51 -07:00
Kurtis Rader
11a60c8374 reformat all fish scripts
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
2016-11-27 21:27:22 -08:00
Fabian Homborg
8a6f26ff9b Document prompt_pwd
Fixes #253
2015-12-17 15:25:13 +01:00
Gary Peck
09bd938e25 Add ability to customize the amount of path shortening in prompt_pwd
Allows the length of each shortened path component to be customized by setting the `fish_prompt_pwd_dir_length` variable to the number of characters to include (plus a leading dot because that's special). Maintains the default behavior of shortening path components to just one character. You can also set `fish_prompt_pwd_dir_length` to an empty or invalid value or 0 to disable shortening completely.
2015-10-26 13:11:13 +01:00
Fabian Homborg
86471ac21f Remove OSX/Cygwin special cases from prompt_pwd
For cygwin, you can't `cd C:`, so a prompt of "C:/Something" is
misleading.

For OSX, we dereference symlinks elsewhere

This also simplifies prompt_pwd quite a bit.
2015-10-09 17:45:45 +02:00
Ian Ray
16061d06a9 prompt_pwd: zero fork prompt in general case
Now only one fork (uname) occurs on first load.
2015-10-04 12:36:49 +02:00
Jonas Hietala
5238ed309f Match the whole real home directory in prompt_pwd. 2015-08-08 23:19:01 +02:00
David Adam
5638764bad prompt_pwd: Use tilde expansion to get real full home path
Closes #1133.
2014-10-26 14:20:49 +08:00
Kevin Ballard
a7727765dc Clean up prompt_pwd with the new function -V flag
Also fixes `cd /private` displaying as no path on OS X.
2014-10-02 18:41:39 -07:00
nulltrek
e031fa7207 Fix some typos. 2013-09-12 11:46:31 +02:00
Konrad Borowski
3e115b7a85 Mac OS X doesn't support uname -o. Use uname instead.
I break compatibility with Mac OS X again, that I don't have access
to. Result: Stuff break, and I have to fix it, so it will perhaps
work. At least, I hope it will work.
2013-08-16 20:48:44 +02:00
Konrad Borowski
feb36e7342 Show drive letter under Cygwin
/c/c looks awful, and C:/ is simply better.
2013-08-14 12:11:09 +03:00
ridiculousfish
9ca12e9f9d Squashed commit of the following:
commit 5a577d970a293afe320b6c3280c10c2bd8a1ff50
Merge: 908b075 96941b3
Author: ridiculousfish <corydoras@ridiculousfish.com>
Date:   Sat Jun 1 22:59:16 2013 -0700

    Merge branch 'dotdir-two-chars' of git://github.com/GlitchMr/fish-shell into GlitchMr-dotdir-two-chars

commit 96941b3a92
Author: Konrad Borowski <glitchmr@myopera.com>
Date:   Sat May 25 09:55:43 2013 +0200

    Support BSD sed

commit 60652c2bd2
Author: Konrad Borowski <glitchmr@myopera.com>
Date:   Sun May 19 10:58:40 2013 +0200

    Show first two characters for dotdirs. Fixes #754.
2013-06-01 23:02:13 -07:00
Emily Eisenberg
d07e78c59a Make prompt_pwd make a lot more sense
Remove the case statements, which were handled by the sed blocks anyway
Move around the '/' character in the regex, so only one regex is needed
Fix a bug where '/' is output as '//'
2012-07-06 14:46:50 -07:00
Kevin Ballard
1a93cbba1e Bring prompt_pwd under Darwin to parity with non-Darwin
The echo command to print the last path segment got a couplel of fixes,
but these fixes were only applied to the non-Darwin version. Copy these
fixes over to the Darwin version. Notably, this makes `/` stop
displaying as `//`.
2012-06-24 14:04:43 -07:00
Kevin Ballard
529d410bec Fix prompt_cwd on darwin systems when $PWD is "/private"
When $PWD is "/private", the prompt was printing "rivate". Skip the
"/private" stripping if there's nothing after it.

Prevent "/private" from being stripped anywhere but the beginning of the
PWD.

Fixes #173
2012-06-24 14:04:43 -07:00
Grissiom
70322077d2 remove trialing spaces #2 2010-09-18 10:18:26 +08:00
axel
5fc42fcaff prompt_pwd broken, this fix by James Reeves
darcs-hash:20090221104759-ac50b-35f7a896d3e62cd002605d47c090c7bec992317b.gz
2009-02-21 20:47:59 +10:00
Nick Pilon
79784d3e18 This patch fixes a problem where prompt_pwd was printing the full path twice under OS X and probably BSDs. (Which, needless to say, made for very long prompts) The problem was that (Free?)BSD sed and GNU sed handle ? differently. For BSD sed, ? is not special unless the -E flag is specified. The {0,1} syntax should work the same way in both.
darcs-hash:20080122180340-5b666-21f1cdb835cbfa458a0f3d7344370837db962388.gz
2008-01-23 04:03:40 +10:00
liljencrantz
b86856b454 In prompt_pwd, if a directory name starts with a dot, include first two characters. This patch was written by Denilson F. de Sá
darcs-hash:20080116223621-75c98-46f96c9f25d5e32cd10148d35713622e6eac50d7.gz
2008-01-17 08:36:21 +10:00
axel
c9fe154c01 Avoid using test command in prompt, makes it slightly faster
darcs-hash:20070908191717-ac50b-c2d936bff0e7aead0aecad6aa9e024e63b72fc97.gz
2007-09-09 05:17:17 +10:00
axel
7492b6cdb3 Make all descriptions for function calls use the implicit translation from the previous patch instead of explicitly using N_
darcs-hash:20070116012918-ac50b-c1c0df64333ad910ca81dbc86ad193ece6680722.gz
2007-01-16 11:29:18 +10:00
axel
746a602515 Make sure that the / is only printed once in prompt_pwd function when cwd is root
darcs-hash:20060710223848-ac50b-ddb52c414fd8b08bd7c515c99cc4e05a3c479c7d.gz
2006-07-11 08:38:48 +10:00
axel
c2f6c6c1d2 Do gettext translation of descriptions just-in-time internally in fish
darcs-hash:20060301165347-ac50b-3df9feec60dd9860e0988396d10b550a501f6802.gz
2006-03-02 02:53:47 +10:00
axel
343cafef34 Redo installation file structure, move lots of things to $PREFIX/share/fish
darcs-hash:20060217101339-ac50b-d93d2c620a4b7f75f05ff461a6edbee001da7613.gz
2006-02-17 20:13:39 +10:00
Renamed from init/functions/prompt_pwd.fish (Browse further)