Commit Graph

1779 Commits

Author SHA1 Message Date
Aaron Gyes
d69a68e265 Comment fixes. 2016-06-26 21:14:45 -07:00
Aaron Gyes
534c1287ca Add back prompt_pwd to solve empty output problem
..by not manipulating path at all if we do not have
the tools to do so.

Tag changes with better comments.
2016-06-26 20:54:04 -07:00
Aaron Gyes
81dee16d69 Add back prompt_pwd to solve empty output problem
..by not manipulating path at all if we do not have
the tools to do so.

Tag changes with better comments.
2016-06-26 20:25:11 -07:00
Aaron Gyes
02f578a82d echo the no-string errors to stderr and return 1.
Fix output on launch

Drop __fish_urlencode.fish

Drop prompt_pwd.fish
2016-06-26 16:25:41 -07:00
Aaron Gyes
dfb4998778 Work around absent `string' in old fishies upgrading.
Improves experience during upgrades, accidentally running
an old fish with a new environment. No errors just from
printing a prompt. Fixes #3057.

Print helpful notice also when launching mismatched fish.

Autoloadable string.fish -- only create function if not builtin.
2016-06-26 16:25:41 -07:00
Fabian Homborg
8070cd81d6 npm completions: Check command npm existence
Really fixes #3158 and #3152.

(cherry picked from commit 10661bb024)
2016-06-21 17:43:55 +02:00
Fabian Homborg
10661bb024 npm completions: Check command npm existence
Really fixes #3158 and #3152.
2016-06-21 17:42:22 +02:00
Fabian Homborg
7365b6bd0c Bind clipboard-copy to \cx, restore yank binding
Fixes #3160.
2016-06-21 16:19:40 +02:00
Fabian Homborg
d66d51f101 systemctl completions: Add reset-failed completion
Fixes #3153.
2016-06-21 12:43:50 +02:00
Fabian Homborg
bc8ec46ef9 npm completions: Call command npm
npm is often wrapped by a function.

Fixes #3158.

(cherry picked from commit 3a0d417b9e)
2016-06-21 12:40:23 +02:00
Fabian Homborg
3a0d417b9e npm completions: Call command npm
npm is often wrapped by a function.

Fixes #3158.
2016-06-21 12:03:29 +02:00
Fahri Cihan Demirci
db0176b884 Add Purge Subcommand Completion for Apt (#3097) 2016-06-20 18:23:12 -07:00
Jens Fredskov
7cf6ef675a correct __fish_contains_opts to __fish_contains_opt (#3102)
Completion throws and error about the command `__fish_contains_opts` beings unknown. It seems to be a simple typo, as all other completions use `__fish_contains_opt`
2016-06-20 18:16:10 -07:00
Fabian Homborg
29664c42a0 git completions: Ignore stderr everywhere
This allows us to run git commands outside of a git repo.

Fixes #3114.
2016-06-20 18:11:26 -07:00
Fabian Homborg
8dc4b0d4b2 Merge pull request #3123 from moverest/completion
Extend autocompletion support
2016-06-20 18:05:01 -07:00
Boris Aranovich
cb74f0f60e Refine reading ssh_config (#3146)
https://www.freebsd.org/cgi/man.cgi?query=ssh_config&sektion=5
1. It is possible to add multiple whitespace characters between the keyword (i.e. Host) and the argument(s).
2. It is allowed to have a single = and whitespace between the keyword and the argument(s).
3. It is possible to add multiple host names under a single Host directive by spacing the names apart.

1. and 3. are actual conventions that we use in our team, and I couldn't get auto-complete working for fish without this modification.

Modification explained:
a. The space between Host(?:name)? and the \w.* was replaced by (?:\s+|\s*=\s*) to match any sequence of whitespace characters, or optional whitespaces with a single =, per spec.
b. Result of first replacement is piped through another string replace to switch duplicate whitespace characters to a single space, and then piped to be split by that space. This allows specifying several aliases or host names in a single Host/Hostname definition, also per spec.
2016-06-20 17:06:45 -07:00
Aaron Gyes
7ac32e45cb Remove SHLVL check.
Fixes #3154.
2016-06-18 22:20:18 -07:00
Aaron Gyes
f04644f749 Lossless recompress of images with pngcrush+zopfli
And tweak RTF.
2016-06-18 10:03:26 -07:00
Aaron Gyes
e6d4ac5ee2 Decrease minimum SHLVL for suspend without --force
There is some discussion on #2269
2016-06-15 23:05:36 -07:00
Aaron Gyes
cfe3fc301c string escape some eval calls 2016-06-15 21:41:37 -07:00
Boris Aranovich
cbe97ac1a1 Refine reading ssh_config (#3146)
https://www.freebsd.org/cgi/man.cgi?query=ssh_config&sektion=5
1. It is possible to add multiple whitespace characters between the keyword (i.e. Host) and the argument(s).
2. It is allowed to have a single = and whitespace between the keyword and the argument(s).
3. It is possible to add multiple host names under a single Host directive by spacing the names apart.

1. and 3. are actual conventions that we use in our team, and I couldn't get auto-complete working for fish without this modification.

Modification explained:
a. The space between Host(?:name)? and the \w.* was replaced by (?:\s+|\s*=\s*) to match any sequence of whitespace characters, or optional whitespaces with a single =, per spec.
b. Result of first replacement is piped through another string replace to switch duplicate whitespace characters to a single space, and then piped to be split by that space. This allows specifying several aliases or host names in a single Host/Hostname definition, also per spec.
2016-06-15 17:54:40 +02:00
Aaron Gyes
ab1db7ebee Quote eval ... webconfig.py in fish_config.fish
This was causing issues launching fish_config on OS X if fish.app is
renamed to contain a space (noted, but likely not the actual problem,
in issue #3140)
2016-06-14 11:31:10 -07:00
Aaron Gyes
723d689679 Completion for string match --invert
Also adds descriptions for some other options which were absent.
2016-06-13 23:10:05 -07:00
Fabian Homborg
5d20750aaa Merge pull request #3123 from moverest/completion
Extend autocompletion support
2016-06-10 18:47:55 +02:00
Fabian Homborg
222a07e907 Allow compressed man pages in help
It seems Fedora compresses our whopping 340k of man pages.

Fixes #3130.

Inspired by @TieDyedDevil's work there.
2016-06-10 14:13:15 +02:00
Clément Martinez
4d49c902ac Fix and enhance netctl-auto completions
I mixed things up with `netctl` somehow. Since the two are quite
different they do not have the same function, they should not have
the same completions.

I also find that I would be smarter to only display the relevent
profiles given what we want to do. If we want to disable a profile
we should only complete with enabled profile for completion for
instance. I don't know if the implemention is nice enough however.
2016-06-08 23:34:51 +02:00
Clément Martinez
65ed22d5a6 Add help option completions for godoc, gofmt, goimports, golint, gorename 2016-06-08 17:21:16 +02:00
Clément Martinez
09f9d71bb2 Clean mkdir completions 2016-06-08 16:03:21 +02:00
Clément Martinez
059e11078c Split __fish_print_modules from modprob.fish and modinfo.fish 2016-06-08 15:13:18 +02:00
Clément Martinez
e30db95baa Refine mkdir completions for non SELinux and non GNU 2016-06-08 14:30:39 +02:00
Clément Martinez
970d895aca Add xz completions 2016-06-08 13:40:27 +02:00
Clément Martinez
c9b3220160 Add modinfo completions 2016-06-08 13:40:27 +02:00
Clément Martinez
10575d895d Add lscpu completions 2016-06-08 13:40:27 +02:00
Clément Martinez
67f3c01396 Add gorename completions 2016-06-08 13:40:27 +02:00
Clément Martinez
536d6cebd9 Add golint completions 2016-06-08 13:40:27 +02:00
Clément Martinez
7a97095583 Add goimports completions 2016-06-08 13:40:27 +02:00
Clément Martinez
f37dafdf52 Clean udisksctl 2016-06-08 08:32:50 +02:00
Clément Martinez
c84137aec8 Clean netctl-auto and udiskctl completions 2016-06-07 20:41:04 +02:00
Clément Martinez
f1dc1cd92b Add udisksctl autocomplete 2016-06-07 16:50:28 +02:00
Clément Martinez
41f2344cea Add termite autocomplete 2016-06-07 16:50:28 +02:00
Clément Martinez
a965a71079 Add poweroff autocomplete 2016-06-07 16:50:28 +02:00
Clément Martinez
913624cbfa Add netctl-auto autocomplete 2016-06-07 16:50:28 +02:00
Clément Martinez
220fd418a7 Add mkdir autocomplete 2016-06-07 16:50:28 +02:00
Clément Martinez
5dda908c1f Add gofmt autocomplete 2016-06-07 16:50:28 +02:00
Clément Martinez
b7f45c3783 Add godoc autocomplete 2016-06-07 16:50:28 +02:00
Clément Martinez
3a6e239437 Add alsamixer autocomplete 2016-06-07 16:50:28 +02:00
Fabian Homborg
fcbeddc3eb Remove $__fish_vi_mode
This makes fish_mode_prompt rely on $fish_key_bindings instead.

fish_bind_mode is also set in default mode (only always "default"), so
it can't be used as the indicator.

Closes #3067.

(cherry picked from commit 8ab980b793)
2016-06-06 22:21:52 +08:00
Fabian Homborg
32a585a52b git completions: Only take general options before command 2016-06-04 12:27:06 +02:00
Fabian Homborg
410d92ed61 git completions: Ignore stderr everywhere
This allows us to run git commands outside of a git repo.

Fixes #3114.
2016-06-04 12:26:06 +02:00
Hunsu
24d6f6d066 Add completions for git blame command (#3094) 2016-06-02 12:49:01 +02:00
Jorge Bucaran
aee9d2c9d7 Do not hardcode RGB values in color definitions. 2016-06-01 21:50:19 -07:00
Jens Fredskov
29c38d73a2 correct __fish_contains_opts to __fish_contains_opt (#3102)
Completion throws and error about the command `__fish_contains_opts` beings unknown. It seems to be a simple typo, as all other completions use `__fish_contains_opt`
2016-06-01 23:58:38 +02:00
Fahri Cihan Demirci
8d11bb9f86 Add Purge Subcommand Completion for Apt (#3097) 2016-06-01 00:56:22 +02:00
Fabian Homborg
2768d2ea06 Style fixes for fish_vi_cursor
"$fcn"

[ci skip]
2016-05-30 16:40:49 +02:00
Andreas Wagner
3d19b549c8 Fix utf-8 decoding error in file_is_overwritable of create_manpage_completions.py 2016-05-29 14:12:32 -07:00
Fabian Homborg
bfb5fec330 Remove stray "0" output from man completions 2016-05-29 14:34:20 +02:00
Fabian Homborg
0d257fd651 Man completions: Don't show sections when completing pages 2016-05-29 14:31:42 +02:00
Fabian Homborg
ebde55f704 Man completions: Show all pages for a section
If one is given, of course.
2016-05-29 14:31:12 +02:00
Fabian Homborg
f23464001f Indent __fish_git_prompt 2016-05-29 14:10:10 +02:00
Fabian Homborg
0882e0cb95 Git prompt: Remove legacy option
Git has supported `rev-list --count` for years, so this shouldn't be
needed anymore.
2016-05-29 14:07:15 +02:00
Fabian Homborg
763c620d0b Stringify git prompt 2016-05-29 14:06:12 +02:00
Fabian Homborg
2871096f9c git completions: Add general options
These are the options between `git` and the subcommand.

Fixes #3087.
2016-05-29 13:59:22 +02:00
Fabian Homborg
8e88b29eeb Git prompt: Shorten the sha ourselves
Possibly fixes #3083.
2016-05-28 19:30:29 +02:00
Fabian Homborg
aaaea44714 Git prompt: Only shorten sha if needed
This speeds up the common case when IO is slow, e.g. when used with
sshfs.

We only use the short sha for figuring out whether the state is
valid (for which a long sha should also work) and for display when HEAD
is detached (I think that's the correct git-ism).

Working towards #3083.
2016-05-28 17:58:29 +02:00
Fabian Homborg
d79a5a3152 Funced: Make removal safer, take two
Now we try to remove the file and then the directory, without forcing
anything, showing any (quite unexpected) error to the user, once.
2016-05-28 12:34:04 +02:00
Frederik “Freso” S. Olesen
7af9e1f5c5 Split off __fish_complete_blockdevice from mount.fish.
The __fish_complete_blockdevice function can be useful to other
completions than mount.fish, so it should live on its own so its
available to those.
2016-05-27 14:56:47 -07:00
Frederik “Freso” S. Olesen
980fb59232 Remove executable flag from pacaur completion. 2016-05-27 14:48:41 -07:00
Fabian Homborg
53c506f109 Run fish_indent on default_key_bindings 2016-05-25 16:10:16 +02:00
Fabian Homborg
7d1f45e25f Add clipboard helper functions and bind them
\cy copies, \cv pastes.
2016-05-25 16:10:16 +02:00
Fabian Homborg
b9848538e3 Funced: Limit damage when removing tmpfile
This will now only forcibly remove _files_, not directories.

$tmpdir _should_ be something only we use in /tmp, but mktemp might screw up.
2016-05-24 13:55:09 +02:00
Dan Underwood
475439fa0b Test for Atom Package Manager now passes correctly
Move to `string match` syntax from `grep` caused test to see if the Atom Package Manager is installed to always fail. This appears to fix the issue (tested on fish 2.3.0 with apm 1.6.0).
2016-05-24 11:24:01 +00:00
Fabian Homborg
dac8483f7e Simplify some code in abbr
We actually need less duplication here.
2016-05-23 19:59:02 +02:00
Fabian Homborg
46f4819ffa Fix printing "--" in abbr --show 2016-05-23 19:59:02 +02:00
Fabian Homborg
c238ad35bd Fix "--" argument in abbr 2016-05-23 19:59:02 +02:00
Fabian Homborg
309e10e7a2 Don't mangle arguments in abbr
This now (rightly) throws an error if there's a space in the
key (because we can't store it).

Fixes #2997.
2016-05-23 19:59:02 +02:00
Fabian Homborg
5accc7c6c5 Fix funced's tmpfile generation on OSX
OSX mktemp... isn't great, so work around that fact.
2016-05-23 00:49:09 +02:00
Fabian Homborg
60317190bd Check validity of fish_key_bindings
This potentially leads to an unusable session (when fish_key_bindings is
set in config.fish to a value without corresponding function), so we
should take care.
2016-05-22 19:56:47 +02:00
Jorge Bucaran
14b953e414 Add missing color definitions to __fish_init_1_50_0 reset. (#2987)
* Add missing color definitions to __fish_init_1_50_0 reset.

The values where determined by inspecting the values of:

* fish_color_end
* fish_color_user
* fish_color_host

after resetting the color theme via fish_config.

* Add documentation for fish_color_user and fish_color_host.

(cherry picked from commit 08c29727e0)
2016-05-20 21:02:56 +00:00
Fabian Homborg
573b3797a5 Improve asp's package completion 2016-05-19 14:52:38 +02:00
Fabian Homborg
a0b3b8ac4c Add networkctl completion
Very simple, but effective.
2016-05-19 14:50:25 +02:00
Fabian Homborg
4d63ebde15 Remove stray "=" from completions. 2016-05-19 14:29:04 +02:00
Fabian Homborg
9cee3f13a1 Implement src:dest for git push completion
This allows specifying a local branch to push to a certain remote
branch.

Fixes #3035.
2016-05-19 14:11:27 +02:00
Fabian Homborg
8dc74de92e Add completion for ip
This is quite ugly because the syntax is ugly, the documentation both
under- and overspecified at the same time (a BNF that isn't...) and it
has a lot of functionality.

But the completion works half-decent for `ip address`, so let's ship it.
2016-05-19 13:23:00 +02:00
Aaron Gyes
00e32a0909 Use fonts found on terminals for the web config.
Instead of just using Courier New across the board, have the
browser try several likely available fonts before defaulting
to the system's "monospace".

Thanks @MarkGriffiths
Fixes #2924
2016-05-18 11:21:14 -07:00
Kurtis Rader
51468b7646 add function --shadow-builtin flag
It's currently too easy for someone to bork their shell by doing something
like `function test; return 0; end`. That's obviously a silly, contrived,
example but the point is that novice users who learn about functions are
prone to do something like that without realizing it will bork the shell. Even
expert users who know about the `test` builtin might forget that, say, `pwd`
is a builtin.

This change adds a `--shadow-builtin` flag that must be specified to
indicate you know what you're doing.

Fixes #3000
2016-05-14 20:38:32 -07:00
ridiculousfish
768277a312 Remove the errant newline in __fish_cancel_commandline again
(cherry picked from commit 149e601743)
2016-05-13 23:19:53 +01:00
ridiculousfish
149e601743 Remove the errant newline in __fish_cancel_commandline again 2016-05-13 12:10:17 -07:00
Fabian Homborg
a998921f39 git: Complete reflog for reset 2016-05-13 16:18:29 +02:00
CoolOppo
3daccf3c22 fix typo in webconfig.py comment 2016-05-11 19:51:08 -07:00
Fabian Homborg
c63c88262b Indent git completion
It's about time I finally fixed my emacs config.
2016-05-11 15:06:10 +02:00
Fabian Homborg
fbe2cdc3c7 git completion: Complete commits for cherry-pick if at least three
characters are given
2016-05-11 15:05:56 +02:00
Fabian Homborg
b60ef72c3d git completion: Fix option-before-command for stash
Because it allows sub-subcommands, it has functions to determine which,
if any, is used. These were too simplistic.
2016-05-11 15:03:05 +02:00
Fabian Homborg
d2e79cf6f6 git completion: More stringification 2016-05-11 15:03:05 +02:00
Fabian Homborg
a38d5504ac git completion: Allow --pretty for more commands
This _should_ be all of them.
2016-05-11 15:03:04 +02:00
Fabian Homborg
76d24aa1bc git completion: Allow more than one arg to using_command
Now we can easily add an option to multiple commmands.

This should also fix some edgecases.
2016-05-11 15:03:04 +02:00
Fabian Homborg
a7605d584b git completion: Show commits for revert and tag --contains 2016-05-11 14:51:54 +02:00
Terje Larsen
4244a6e6fe Add git commit --fixup completions (#3021) 2016-05-11 13:33:22 +02:00
Kurtis Rader
3626c39398 fix the style of several functions
I'm going to modify these functions as part of dealing with issue #3000
and don't want those changes to be masked by running the files through
`make style`.
2016-05-08 16:27:15 -07:00
Daniel Bergmann
c53951b9b3 Add tags to completion list for git show. (#2998)
(cherry picked from commit ac47100a7d)
2016-05-08 14:07:32 +02:00
[Redacted]
4d1e77fcae Added completions for rmmod (#3007)
(cherry picked from commit 59c8800c4d)
2016-05-08 14:07:32 +02:00
Vladimír Čunát
4efd0dfd65 docs: fix location of generated_completions (#3010)
(cherry picked from commit 100eef4e42)
2016-05-08 14:07:32 +02:00
Vladimír Čunát
100eef4e42 docs: fix location of generated_completions (#3010) 2016-05-08 13:51:30 +02:00
[Redacted]
59c8800c4d Added completions for rmmod (#3007) 2016-05-08 10:01:57 +02:00
Daniel Bergmann
ac47100a7d Add tags to completion list for git show. (#2998) 2016-05-07 12:05:44 +02:00
Elis Axelsson
8ec81393a3 Change abbr to allow non-letter keys (#2996)
(cherry picked from commit 1c6f6df2b3)
2016-05-06 16:17:01 +02:00
Elis Axelsson
1c6f6df2b3 Change abbr to allow non-letter keys (#2996) 2016-05-06 16:15:47 +02:00
Fabian Homborg
527e5f52ba Remove useless case completions
It doesn't take options and what it takes (arbitrary strings) we can't
sensibly complete.
2016-05-04 14:51:09 +02:00
Kurtis Rader
d97c22df2d add floating point output to math command
This makes it easy for the user to request floating point output with the
desired number of digits after the decimal point (not to be confused with
significant digits).

Note that this is just a thin wrapper so someone can say `math -s3 10 / 3`
rather than `math "scale=3; 10 /3"`.

Resolves #1643
2016-05-03 19:29:04 -07:00
Fabian Homborg
ed086fb1c8 Bind btab also in vi-bindings
It wasn't inherited.

Fixes #2964.
2016-05-03 16:29:15 +02:00
Jorge Bucaran
08c29727e0 Add missing color definitions to __fish_init_1_50_0 reset. (#2987)
* Add missing color definitions to __fish_init_1_50_0 reset.

The values where determined by inspecting the values of:

* fish_color_end
* fish_color_user
* fish_color_host

after resetting the color theme via fish_config.

* Add documentation for fish_color_user and fish_color_host.
2016-05-01 11:58:43 +02:00
Kurtis Rader
1cd4731c2d don't use colors when writing the ^C indicator
There was an extended discussion in https://github.com/fish-shell/fish-shell/issues/2904 about using a bright yellow background to make the cancelled command indicator, ^C, standout. The upshot was that standout (i.e., reversing fg/bg colors) mode should be used until themes are agumented with proper support for background colors and special characters.

(cherry picked from commit a897ef0025)
2016-04-30 12:31:57 -07:00
Kurtis Rader
a897ef0025 don't use colors when writing the ^C indicator
There was an extended discussion in https://github.com/fish-shell/fish-shell/issues/2904 about using a bright yellow background to make the cancelled command indicator, ^C, standout. The upshot was that standout (i.e., reversing fg/bg colors) mode should be used until themes are agumented with proper support for background colors and special characters.
2016-04-30 12:25:15 -07:00
Fabian Homborg
fb1443a885 Remove using_command from netctl completions
This allows `; and netctl` to work.

First step towards #2705.
2016-04-30 16:53:20 +02:00
Fabian Homborg
05a432da32 Remove using_command from netctl completions
This allows `; and netctl` to work.

First step towards #2705.
2016-04-30 16:51:49 +02:00
Fabian Homborg
404ab5e9ab git completion: Allow optional "+" for push
This signifies a force-push.

To avoid cluttering, only complete branches if a + is already given.

Fixes #2879.

(cherry picked from commit fde26d4049)
2016-04-30 16:35:14 +02:00
Fabian Homborg
901652d5c3 Add repository/refspec completion to git
A few commands (fetch, pull and push at least) take a "repository" (aka
"remote") and then a "refspec" (we currently do branches here).

Fixes #2525 (seems that man is still alive)

(cherry picked from commit b32bf22616)
2016-04-30 16:35:14 +02:00
Fabian Homborg
fde26d4049 git completion: Allow optional "+" for push
This signifies a force-push.

To avoid cluttering, only complete branches if a + is already given.

Fixes #2879.
2016-04-30 16:30:02 +02:00
Fabian Homborg
b32bf22616 Add repository/refspec completion to git
A few commands (fetch, pull and push at least) take a "repository" (aka
"remote") and then a "refspec" (we currently do branches here).

Fixes #2525 (seems that man is still alive)
2016-04-30 16:21:41 +02:00
Kurtis Rader
52731c480c provide a realpath implementation
Not all distros have a `realpath` command. Provide a function that uses the
real command if available else use the fish builtin.

Fixes #2932

(cherry picked from commit 6c329e8a83)
2016-04-29 21:30:26 -07:00
Kurtis Rader
54319435f4 clarify fish_vi_mode deprecation warning
Also, correct the Vi mode default escape timeout. I intended it to be 100 ms
in my previous change but it ended up 10 ms which is far too short. A 10 ms
delay will continue to cause problems for people running fish inside `screen`,
`tmux`, or over high latency connections.

Cherry-picked from 3e24ae80b3
2016-04-29 15:52:10 -07:00
ridiculousfish
b064da8d38 Erase the autosuggestion in fish_cancel_commandline by clearing to EOL 2016-04-29 15:33:46 -07:00
ridiculousfish
ba5a55b754 Remove an errant newline in the fish_cancel_commandline output
Now the next line appears immediately after the cancelled line,
without an intervening newline
2016-04-29 14:55:23 -07:00
Sanne Wouda
09bb713989 git takes --help even when it needs a command (#2984)
`git --help` is a valid command and fish should complete it as such
2016-04-29 12:59:04 +02:00
Fabian Homborg
6466ffe82d git completion: Only show unmerged branches for cherry-pick 2016-04-29 12:59:04 +02:00
Sanne Wouda
8fc6011741 git takes --help even when it needs a command (#2984)
`git --help` is a valid command and fish should complete it as such
2016-04-29 12:42:15 +02:00
Kurtis Rader
3e24ae80b3 clarify fish_vi_mode deprecation warning
Also, correct the Vi mode default escape timeout. I intended it to be 100 ms
in my previous change but it ended up 10 ms which is far too short. A 10 ms
delay will continue to cause problems for people running fish inside `screen`,
`tmux`, or over high latency connections.
2016-04-28 20:53:09 -07:00
Kurtis Rader
6c329e8a83 provide a realpath implementation
Not all distros have a `realpath` command. Provide a function that uses the
real command if available else use the fish builtin.

Fixes #2932
2016-04-28 16:03:27 -07:00
Fabian Homborg
5fa8370c13 git completion: Only show unmerged branches for cherry-pick 2016-04-28 21:30:26 +02:00
Cody Scott
96a28df018 switch to newer flag --set-upstream-to for git (#2982)
set-upstream was deprecated in git 1.8.0 as stated in [1] in favor
of set-upstream-to. this patch replaces the old flag in fish
completions

[1]: https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/1.8.0.txt
2016-04-28 21:26:45 +02:00
Kurtis Rader
ce41e3468e add way to comment/uncomment a command
Fixes #2375

(cherry picked from commit 2f8d0e9aba)
2016-04-28 14:58:15 +08:00
Fabian Homborg
bc35ca6366 Make busctl completions useful
- More accurate

- Fast enough to be usable (previously, this would sometimes take a few
  seconds)

- A bit smaller
2016-04-27 14:22:16 +02:00
Fabian Homborg
d0fdc80725 Make busctl completions useful
- More accurate

- Fast enough to be usable (previously, this would sometimes take a few
  seconds)

- A bit smaller
2016-04-27 14:17:29 +02:00
Fabian Homborg
daa217f533 Allow setting key bindings universally
As always, we default to setting globally.
2016-04-26 15:21:15 +02:00
Fabian Homborg
e67505bead Remove named arg in fish_default_key_bindings
This wasn't actually used anywhere.
2016-04-26 15:21:15 +02:00
Fabian Homborg
e6ad48ea1b Set fish_key_bindings globally in binding functions
This should fix the tests.
2016-04-26 15:21:15 +02:00
Fabian Homborg
ba5a22e2ce Deprecate fish_vi_mode
This was never mentioned in the documentation as the way to switch to
vi-mode, and now does nothing of value anymore.
2016-04-26 15:21:15 +02:00
Fabian Homborg
f5241da836 Let the binding functions set the binding variable
This ensures they can just be called and "the right thing" will happen -
fish_user_key_bindings will be executed, the variable will reflect the bindings.
2016-04-26 15:21:15 +02:00
Fabian Homborg
8ab980b793 Remove $__fish_vi_mode
This makes fish_mode_prompt rely on $fish_key_bindings instead.

fish_bind_mode is also set in default mode (only always "default"), so
it can't be used as the indicator.
2016-04-26 15:21:15 +02:00
Kurtis Rader
2f8d0e9aba add way to comment/uncomment a command
Fixes #2375
2016-04-19 18:38:58 -07:00
Fabian Homborg
e7599fd18c Allow overriding fish_term24bit on launch
(cherry picked from commit ba1008b750)
2016-04-18 14:20:42 +02:00
Fabian Homborg
8d3eae0d76 Move 24bit setup into config.fish
Fixes #2941.

(cherry picked from commit 8558561650)
2016-04-18 14:20:42 +02:00
Fabian Homborg
ba1008b750 Allow overriding fish_term24bit on launch 2016-04-18 14:19:34 +02:00
Fabian Homborg
8558561650 Move 24bit setup into config.fish
Fixes #2941.
2016-04-18 14:19:34 +02:00
Kurtis Rader
f034d8ba3a number dirh output to make prevd/nextd easier
Fixes #2786
2016-04-16 18:40:16 -07:00
Yauhen Kirylau
c2e9cda7b3 Add completions for 'pacaur' (#2934) 2016-04-15 15:10:21 +02:00
Laurence McGlashan
4aa8fc753f Correct typo in valgrind completions 2016-04-15 15:10:21 +02:00
Fabian Homborg
635a1e9dd2 Remove the default self-insert binding in vi-default mode
Fixes #2832.
2016-04-15 15:10:21 +02:00
Yauhen Kirylau
21e927d24e Add completions for 'pacaur' (#2934) 2016-04-15 13:45:48 +02:00
Kurtis Rader
5f849d0264 provide a better experience when user presses \cC
Fixes #2904
2016-04-14 20:57:04 -07:00
Laurence McGlashan
b5b8d9010e Correct typo in valgrind completions 2016-04-13 14:54:33 -07:00
Fabian Homborg
85799ee86e Remove the default self-insert binding in vi-default mode
Fixes #2832.
2016-04-12 21:40:14 +02:00
Fabian Homborg
d7c690b416 Fix "." and ".." paths in cd completions
Previously if a directory called "a" was in $CDPATH, `cd ./a<TAB>` would
complete from there even if it was invalid.
2016-04-08 15:03:49 +02:00
Aaron Gyes
36691df6fe Stringify many completions and functions, with --invert stringification.
I believe apm must have been buggy - example output that I found online
showed `tr` was mangling paths with spaces in it. Should be fixed.

Also, use dscl on OS X in __fish_complete_users.fish like
__fish_print_users.fish already does.
2016-04-08 10:49:29 +08:00
David Adam
200a10e78d Rename "snippets" to "conf" internally, and document them as snippets
Discussed in #2896.
2016-04-06 09:33:09 +08:00
David Adam
484c1484c9 Customisable extra configuration, completion and function directories
- Add options to the autotools build to set the path for the "vendor"
   or "extra" configuration snippets, functions and completions
   directories.

 - Remove the vendor_completions directory from the Xcode build, as
   these are relocatable and compiling the paths in does not make sense.

This allows packaging tools like Homebrew and Nix to use a common
directory outside of the main prefix for third-party completions, and
to make these available for programmatic discovery through `pkg-config`.

Closes #2113
2016-04-04 15:58:13 -07:00
Fabian Homborg
0953590cca cd completion: No description for absolute paths
This also removes the "pushd/popd" dance and only executes the CDPATH
stuff when we need to.
2016-04-04 18:22:48 +02:00
Sam Yu
7e014174b8 __fish_print_packages: use libzypp builtin cache for zypper 2016-03-30 15:03:51 +02:00
Fabian Homborg
aacdaee6a9 Add history --help
This was probably an oversight - the builtin supports it, the function doesn't.
2016-03-30 15:03:51 +02:00
Kurtis Rader
a148b755a6 more fish_indent cleanup for prev commit
Commit dfb23c4fce was supposed to incude
all the edits to make the code compliant with fish_indent.
2016-03-29 16:42:58 -07:00
Kurtis Rader
dfb23c4fce fix regression to vi-mode \cc binding
Commit c0e8ad6 on 2015-10-02 to "Make vi bindings inherit the defaults"
inadvertently reverted commit b6b6de3. Fix that regression. And while I
hate to make "git blame" say I changed the entire file make the function
adhere to fish_indent style.
2016-03-29 15:33:37 -07:00
Josef Gajdusek
0eb3fd6b3f Make modprobe completion more precise
Only match loaded modules when -r is specified.

Also adds /lib/modules/(uname -r)/misc to the search path.
This directory is used by Gentoo for package-provided modules
(such as the app-emulation/virtualbox-modules)
2016-03-28 14:38:19 +02:00
Josef Gajdusek
6663c73eb0 Fix typos: ingnore->ignore 2016-03-28 14:38:19 +02:00
Fabian Homborg
7accadc33f Only read .fish files in the snippets directories
This would allow us to add a README and allows users to easily disable
something temporarily.
2016-03-26 19:20:40 +01:00
Bogdan Sinitsyn
516695ff21 add yaourt completions 2016-03-24 16:17:10 +01:00
Kurtis Rader
9d2b53450a limit size of cd history to 25 directories
The existing implementation grows the $dirprev array without bounds. Besides
causing what would appear to be a memory leak it also makes the nextd and
prevd commands more expensive than they need to be. It also makes it harder to
create a useful "menu" cd command.

In addition to implementing a reasonable limit on the size of the $dirprev
array I've reformatted the code using fish_indent.

Update the documentation to include mentions of the $dirprev and $dirnext
variables as well as the limit on how much directory history is kept.

Fixes 2836
2016-03-23 13:36:00 -07:00
Fabian Homborg
a81bd697a8 Make reading ssh files case-insensitive
Fixes #2843
2016-03-22 11:09:36 +01:00
Federico Ferri
168a156e58 implement swap-selection-start-stop function
The swap-selection-start-stop function goes to the other end of the highlighted text, the equivalent of `o' for vim visual mode.

Add binding to the swap-selection-start-stop function, `o' when in visual
mode.

Document swap-selection-start-stop, begin-selection, end-selection, kill-selection.
2016-03-20 19:22:04 -07:00
Federico Ferri
879ee61a30 fix w, e (with a trick to cope with big-words) 2016-03-20 19:17:15 -07:00
Kurtis Rader
fb0921249f add \r equivalent binding
Add a binding that was overlooked by commit
d65c63322e.

Fixes #2834
2016-03-20 12:08:46 -07:00
Cody Frazer
1828def866 Add --no-index option completion for git diff 2016-03-20 10:10:51 -05:00
Fabian Homborg
dedc7f6f03 Fix acpi check in nim prompt 2016-03-20 12:20:39 +01:00
Fabian Homborg
de0349399c robbyrussell prompt: Check for git/hg existence
Fixes #2826
2016-03-20 12:17:00 +01:00
Owen Richardson
9f0417b587 make alt-L output respect multi-line prompts
Fixes #718
2016-03-18 15:53:29 -07:00
lordlycastle
540bdfcb02 date and uniq completions for OS X. 2016-03-12 13:57:37 +01:00
Fabian Homborg
6288f89bf9 Move code in etc/config.fish to share/config.fish
instead add a bit of information on how fish's configuration works for
the admin to etc/config.fish.

This means that fish is fully functional without /etc, which might be nice for "stateless" systems.
2016-03-09 13:07:04 +01:00
David Adam
f4c14b69a2 Update dpkg completions to complete commonly used options
Closes #2798.
2016-03-06 21:29:09 +08:00
ridiculousfish
e3968ba872 Remove "w/o Background Color" text from Set Theme button in fish_config
This is important information but the Set button is the wrong place to
put it.
2016-03-02 15:02:28 -08:00
Fabian Homborg
0e8a8a7c80 Migrate abbrs from =-separated to space-separated
We silently upgrade existing abbreviations and change the separator when
saving.

This does not yet warn when the user is using the old syntax.

Resolves #2051
2016-03-02 10:59:12 -08:00
Fabian Homborg
fbd53f2da1 Check ssh's KnownhostsFiles in print_hostnames
These are an additional source of information

Thanks to @sysbot (#2313) for the inspiration.

This also stringifies the ssh_config reading
2016-03-02 15:16:52 +01:00
Fabian Homborg
65aeaab054 print_hostname: Avoid matches in fstab comments harder 2016-03-02 15:16:52 +01:00
Fabian Homborg
94c12d84e2 Stringify reading nfs in print_hostnames 2016-03-02 15:16:52 +01:00
Fabian Homborg
a5f5e6c1ef Ignore zero-ips in print_hostnames
This would be a lot of useless options for those who block via hosts.
2016-03-02 15:16:42 +01:00
Jaime Marquínez Ferrándiz
61fd8b9861 history.fish: Fix input handling
Pass the input to 'string', it was accidentally removed in fcdc6a48c0.
2016-03-02 14:26:10 +01:00
Fabian Homborg
5446841069 Ditch __fish_sgrep in obnam completions 2016-02-28 18:07:57 +01:00
Fabian Homborg
fb5a8a089e Use command which in type
Turns out some shells will alias which to be something function-aware,
but doing this on fish would blow up because it would call type which
would then call which which would then call type....

Fixes #2775
2016-02-28 12:12:13 +01:00
Kevin Ballard
d8a497434f Rewrite __fish_urlencode to not encode valid characters
Much better to only encode the characters that are not URL-safe. This
also doesn't involve any forking, and it even handles newlines and NULs
in the input.
2016-02-27 00:14:52 -08:00
Kevin Ballard
2bb7c587f4 Skip over /etc/paths.d entries that don't exist
I had an old /etc/paths.d/TeX file that listed a path /usr/texbin that
doesn't exist anymore. This was causing the `set PATH` to print a
warning.
2016-02-26 20:26:24 -08:00
Kevin Ballard
2187c0a84b Standardize indentation in config.fish 2016-02-26 20:22:59 -08:00
Fabian Homborg
c1b384e5d3 Add functions and configuration snippets hierarchy
This allows "vendors" (i.e. third-party upstreams interested in
supporting fish) to add auto-loaded functions and eager-loaded
configuration "snippets", while still allowing both the user and the administrator to
fully override all of that.

This has been inspired by systemd's configuration hierarchy, and implements a similar scheme
whereby files with the same name in higher-ranking directories override files in lower-ranking ones.

Fixes #1956
2016-02-26 12:14:55 +01:00
Fabian Weisshaar
a805d401b8 add completions for diskutil (osx) 2016-02-23 13:54:46 +01:00
Aaron Gyes
613739ba07 Try to just see if grep is happy with --color=auto, or not, as the --help exit status varies in BSD vs. GNU. 2016-02-20 21:11:40 +01:00
Jak Wings
1767681f9a Fix the file URL for Terminal.app
* When using a UTF-8 locale, set locale to C temporarily in order to
  read one byte at a time.
* Use the builtin printf in a forward-compatible way. (GNU)
* Improve the readability of the code.
2016-02-16 21:49:58 -08:00
ridiculousfish
c184c1a81a Correctly handle --merge in the history.fish function
Previously --merge happened to work, but only because it was
smuggled in through the 'print' command
2016-02-16 11:34:36 -08:00
Aaron Gyes
31a617408f Fix typo 2016-02-16 05:14:33 -08:00
Aaron Gyes
a6565bbea8 Fix --merge hitting a case 2016-02-16 05:09:54 -08:00
Sunguk Lee
b72837a0f4 Improve __fish_print_users
Patch from `__make_users_completions` of killall command completion
2016-02-15 19:31:20 +09:00
Sunguk Lee
c4f702b7c4 Fix No command 'dscl' found error of killall command
`dscl` command have OSX system, to change `__fish_print_users`
2016-02-15 19:30:58 +09:00
Fabian Homborg
eb0d18add4 Rewrite abbr.fish to not call seq
This speeds up adding new abbrs by about 50 to 60% - from 2.3s to 1s for
100 abbrs.
2016-02-13 17:08:19 +01:00
Fabian Homborg
585bdf45c8 abbr: Bail early when the abbr already exists
This speeds up the common case of `abbr -a` calls in config.fish by
about 90% - from 900ms to 90ms for 100 calls.
2016-02-13 17:08:19 +01:00
Gordon Tyler
89206d8654 Fix user browser for help in Cygwin
Fixes the invocation of a user-specified browser by the `help` command on Cygwin.

- Use `cygstart` to launch the browser with escaped quotes to avoid problems with spaces in the path to the browser, (e.g. Program Files).
- Use `cygpath` to convert the base help dir to a Windows path before constructing the fie URL to pass to the browser.
2016-02-12 23:53:17 +01:00
Spittie
a00e26b109 Fix package listing for zypper
-E is only supported by BSD sed, switch to -r which is also supported
by GNU sed
2016-02-12 23:00:40 +01:00
Fabian Homborg
52f8707c3e Use string split in export.fish
It's a bit more explicit than replace.
2016-02-10 20:33:43 +01:00
Fabian Homborg
b6e058985b Fix "replacement string too large" error in pacman completion
Turns out we can skip using string altogether, thanks to the magic of
the cartesian product.
2016-02-10 15:35:01 +01:00
Fabian Homborg
57fcbecb41 Improve __fish_print_service_names
- Reuse systemd completion functions
- Remove a fork
- Fix #2715 - FreeBSD
- Comments
2016-02-07 14:53:12 +01:00
Fabian Homborg
adc3b0e122 eselect completion: Silence eselect php output
The version with the features we use isn't in gentoo stable yet and
older versions print a very ugly warning.
2016-02-04 23:31:32 +01:00
Elis Axelsson
29d06760bc Update eselect completions to work for the php-module
refs #1131
2016-02-04 23:30:06 +01:00
ridiculousfish
25ad8866c9 Merge change for lengthened and configurable escape key timeout 2016-02-04 13:56:49 -08:00
Kurtis Rader
2646d51a0b change default escape timeout
This changes the default escape timeout for the default keybindings (emacs
mode) to 300ms and the default for vi keybindings to 10ms.

I couldn't resist fixing a few nits in the fish_vi_key_bindings.fish file
since I was touching it to set the escape timeout.
2016-02-04 13:39:19 -08:00
Fabian Homborg
b908d0b89b Another stringification (__fish_complete_command) 2016-02-04 13:53:55 +01:00
Fabian Homborg
cadb5d51ea Replace tr invocations 2016-02-03 23:47:46 +01:00
Fabian Homborg
fcdc6a48c0 Stringify history.fish 2016-02-03 23:45:54 +01:00
Fabian Homborg
16aa0b93e9 Stringify __fish_complete_lpr_option 2016-02-03 23:26:41 +01:00
Fabian Homborg
158ea98189 Replace uses of expr with math/string 2016-02-03 23:23:59 +01:00
Fabian Homborg
962f9914c6 Stringify trap 2016-02-03 23:23:04 +01:00
Fabian Homborg
1688b2384f pacman: Stringify 2016-02-02 09:48:55 +01:00
Fabian Homborg
0c94c2b9e8 pacman: Remove outdated "$argument" hack
This doesn't seem to speed up anything.
2016-02-02 09:48:26 +01:00
Fabian Homborg
d3f6c8a694 pacman: Improve --files completion
Missed one option and the option-as-command-hack
2016-02-02 09:47:44 +01:00
Fabian Homborg
e086e27f98 Update pacman/makepkg completions for pacman 5
Some new options, one new operation - "--files".
2016-02-02 09:23:23 +01:00
Dan Martinez
c7ba446c23 Add support for brew's desc subcommand 2016-01-21 15:01:18 -08:00
Fabian Homborg
4b2495f28f Skip greeting on empty variable
It used to be that way and we recommend `set fish_greeting` (i.e. set to
empty) in the docs - possibly since we check if the variable is defined
on upgrade.
2016-01-18 21:56:59 +01:00
ridiculousfish
d7f38a0802 Tweak language and styling of background color text in fish_config 2016-01-14 23:16:34 -08:00
Kurtis Rader
a77ce393ba respond to feedback 2016-01-14 22:34:25 -08:00
Kurtis Rader
f8ed1d182e improve set_color and theme color documentation
This is meant to make it clear that fish cannot control the terminal
window background color. It also augments the set_color documentation to
describe how it decides which color the terminal can display.

Resolves #2421.
Resolves #2184.
2016-01-14 22:34:25 -08:00
Fabian Homborg
68fcb790b0 Add all boolean values to pacmd completion
PA accepts "0", "false" and "off" (among others) for false also for suspend-*.
2016-01-14 23:33:31 +01:00
Fabian Homborg
8db1a5fae7 Add completions for Pulseaudio's pacmd
To implement this mostly as a wrapper around pactl, we add the list of
commands for this to that. It's 90% the same anyway. (This means that
`pactl suspend ` will complete files instead of commands like `pactl
banana ` would, but neither is correct)
2016-01-14 23:31:17 +01:00
Fabian Homborg
6bf70c86d2 Only complete unloaded modules for pactl load-module
This now officially does more than the official bash completion!
2016-01-14 22:36:50 +01:00
Fabian Homborg
b7d98fa873 Add profiles and ports completion to pactl
This is now on par with the official bash completions.
2016-01-14 22:21:50 +01:00
Fabian Homborg
daafe4ef37 Add completion for pulseaudio's pactl 2016-01-14 21:21:54 +01:00
Fabian Homborg
ed1919b266 abbr: Ensure we don't split on "=" if the given separator is " "
This fails on e.g. an abbr that uses `env a=b`, like the included test demonstrates.

Unfortunately it decreases the speed again (2s vs 2.2s vs 4s original),
but correctness is more important.
2016-01-14 16:58:29 +01:00
Fabian Homborg
ac545940de Optimize and modernize abbr
- Replace __fish_abbr_escape with `string escape`

- Don't double-parse the key

- Replace IFS magic with string

Together, this seems to speed it up by a factor of about 2.
2016-01-14 16:57:07 +01:00
Fabian Homborg
7a8cbcda06 Disable 24bit-color on neovim's terminal
Unfortunately, nvim will, even when running in a terminal that supports
it, swallow the sequences whole, rendering the displayed text _white_.

This means falling back to 256 colors is the lesser evil as at least a
blue-ish color will display as blue while a red-ish will be red, instead
of both showing white.

nvim's behavior does _not_ change depending on
$NVIM_TUI_ENABLE_TRUE_COLOR or any other option I could find and neovim-qt
exhibits the same behavior.

Fixes #2600.
2016-01-14 15:17:49 +01:00
Fabian Homborg
8e79da3b2d Fix typos
Fixes #2673.
2016-01-12 00:08:41 +01:00
Fabian Homborg
c56df11128 Add completions for kcmshell5
A tool to open KDE Plasma settings menus.
2016-01-09 18:58:03 +01:00
Fabian Homborg
6027eae1a1 Add completions for asp
A package information and build tool for archlinux, replacement for the
ageing "abs".
2016-01-09 18:58:03 +01:00
Fabian Homborg
bd482898d4 Simplify and stringify valgrind completions
These used _eval_ when a simple variable capturing would have sufficed.
2016-01-09 18:58:03 +01:00
Aurélien Deharbe
2a4f21cc92 Add completions for the haskell 'stack' build tool 2016-01-08 21:50:41 +01:00
Fabian Homborg
8cc213ed4f hg_prompt: Use string match -q instead of redirection 2016-01-08 14:10:03 +01:00
Fabian Homborg
4f519297dd Add new named colors to webconfig
The 'br' variants were added in 0a0acc8, but not to named_colors in
webconfig.py.

Fix this oversight.
2016-01-08 14:00:54 +01:00
Nathan Zadoks
92d0d98a24 Pass the full argv to the NixOS command-not-found handler
This patch is currently floated from the NixOS side as part of
https://github.com/NixOS/nixpkgs/pull/12000, but prior versions of the
hook ignore anything but the first argument anyway, so this is
backwards-compatible.
2016-01-03 14:32:12 +01:00
Fabian Homborg
8eca775977 hg prompt: Throw away string match input
This would print redundant characters
2015-12-31 14:21:37 +01:00
Fabian Homborg
c3971957ac hg prompt: Fix indentation 2015-12-31 14:21:37 +01:00
Fabian Homborg
9a7b2b190b hg prompt: Make display slightly nicer
The "/" between branch and bookmark might be mistaken for a path.

Parens (like the git prompt) make it look a bit more like a unit.
2015-12-31 14:21:37 +01:00
Fabian Homborg
6f2f0cfce2 Optimize hg prompt
Mainly replace hg calls since python is slow to start.
2015-12-31 14:21:37 +01:00
Fabian Homborg
3a249bb549 Include mount helpers in filesystem completion
Probably not a thing on OSX, but this should print nothing then.

On linux, it helps detect e.g. ntfs-3g.
2015-12-30 19:02:03 +01:00
Fabian Homborg
1a12071a48 Immediately define command-not-found handler
This skips the weird dance where we'd define a simple handler and then
later overwrite with a fancier one, once the first event came in.

It turns out that isn't necessary, as it doesn't actually improve
startup speed because the checks needed to define fancier handlers are fast.

In case we are non-interactive, still define the simple handler, and
keep the default handler for users to switch to.
2015-12-30 16:26:54 +01:00
Fabian Homborg
b7fb11cb7f git completion: Complete commits for all branches 2015-12-30 16:26:28 +01:00
Maxim Gonchar
95c30f7a23 Use \$ and \^ instead of their unicode codes 2015-12-30 12:49:44 +01:00
Maxim Gonchar
d5fe5c02a8 Update visual vi key bindings
* Add home/end, $/0 keys
* Add (c)hange key
* Add j/k keys for up/down
2015-12-30 12:49:44 +01:00
Fabian Homborg
759b45ad79 Remove temporary set_default function
This could potentially delete a user-defined set_default on first start.

It's also trivially done with set -q var; or set -U var val.
2015-12-30 12:49:44 +01:00
Fabian Homborg
834ebef53c Simplify greeting
We have already confirmed we're interactive, and `echo` is a builtin now.
2015-12-29 15:58:48 +01:00