Commit Graph

1126 Commits

Author SHA1 Message Date
ArkBriar
5faa425df1 fix #4521 (#4575) 2017-12-04 22:51:20 -08:00
Aaron Gyes
fa57565c42 Fix fish_opt --help showing nextd manpage. 2017-11-14 01:56:58 -08:00
WEBER Logan
11cebe9483 feat(share:git-prompt): be able to truncate the branch name with a defined max length 2017-11-13 10:57:42 +01:00
Judson
37e0fbb5e4 Paginating last command
Often, I want to paginate the command I just ran.

Easy enough to <up><alt-p>, but this patch saves a keystroke.
2017-11-01 07:35:26 +08:00
Fabian Homborg
720f4ad742 Also allow "sles" as OS-ID for command-not-found-handler
"Suse Linux Enterprise Server".

Fixes #4447.
2017-10-19 19:09:29 +02:00
Fabian Homborg
d18b0be518 Revert "Fix cd completions if a directory exists in $CDPATH and $PWD"
That's not what happens - I had set CDPATH to start with ".".

See #4484.

This reverts commit 1af38d69a8.
2017-10-16 19:33:38 +02:00
Aaron Gyes
fb8ae04f80 Rename $FISH_VERSION back to the original $version.
Order is restored in the universe. Fixes #4414
2017-10-14 08:33:02 -07:00
Fabian Homborg
1af38d69a8 Fix cd completions if a directory exists in $CDPATH and $PWD
E.g. if "foo" is in CDPATH, and both "foo/bar" and "./bar" exist, `cd
bar` will go to ./bar.

The completions described "bar" as going to "foo/bar" ("CDPATH foo").

This fixes it by checking for ./bar's existence.

See #4475.
2017-10-13 18:32:36 +02:00
madblobfish
649e244092 fish_update_completions: error when python not found (#4454) 2017-10-12 06:00:50 -07:00
Mahmoud Al-Qudsi
46d1334f95 Silence bind errors in default key bindings
This silences binding errors due to keys not found in the current
termcap config in the default fish bindings.

Closes #4188, #4431, and obviates the original fix for #1155

It was necessary to re-implement builtin_bind as a class in order to
avoid passing around the options array from function to function and
as adding an opts parameter to `get_terminfo_sequence` would require
otps to be passed to all other builtin_bind_ functions so they could, in
turn, pass it to `get_terminfo_sequence`.
2017-10-03 11:20:17 +02:00
Aaron Gyes
1ef310c3a8 Fix export returning 1 on success
Fixes #4435
2017-10-01 01:11:17 -07:00
Fabian Homborg
281d468285 Rewrite systemctl completion with argparse
This

- Offers more candidates

- Is more reactive (it'll always incorporate "--state=" and "--type="

- Is faster (about 800ms to about 120ms)

- Needs fewer function files

All __fish_systemctl_* functions except __fish_systemctl_services have
been removed.
2017-09-29 20:07:18 +02:00
Mahmoud Al-Qudsi
338311af1e Install custom LSS script to /usr/local/share/fish on make install
Decided to move doc_src/fish.lss to share/lynx.lss, which just makes
more sense all around. Accordingly, now using {$__fish_datadir} instead
of {$__fish_help_dir} in help.fish.

Makefile now installs the custom lss on make install
2017-09-26 14:31:11 -05:00
Mahmoud Al-Qudsi
8b858f2fcc Use a custom Lynx style sheet (LSS file) to work around Lynx bug
Lynx uses a very naïve method of applying styles to HTML elements by
hashing the element type and the class name to generate a map of
hash:style. After the hash is calculated, Lynx does not go back and
check whether or not the actual string values match the LSS properties.

See the following links on the Links mailing list:
 * http://lists.gnu.org/archive/html/lynx-dev/2015-12/msg00037.html
 * http://lists.gnu.org/archive/html/lynx-dev/2015-12/msg00039.html

This patch copies the default Lynx stylesheet but removes highlighting
and other styles that would result in unreadable text (due to not enough
contrast with the background color), and if the `help` builtin detects
that the best web browser to use is Lynx, it instructs it to use this
modified stylesheet.
2017-09-26 13:44:19 -05:00
Mahmoud Al-Qudsi
2b425ad221 Don't use xdg-open if running in terminal mode (i.e. no Xorg)
If the $DISPLAY environment variable is not set, xdg-open should not be
used to load the web browser. Just because it is installed does not mean
that the user exclusively runs in an X session.

Needed for Lynx detection to work around #4170
2017-09-26 13:42:40 -05:00
Mahmoud Al-Qudsi
3b3bcc998e Speed up __fish_print_hostnames for faster completions
Thanks to @ThomasAH, as per #4378. Tested on many platforms (OS X,
FreeBSD, Linux, and Solaris). Works with IPv4 and IPv6 as well as
host names and loopback addresses.
2017-09-26 09:21:16 -05:00
Mahmoud Al-Qudsi
6513db35c1 Support colored ls output on Solaris 11
Closes #1223
2017-09-26 08:55:28 -05:00
oddwheel
a05bcc6a63 Suppress git prompt CRLF warnings noise
Drawing prompt in repo with text=auto attribute and mixed line endings in files was spawning crlf conversion warnings to terminal from unsilenced stderr of git diff
2017-09-22 18:57:36 +02:00
Aaron Gyes
25d83ed0d7 seq fallback speedup
Using `string match` instead of `grep -E` resulted in a 2x-3x speedup according
to $CMD_DURATION.
2017-09-22 00:30:26 -07:00
Kurtis Rader
67946b5509 Drop deprecated history search --with-time flag (#4403)
This flag was only documented for a few weeks before being renamed
`--show-time` and has been deprecated for a long time. Fish 3.0 is a good
opportunity to remove it.
2017-09-15 19:28:44 -07:00
Kurtis Rader
ee1d310651 Implement history search --reverse (#4375)
* Implement `history search --reverse`

It should be possible to have `history search` output ordered oldest to
newest like nearly every other shell including bash, ksh, zsh, and csh.
We can't make this the default because too many people expect the
current behavior. This simply makes it possible for people to define
their own abbreviations or functions that provide behavior they are
likely used to if they are transitioning to fish from another shell.

This also fixes a bug in the `history` function with respect to how it
handles the `-n` / `--max` flag.

Fixes #4354

* Fix comment for format_history_record()
2017-09-14 15:44:17 -07:00
David Adam
725febb669 Revert "convert popd and pushd to use argparse"
This reverts commit 05aae4764b.

Closes #4398.
2017-09-14 12:36:37 +08:00
ridiculousfish
a5fd0b317e Revert "Switch to bare vars in our math invocations"
This reverts commit bd18736ee5.

Bare variables should only be used in commands that must
manipulate the variable stack, such as `set`.
2017-09-09 23:35:47 -07:00
Fabian Homborg
b00daebec2 __fish_print_hostnames: Use string replace -f
Saves one `string match` invocation.

Also removes a useless-use-of-cat.

(cherry picked from commit 4437e8d8d6)
2017-09-07 16:30:17 +02:00
daniel-surename
ed475ab24b fix: git status in __fish_git_prompt_informative_status (#4365)
Added and staged files weren't shown in the prompt,
had a missing $ to denote variables
2017-08-29 23:50:27 -07:00
Kurtis Rader
bd18736ee5 Switch to bare vars in our math invocations
Using bare vars is more efficient because it makes the builtin `math`
expression cache more useful. That's because if you prefix each var with
a dollar-sign then the fish parser expands it before `math` is run.
Something like `math x + 1` can be cached since the expression is the
same each time it is run. But if you do `math $x + 1` and x==1 then you're
effectively executing `math 1 + 1`. And if x==2 the next time then you're
running `math 2 + 1`. Which makes the expression cache much less effective.
2017-08-24 12:38:10 -07:00
Kurtis Rader
d10decabda Make builtin math the default implementation
Remove our `math` function that wraps `bc`. Our math builtin is now good
enough that it can be the default implementation.

Another step in resolving #3157.
2017-08-23 17:32:49 -07:00
Kurtis Rader
6e02ec83d1 Fix typo in xdg-mime completion functions 2017-08-17 10:54:05 -07:00
MoritzKn
5eb0b34da1 Update xdg-mime helper
This will respect the `/usr/local/share/applications/` directory when
fetching mime infos.

Update xdg-mime helper to comply with the xdg spec.

This also makes sure __fish_print_xdg_applications_directories only prints
directories that exist.

Relevant specs:
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
https://specifications.freedesktop.org/desktop-entry-spec/latest/ape.html
2017-08-17 10:50:06 -07:00
sentriz
72173a93a7 Accept return as a valid answer to 'Edit the file again?'
Also, check for affirmative answer so a random string isn't taken as a
"yes" response.
2017-08-14 18:18:41 -07:00
Fabian Homborg
4e2b11f2e0 help: Fix error if no argument is given 2017-08-14 18:18:10 -07:00
Sam Yu
d87c0424d8 Speedup git prompt
Fix __fish_git_prompt too slow under repo with lots of untracked
files when __fish_git_prompt_showuntrackedfiles enabled.
2017-08-06 13:24:33 -07:00
Kurtis Rader
8b79f4e5c9 use the new set -a and set -p in our scripts 2017-08-04 18:02:24 -07:00
Kurtis Rader
d4fb75e9f3 fix bug in abbr function
I introduced a bug in the `abbr` function with commit 17dff8c by
referencing the undefined `$cmd` variable. This fixes that.
2017-08-03 23:52:07 -07:00
Kurtis Rader
17dff8c569 rewrite abbr function
Rewrite the `abbr` function to store each abbreviation in a separate
variable. This greatly improves the efficiency. For the common case
it is 5x faster. For pathological cases it is upwards of 100x faster.
Most people should be able to unconditionally define abbreviations in
their config.fish without a noticable slow down.

Fixes #4048
2017-08-03 14:35:06 -07:00
Kurtis Rader
1a55e9ba60 Merge branch 'master' into major 2017-07-29 21:58:15 -07:00
Kurtis Rader
4e026588f4 modify prev commit to use builtin cd
Using the `cd` function can have undesirable side effects like mucking
with the directory history. So force the use of the builtin cd.
2017-07-27 14:36:32 -07:00
Kurtis Rader
defdc92b57 fix ssh config Include file handling
Fixes #4253
2017-07-27 14:36:32 -07:00
Kurtis Rader
92f39f7b89 fix bug introduced by commit 86af63cd3 2017-07-25 14:03:40 -07:00
Kurtis Rader
35a7db50a2 fix bug introduced by commit 86af63cd3 2017-07-25 14:02:50 -07:00
Kurtis Rader
8e87d595b7 remove some uses of $IFS
This is a step towards resolving issue #4156. It replaces uses of `$IFS`
with other solutions.
2017-07-24 20:45:43 -07:00
Kurtis Rader
d068f846e8 simplify history function
The fix for #4232 allows us to simplify the `history` function slightly.
2017-07-21 16:26:15 -07:00
Kurtis Rader
d376cb316f simplify history function
The fix for #4232 allows us to simplify the `history` function slightly.
2017-07-21 16:25:03 -07:00
Fabian Homborg
e0f0164b16 Quote $USER when used with switch or test
Common in prompts, this would fail if $USER is empty.

See #4229.
2017-07-20 19:45:32 +02:00
Kurtis Rader
0dc92fbb2d a make style-all cleanup 2017-07-18 22:40:25 -07:00
Kurtis Rader
69ecda5082 update math to use the new argparse validation 2017-07-18 15:03:08 -07:00
Kurtis Rader
4e1303823b add ability for argparse to validate args
Fixes #4211
2017-07-18 14:42:50 -07:00
Kurtis Rader
403d9691cb fix handling of ssh aliases
Fixes #4213
2017-07-17 21:13:21 -07:00
Kurtis Rader
8f22def8f7 return to psub --file being the default
The recent change to switch `psub` to use `argparse` caused it to use
a fifo by default because it inadvertently fixed a long standing bug in
the fish script. This changes the behavior back to `psub --file` being
the default behavior and introduces a `--fifo` flag. It also updates the
documentation to make it clearer when and why `--fifo` mode should not
be used.

Fixes #4222
2017-07-17 14:33:51 -07:00
Kurtis Rader
3e226f0a5e implement a new implicit int option spec
While updating the `history` function to use `argparse` I realized it is
useful to define an option that can be used in three ways. First by
using the short flag; e.g., `-n NNN`. Second by using the long flag;
e.g., `--max NNN`. Third, as an implicit int flag; e.g., `-NNN`. This
use case is now supported by a spec of the form `n#max`.
2017-07-16 18:27:41 -07:00