Commit Graph

1779 Commits

Author SHA1 Message Date
Aaron Gyes
8277f6a1ba Let git normalize line-endings upon commit (LF)
Only one file belonging to fish-shell had DOS/bogus line endings,
with `git add' picking up changes after updating .gitattributes:
hostname.fish.

Unsurprisingly, it has code to support cygwin and was likely
worked on by a user on a Windows machine. This will help
such cases in the future.

Also, in pcre2-10.21/, there was RunTest.bat which was (correctly)
CRLF formatted.  We don't use this batch script at all, so rather
than LF it or add an exception, blast it away like the other pcre2
files omitted from the repo.
2016-08-01 04:38:08 -07:00
Aaron Gyes
b77e2a67f8 Only do fish_greeting if interactive
Even if __fish_config_interactive, it can be shown when a script
uses `read`.

Fixes #3261, #1401.
2016-07-30 22:47:17 -07:00
Aaron Gyes
e75fc8452f Strip out brackets from generated-by-manpage completions.
Handles cases like cupsctl --\[no-\]remote-admin and
unxz --powerpc[ better.

Fixes #3272
2016-07-30 22:01:59 -07:00
Fabian Homborg
0a51b17716 if started without a locale read system config
A common problem for users is that fish doesn't get a locale. This often
happens if systemd is used with getty and fish as login shell.

Fixes #277

Note that I (@krader) made editorial changes before merging this. For
example, running `make style` and otherwise changing long statements to a
series of shorter statements. So if there are any problems it is possible
I introduced them.
2016-07-27 22:15:54 -07:00
Fabian Homborg
49008d7a1c Fix escaping in abbr --erase completions
Fixes #3267
2016-07-26 15:23:02 +02:00
Aaron Gyes
3669805627 Improve compatibility with 0-16 color terminals.
Fish assumed that it could use tparm to emit escapes to set colors
as long as the color was under 16 or max_colors from terminfo was 256::

 if (idx < 16 || term256_support_is_native()) {
    // Use tparm to emit color escape
    writembs(tparm(todo, idx);

If a terminal has max_colors = 8, here is what happenened, except
inside fish:

 > env TERM=xterm tput setaf 7 | xxd
   00000000: 1b5b 3337 6d                             .[37m
 > env TERM=xterm tput setaf 9 | xxd
   00000000: 1b5b 3338 6d                             .[39m

The first escape is good, that second escape is not valid.
Bright colors should start at \e[90m:

 > env TERM=xterm-16color tput setaf 9 | xxd
   00000000: 1b5b 3931 6d                             .[91m

This is what caused "white" not to work in #3176 in Terminal.app, and
obviously isn't good for real low-color terminals either.

So we replace the term256_support_is_native(), which just checked if
max_colors is 256 or not, with a function that takes an argument and
checks terminfo for that to see if tparm can handle it. We only use this
test, because otherwise, tparm should be expected to output garbage:

 /// Returns true if we think tparm can handle outputting a color index
 static bool term_supports_color_natively(unsigned int c) { return max_colors >= c; }
...

 if (term_supports_color_natively(idx) {

And if terminfo can't do it, the "forced" escapes no longer use the fancy
format when handling colors under 16, as this is not going to be compatible with
low color terminals. The code before used:

 else {
     char buff[16] = "";
     snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);

I added an intermediate format for colors 0-15:

 else {
     // We are attempting to bypass the term here. Generate the ANSI escape sequence ourself.
     char buff[16] = "";
     if (idx < 16) {
         snprintf(buff, sizeof buff, "\x1b[%dm", ((idx > 7) ? 82 : 30) + idx + !is_fg * 10);
     } else {
         snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);
     }

Restores harmony to white, brwhite, brblack, black color names.
We don't want "white" to refer to color color #16, but to the
standard color #8. #16 is "brwhite".

Move comments from output.h to output.cpp

Nuke the config.fish set_color hack for linux VTs.

Sync up our various incomplete color lists and fix all color values.
Colors 0-8 are assumed to be brights - e.g. red was FF0000. Perplexing!

Using this table:
 <http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html>

Fixes #3176
2016-07-24 17:02:29 -07:00
ridiculousfish
46fba342db Revert "Only show greeting on interactive login sessions"
This reverts commit 3d0ea5fe79.
2016-07-24 16:39:44 -07:00
ridiculousfish
5eedb0ee9c Revert "Only show fish greeting for interactive logins"
This reverts commit 3a7a6f16ef.
2016-07-24 16:39:43 -07:00
ridiculousfish
325f047803 Revert "Update __fish_config_interactive.fish"
This reverts commit ec292ec51b.
2016-07-24 16:39:41 -07:00
ridiculousfish
c76f896f69 Revert "Revert "Only show greeting on interactive login sessions""
This reverts commit 88688d02b2.
2016-07-24 16:39:40 -07:00
Aaron Gyes
88688d02b2 Revert "Only show greeting on interactive login sessions"
This reverts commit 3d0ea5fe79.
2016-07-24 03:53:27 -07:00
Aaron Gyes
ec292ec51b Update __fish_config_interactive.fish 2016-07-24 01:42:58 -07:00
Aaron Gyes
3a7a6f16ef Only show fish greeting for interactive logins
This is a regression introduced by 834ebef53c
Bolster with a check for only login sessions too -- hopefully makes it
less annooying on subshells in general.

Fixes #3261
2016-07-24 00:05:05 -07:00
Aaron Gyes
3d0ea5fe79 Only show greeting on interactive login sessions
Fixes #3261
2016-07-23 23:33:20 -07:00
Aaron Gyes
d252704fdb checkout non-empty colorutils.js
The last commit was obviously an error!
2016-07-23 17:18:10 -07:00
Aaron Gyes
dfe363c945 clang-format colorutils.js
.... should make the #3260 diff shorter.
2016-07-23 17:03:32 -07:00
Scott Bonds
99351fcb44 Don't use getent to list hosts if its not supported (#3259)
Fixes #2137 on OpenBSD
2016-07-23 13:24:12 +02:00
Kurtis Rader
b53f42970c correct handling of history args
This fixes several problems with how the builtin `history` command handles
arguments. It now complains and refuses to do anything if the user specifies
incompatible actions (e.g., `--search` and `--clear`). It also fixes a
regression introduced by previous changes with regard to invocations that
don't explicitly specify `--search` or a search term.

Enhances the history man page to clarify the behavior of various options.

This change is already far larger than I like so unit tests will be added
in a separate commit.

Fixes #3224.

Note: This fixes only a couple problems with the interactive `history
--delete` command in the `history` function. The main problem will be
dealt with via issue #31.
2016-07-20 21:18:48 -07:00
Frederik Gladhorn
190fb4a665 git completion: add --stat to show
Of the various options for show, --stat is the one I
regularly use to know the size of a commit.
2016-07-16 20:20:33 -07:00
Frederik Gladhorn
6b99af05a5 Git mergetool completion (#3226)
* git completion: add mergetool

The list of tools is stole from the bash completion file that comes with
git.

* git completion: complete files with merget conflict for mergetool
2016-07-16 00:34:05 +02:00
Frederik Gladhorn
2df263fa26 git completion: Add HEADS
Ranges work with tags and HEAD etc.

Allows to complete "git checkout FETCH_HEAD" and similar.
2016-07-14 22:22:28 +02:00
Frederik Gladhorn
06003f82ae git completion: Rename __fish_git_heads to __fish_git_refs
In git speak, these are refs, while there can be several heads which are
refs in turn.
2016-07-13 11:45:42 +02:00
Aaron Gyes
fb3c839a15 fish_indent did something surprising. 2016-07-11 06:53:20 -07:00
Aaron Gyes
e3187b2361 Actually fix #3221 2016-07-11 06:43:33 -07:00
Aaron Gyes
09291735e6 Use locales preferred date format, fix up options
We don't seem to mention in the documentation that we were forcing
-t for all interactive uses. If we want to do that we should apply
that in the builtin.

history.fish reimplementing every option and doing things kind of
differently is a real pain and it's not clear if the docs are
referring to the or the wrapper script or both.
2016-07-11 01:45:30 -07:00
Aaron Gyes
013506dfd5 Merge pull request #3218 from floam/manparser
Minor manpage completion utility improvements
2016-07-10 10:32:45 -07:00
ridiculousfish
bd2b7764c7 __fish_make_completion_signals to stop spewing on OS X
OS X does not support kill -L or kill -t.
Use the POSIX path to populate __kill_signals
2016-07-09 17:45:16 -07:00
Aaron Gyes
6e0521e23f Completions (mostly): s/.../…/g 2016-07-09 10:57:59 -07:00
Aaron Gyes
d895f876b4 Fix "UNINDENT ..." junk in manpage completions
Problem with Type2ManParser

before:
    complete -c xcode-select -s h -l help --description 'Prints the usage
message. UNINDENT NDENT 0. 0.'
after:
    complete -c xcode-select -s h -l help --description 'Prints the
usage message.'
2016-07-09 07:19:15 -07:00
Aaron Gyes
bb6ce9d142 minor create_manpage_completions.py improvements
Don't truncate long lines with " [See Man Page]" suffix - use the
reclaimed 15 characters for more-useful usage info.

Improve the --verbose output with:
 - spacing fixes
 - diagnostics related to input print repr()/quoted as %r to be less
   confusing.
 - get rid of stupid name() and use type()/__class__.__name__,

- Always use new-style (new as in post python 2.2) classes so this
  behaves the same whether we run in python 2 or 3.

- Properly convert left-quotes and right-quotes to that character in
  deroff.py
2016-07-09 05:51:32 -07:00
Kurtis Rader
14c7cfa84b make kill/pkill completions more robust (#3200)
Someone running fish in an unusual locale reported that an `assert()` was
firing when they typed `pkill c`. I traced it to two bugs. First, the
__fish_make_completion_signals command was producing a weird result. Second,
the builtin `complete` command wasn't adequately verifying its arguments.

Fixes #3129
2016-07-07 18:44:35 -07:00
David Adam
3cd1ef23ab Merge branch 'Integration_2.3.1'
Includes the `string` fallbacks for upgrades from 2.3.1 (as discussed in
issue #3057).
2016-07-03 22:18:55 +08:00
Fabian Homborg
9b4938e2c2 clipboard_paste: Fix lines starting with "-"
Previously, trying to paste "--something" would result in an error from
commandline.
2016-07-03 12:29:58 +02:00
Aaron Gyes
f966248f16 string.fish: use if/else. Reindent. 2016-07-02 11:40:22 -07:00
Aaron Gyes
e597df70d7 Check if fish -c string will work first. 2016-07-02 11:05:04 -07:00
Aaron Gyes
c79e9c7d4e Lossless recompress of images with pngcrush+zopfli
And tweak RTF.
2016-07-01 14:58:56 -07:00
Aaron Gyes
8e7f0e781d Completion for string match --invert
Also adds descriptions for some other options which were absent.
2016-07-01 13:44:14 -07:00
Aaron Gyes
edee3e5eb2 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-07-01 13:41:06 -07:00
Aaron Gyes
bc693bd4e0 fish_indent type -a's function output and colorize
Doesn't colorize if output is redirected.
This is "fun" and indenting happens to make most of the included
functions display more narrow and fit better into a terminal window.
2016-07-01 06:45:03 -07:00
Aaron Gyes
cd422e5d78 fish_indent type -a's function output and colorize
Doesn't colorize if output is redirected.
This is "fun" and indenting happens to make most of the included
functions display more narrow and fit better into a terminal window.
2016-07-01 06:01:37 -07:00
Aaron Gyes
ca6cda20a3 Fix fish_config in .app
* Export $__fish_bin_dir
* Fix incorrect bundle path in fish.cpp - fish is not in MacOS/ (it should be!)
2016-07-01 04:43:57 -07:00
Aaron Gyes
63120a9962 Fix fish_config in .app
* Copy docs into Resrouces
* Export $__fish_bin_dir
* Fix incorrect path in fish.cpp - fish is not in MacOS (it should be!)
2016-07-01 03:57:16 -07:00
Aaron Gyes
807dc82a75 Rename things to avoid conflicts in headers
Was breaking builds

 * ncurses.h: can declare `char *const key_name'.
 * netbsd term.h: has `newline', `lines' macros.
2016-07-01 03:57:16 -07:00
Aaron Gyes
47fbfdca3e Add note about the zombie process 2016-07-01 02:21:13 -07:00
Aaron Gyes
772e35562a suspend output after '\n' not printing before kill 2016-07-01 01:53:43 -07:00
Aaron Gyes
e42f593553 show 'fg' usage for suspend if not forcing 2016-07-01 01:27:03 -07:00
Aaron Gyes
9642fcb589 Update suspend docs. When used, show how to resume
Fixes #3154
2016-07-01 01:18:07 -07:00
Aaron Gyes
7e58a3982a string escape some eval calls 2016-07-01 00:08:46 -07:00
Aaron Gyes
431589a16a Use fish -c string ... as the string fallback.
We can again drop the prompt_pwd check.
2016-07-01 00:00:53 -07:00
Kurtis Rader
cbee315b1b fix the history function and man page
The previous commit to add a `--with-timestamp` flag to the `history` command
caused me to notice the history function didn't recognize the new long option.
Neither did it recognize the short options for the builtin command. This
change fixes both of those issues.
2016-06-30 22:01:59 -07:00
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