Commit graph

1019 commits

Author SHA1 Message Date
Konrad Borowski
1665f84d60 Fix Perl module completions.
This fixes the issue with nonexistant directories (some Linux
distributions put these for local modules), and also fixes the
issue of dot meaning any character instead of simply dot.
2014-10-04 11:22:56 +02:00
Roman Inflianskas
fabee7e246 add yast2 completion 2014-10-04 00:41:10 +04:00
Jon Gjengset
0ffa434926 Prevent STDERR leak from abook detection in mutt completion
Fixes #1737
2014-10-03 14:39:42 -04:00
Kevin Ballard
a7727765dc Clean up prompt_pwd with the new function -V flag
Also fixes `cd /private` displaying as no path on OS X.
2014-10-02 18:41:39 -07:00
Kevin Ballard
33a76e1f8e Update psub for the new --inherit-variable flag
Also do some minor formatting cleanup, make psub return 1 when executed
outside of a command substitution, and make it respect $TMPDIR.
2014-10-02 18:41:39 -07:00
Kevin Ballard
3f11d90744 # This is a combination of 2 commits.
# The first commit's message is:

Simplify default fish_prompt

No need for the set_color caching now that it's a builtin.

Also simplify the 3 classic prompts in fish_config's sample_prompts set.
2014-10-02 18:41:01 -07:00
Kevin Ballard
4ba95ad1c3 Minor tweaks to initial keybinding load
Remove comment that AFAICT is not true anymore.

Ensure someone setting __fish_active_key_bindings as a universal
variable doesn't screw up the initial keybinding load.
2014-10-02 12:14:22 -07:00
David Adam
5157ac30fa Create and use $DATADIR/vendor_completions.d/ for upstream completions
Closes #1485.
2014-10-01 21:28:01 +08:00
David Adam
a186f04f15 Manpage completions: store in $XDG_DATA_HOME
Closes #1343, works towards #1257.
2014-09-29 19:39:36 +08:00
Vincent Huang
15ca3b426f Added some completions for opam
All opam subcommands and descriptions are covered, along with
all the flags that are common to all commands. However, only
`opam config` has complete subsubcommand coverage.
2014-09-29 14:34:07 +08:00
David Adam
1c9aec4899 bind: add completions for -m and -M
See https://github.com/fish-shell/fish-shell/issues/1663
2014-09-29 14:22:37 +08:00
David Adam
f0d8d90ed1 __fish_print_hostnames: use awk to process ssh_config files
Uses awk rather than sed to account for multiple formatting options.

Closes #1260.
2014-09-29 14:08:09 +08:00
David Adam
6ece8523b1 __fish_complete_path: add new completion, mimics builtin path completion
Completions can now be written which disable file completion and then
selectively re-enable it using this function.

Closes #834.
2014-09-29 14:05:18 +08:00
Konrad Borowski
26051ea198 Add Meta+H as keybinding for man page.
Apparently, in zsh, Meta+H can be used to display the manpage for
the current command. This commit adds this zsh feature to fish shell.

The F1 keybinding is left, although it's now secondary according to
fish help, as some terminal emulators don't let the user press F1 key.
2014-09-28 11:12:25 +02:00
David Adam
3ac28f2b01 Revert "math.fish: support floating-point maths"
This reverts commit 7cad0069e8.

https://github.com/fish-shell/fish-shell/issues/1723
http://superuser.com/questions/31445/gnu-bc-modulo-with-scale-other-than-0

This is why we can't have nice things.
2014-09-27 23:27:05 +08:00
David Adam
7cad0069e8 math.fish: support floating-point maths
Closes #1643.

Thanks to Mickaël RAYBAUD-ROIG (https://github.com/m-r-r) for the idea
of printf.
2014-09-27 18:38:44 +08:00
lledey
73158d6255 Fix emacs completion on OS X
Avoid calling seq with 0 as argument since its behaviour is wrong on OS X.
2014-09-24 13:05:22 +01:00
Konrad Borowski
8d03baa4e0 Make fish config work if one of colors is undefined.
This moves the sorting to be done before sorting remaining colors.
2014-09-23 13:48:00 +02:00
Kevin Ballard
e1f623f548 Only print fish_greeting for interactive shells
Shell scripts that use `read` should not trigger fish_greeting.

Fixes #1401.
2014-09-21 20:35:33 -07:00
Kevin Ballard
a9c8b75599 Tweak git completion for aliases/stashes
Use the new `read -z` flag to complete git aliases better. This approach
won't break if an alias contains a newline.

Also fix stash completion, which was broken on BSD sed.
2014-09-21 19:54:42 -07:00
Konrad Borowski
166a2f91bd Use double dashes for contains in fossil completions.
This fixes the issue with strange behaviour of fish shell when first
option of a command is an option.
2014-09-21 14:32:37 +02:00
Kevin Ballard
a381ac2691 Complete custom git commands in $PATH
Git treats executables in $PATH that start with "git-" as custom
subcommands. Add completion support for them.

Fixes #1680.
2014-09-19 19:19:59 -07:00
Kevin Ballard
e2be71cbe4 Better git alias completion
Config entries that contained the word "alias" but were not in fact
aliases no longer are treated as aliases.
2014-09-19 19:19:59 -07:00
ridiculousfish
6083c6fc72 Incorporate attribute links for color themes in web_config 2014-09-19 18:44:50 -07:00
Kevin Ballard
0a32d96b27 Reset fish_bind_mode when changing fish_key_bindings
Also avoid resetting bindings if fish_key_bindings is "modified" without
actually changing.

Fixes #1638.
2014-09-18 15:46:17 -07:00
David Adam
eb40baacfc update completions for builtin commands 2014-09-17 10:17:48 +08:00
Michael Stillwell
133ba6e01b Ignore "host", "hostname", and hostname wildcards
See the PATTERNS section of ssh_config(5) for wildcards supported by ssh.
2014-09-16 17:20:59 +02:00
qjcg
9bfb4f1e11 Fix webconfig URL generation for python3
Closes #1677.

Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
2014-09-15 16:40:28 +08:00
Kevin Ballard
f22864b813 Ensure type still works if $IFS is unset 2014-09-08 23:35:29 -07:00
Kevin Ballard
15cf06438e Suppress PATH errors in sudo tab-completion
Setting a non-existant path component to PATH logs an error to stderr.
This is not appropriate for non-interactive temporary modifications,
like the one done by the `sudo` completion helper function.
2014-09-04 13:22:06 -07:00
Konrad Borowski
1d0279eac5 Fix F1 binding to work with multiple tokens. 2014-08-30 11:18:56 +02:00
Nikolai Aleksandrovich Pavlov
cb29350954 Fix fish_vi_mode.fish 2014-08-29 13:15:13 -07:00
Konrad Borowski
71ab40e536 Add Fossil command completions. 2014-08-29 14:19:55 +02:00
ridiculousfish
f9f773cc28 Comment on why we run 'false' in web_config.py 2014-08-22 12:04:23 -07:00
Kevin Ballard
d9bf53c6e5 Show a non-zero status in the fish_config prompt
When selecting a prompt with fish_config, render the prompt with a
non-zero status so the user knows what it looks like.
2014-08-22 12:00:16 -07:00
Kevin Ballard
f549ada16c Set up fish_{function,complete}_path properly
In the base config.fish, fish_function_path and fish_complete_path have
$__fish_datadir/{functions,completions} added to them if not already
present. For some reason they were replacing the final path component
instead of being added on to the end.
2014-08-22 11:54:58 -07:00
Kevin Ballard
61ce9db4ba Make the alias built-in function work better
The new --wraps functionality was breaking aliases of the form
`alias foo='bar baz'`. That is, aliases where the body is multiple
words. Extract the first word of the body and use that instead.

Use better errors for aliases with no name or no body.
2014-08-22 11:40:59 -07:00
ridiculousfish
2da435712a Merge branch 'master' of github.com:fish-shell/fish-shell 2014-08-22 11:39:41 -07:00
Andy Lutomirski
9079ec459c webconfig: fixes for token security
* Use 16-byte tokens
 * Use os.urandom (random.getrandbits shouldn't be used for security)
 * Convert to hex correctly
2014-08-22 15:44:43 +08:00
Andy Lutomirski
aaddccfdb1 webconfig: Use a constant-time token comparison
This prevents a linear-time attack to recover the auth token.
2014-08-22 15:39:13 +08:00
ridiculousfish
033373f078 Merge branch 'make_type_better' of github.com:kballard/fish-shell into kballard-make_type_better 2014-08-21 21:36:39 -07:00
ridiculousfish
06400b83b1 Support for command wrapping ("aliases")
Add the --wraps option to 'complete' and 'function'. This allows a
command to (recursively) inherit the completions of a wrapped command.
Fixes #393.

When evaluating a completion, we inspect the entire "wrap chain" for a
command, i.e. we follow the sequence of wrapping until we either hit a
loop (which we silently ignore) or the end of the chain. We then
evaluate completions as if the wrapping command were substituted with
the wrapped command. Currently this only works for commands, i.e.
'complete --command gco --wraps git\ checkout' won't work (that would
seem to encroaching on abbreviations anyways). It might be useful to
show an error message for that case.

The commandline builtin reflects the commandline with the wrapped
command substituted in, so e.g. git completions (which inspect the
command line) will just work. This sort of command line munging is
also performed by 'complete -C' so it's not totally without precedent.

'alias will also now mark its generated function as wrapping the
'target.
2014-08-15 18:14:36 -07:00
ridiculousfish
fe68d30be9 Use sgrep instead of grep in ssh completion 2014-08-13 01:06:15 -07:00
ridiculousfish
a3a11c2e0c Strip users with leading underscores from ssh completions 2014-08-12 14:46:59 -07:00
ridiculousfish
3f526698ab Make __fish_print_users work on OS X via dscl 2014-08-12 14:42:49 -07:00
David Adam
4ae2753025 Authenticate connections to web_config service
- Require all requests to use a session path.
 - Use a redirect file to avoid exposing the '/start' URL on the
   command line, as it contains the cookie value.

Fix for CVE-2014-2914.
Closes #1438.
2014-08-04 13:34:26 +08:00
Kevin Stone
556680cf5e Update grunt.fish
Fixed command error when no local Gruntfile results in a command error.

Fixes #1592.
2014-08-02 00:04:26 -07:00
Konrad Borowski
6c80a3461c
Add support for toor account.
Currently fish doesn't recognize toor as special. However, it's likely
that on BSD systems, fish shell will be used on toor, not on root (toor
is an intentionally existing account to use more advanced shell on, like
shell).
2014-07-30 11:55:47 +02:00
phette23
5591afff6e add completions for Node.js & NPM 2014-07-29 18:35:08 -07:00
ridiculousfish
b6658c5497 Render sample prompts faster in fish_config by using a thread pool 2014-07-29 12:12:32 -07:00
ridiculousfish
aad5163b49 Make prompt selection more like color selection in fish_config. Remove
the "show prompt source" button.
2014-07-29 11:00:39 -07:00
David Xia
6d18bf5cd4 Fix umask function regex
Some grep implementations complain of empty subexpression

fixes #1313
2014-07-29 01:43:18 -04:00
David Xia
adabc2d7a0 Fix fish_config error with python3
Closes #1253.
2014-07-28 22:02:55 +08:00
Siteshwar Vashisht
317660c2fe Avoid using OptionParser to parse bindings in webconfig.py
OptionParser eats commaandline arguments passed to bind actions, so avoid using it.
2014-07-25 08:39:31 +05:30
ridiculousfish
f6a89d13c2 Merge branch 'master' of github.com:fish-shell/fish-shell 2014-07-23 22:27:37 -07:00
Siteshwar Vashisht
3e01dd955f Updated code to parse bindings in webconfig.py 2014-07-23 01:53:15 +05:30
adisbladis
27fa0ea9d7 "webconfig.py: Don't allow NoneType as buffer, fallback to bytes.
Fixes TypeErrors when using bindings tab"
2014-07-22 12:31:57 +02:00
Michishige Kaito
2de914d8c3 Select the 4th line of output, instead of the second to last line 2014-07-16 18:22:27 +01:00
Michishige Kaito
616fa85458 Add grunt completion 2014-07-16 16:53:18 +01:00
Kevin Ballard
16e50c258a type: Restore combined flags behavior
Fix the parsing of `type` flags to handle combined short flags as
appropriate, e.g. `type -qf ls`.
2014-07-14 11:27:11 -07:00
Kevin Ballard
72e8489d50 command: Rename -p/--path flag to -s/--search 2014-07-13 19:11:29 -07:00
Kevin Ballard
29b3b6b31e type: Stop claiming grep is a function
Use `functions -q` instead of searching the `functiosn -na` list for the
provided word. This may result in an automatically-loaded function being
sourced, but that happens anyway with the default output.

This change means the results of `test -q foo` can be relied upon to
indicate whether `foo` can actually be invoked. Previosly, if `foo` was
the name of an automatically-loaded function file but did not actually
define a function `foo`, and there was no execuable `foo`, then `type -q
foo` would lie and say `foo` can be invoked when it can't.
2014-07-13 19:11:29 -07:00
Kevin Ballard
533496e43a Adopt the new type -q flag in the other functions 2014-07-13 19:11:29 -07:00
Kevin Ballard
6f7a7459c1 test: Add a new --quiet flag to suppress output
The --quiet flag is useful when only the exit status matters.

Fix the documentation for the -t flag to no longer claim that `type` can
print "keyword", as it never does that.

Stop printing a blank line for functions/builtins when the -p flag has
been passed. It's just not useful.
2014-07-13 19:11:29 -07:00
Kevin Ballard
6b062b07b4 type: Separate the notion of multi and paths
Track whether -a and -f have been supplied separately. That way both
`type -a -f command` and `type -f -a command` behaves correctly, as does
`type -a -f foo` where there are multiple executables named `foo` in the
$PATH.
2014-07-13 19:11:29 -07:00
Kevin Ballard
bfd3a47380 Fix type function to work better
Stop using getopt to parse flags. It's far more expensive than
necessary, and results in long flags not being parsed on OS X. This also
allows args starting with - after the options list to be properly
interpreted as a value to test.

Print the error message to stderr as is appropriate.

Use the new `command -p` functionality when the -a flag has not been
provided (`command` does not have any equivalent to the -a flag),
instead of using `which`. This is faster and also avoids any possible
disagreement between `which` and what fish thinks is valid.

Stop testing every path to see if it's executable, that test has already
been done by `which` or `command -p`.

The end result is `type -P ls` is roughly 250% faster, according to
profiling, on my OS X machine.
2014-07-13 19:11:29 -07:00
Maxim Gonchar
3acd0dfe48 Add dropbox completion 2014-07-06 20:40:53 +08:00
Sascha
ed5e585684 Also add forward/backward movement in insert mode 2014-06-27 22:55:27 +08:00
Sascha
32948b8dc6 Provide more useful insert mode mappings 2014-06-27 22:55:20 +08:00
Cameron Norman
ad5ad3d1ad Fix bug for systemd being installed but not PID 1 2014-06-20 11:08:35 +08:00
Siteshwar Vashisht
7b3132d39d Fixed code to parse bindings for webconfig 2014-06-08 16:05:00 +05:30
Konrad Borowski
d97e31b4ab git prompt shouldn't export variables. 2014-06-01 09:39:28 +02:00
David Adam
3225d7e169 avoid symlink attacks in __fish_print_packages and spawning fishd
* use $XDG_CACHE_HOME for __fish_print_packages completion caches
 * when starting fishd, redirect fishd output to /dev/null, not a
   predictable path

Fix for CVE-2014-3219.

Closes #1440.
2014-05-12 09:30:05 +08:00
Josh Kuhn
cbef88a593 Fix python completion to work for pypy
Pypy outputs 2 lines with the -V option, as well as adding a whole lot of stuff that confuses the very general sed regex that was used before.
2014-05-03 15:06:57 -07:00
SanskritFritz
b13179d4f4 Functions instead of static variables for conditions. 2014-05-03 12:30:41 -07:00
SanskritFritz
cf89d9bfb0 Fixed an unintended result of some copy paste. 2014-05-03 12:30:41 -07:00
SanskritFritz
f49848c8a4 Removed unnecessary comments. 2014-05-03 12:30:41 -07:00
SanskritFritz
0101b39f6c Completions added/updated. 2014-05-03 12:30:41 -07:00
Maurizio De Santis
4285baa6e1 Prompt sample: Debian chroot environment
When you chroot in Debian, bash shows the chroot environment in the prompt:

```bash

...

if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

...
```

This is the effect:

```
(chroot_env) user@host:~#
```

It is useful when chrooting, since usually the hostname remains the same and thus you can't distinguish where you are.
2014-05-03 12:28:38 -07:00
David Adam
55bc4168bf use mktemp(1) to generate temporary file names
Fix for CVE-2014-2906.

Closes a race condition in funced which would allow execution of
arbitrary code; closes a race condition in psub which would allow
alternation of the data stream.

Note that `psub -f` does not work (#1040); a fix should be committed
separately for ease of maintenance.

Closes #1437
2014-04-28 10:42:00 +08:00
David Flores
2bbb59964f functions on top 2014-04-19 14:50:15 -07:00
David Flores
4fd32eb48e added docker completion file 2014-04-19 14:50:15 -07:00
Maxim Gonchar
2872a98b2b Set fish_vi_key_bindings to start in insert mode by default
Add optional argument for fish_vi_key_bindings to set desired initial
mode:
> fish_vi_key_bindings default
2014-04-19 14:48:15 -07:00
Fabian Ruff
f2a507c4a7 fix gem --version/--help tab completions 2014-04-06 12:58:22 -07:00
Steven Allen
17ab7bde44 Bind 0 to beginning-of-line in vi mode. 2014-04-06 12:49:52 -07:00
Steven Allen
fcc363333c Move cursor back on insert mode exit.
Make this consistent with vi.
2014-04-06 12:46:14 -07:00
Daniel Matz
2f6551b3b1 Properly detect when MQ is enabled for Mercurial completion. 2014-03-31 10:08:10 -07:00
Daniel Matz
50ae14cf7b Properly complete Mercurial bookmarks when only one bookmark exists.
The if statement checking the output of hg bookmarks uses two conditions
joined by the or keyword.  However, only the first part was being used.
Wrapping the two statements with begin and end properly combines them.
2014-03-31 10:08:10 -07:00
Daniel Matz
79b7cd69bb Add fallback for label completion in older versions of Mercurial. 2014-03-31 10:08:10 -07:00
Daniel Matz
cf237a0e4f Replace use of xargs with command substitution in Mercurial completion. 2014-03-31 10:08:10 -07:00
Daniel Matz
c0d147c5c4 Add the __fish prefix to all Mercurial completion functions. 2014-03-31 10:08:10 -07:00
Daniel Matz
bd707b4a96 Remove unnecessary use of uniq in Mercurial completion.
Fish already takes care of duplicate completions.
2014-03-31 10:08:10 -07:00
Daniel Matz
daaed863da Use the current commandline token for Mercurial filename completion.
The token variable was being used, but I must have accidentally deleted its
definition while I was working on the original version of the file.
2014-03-31 10:08:10 -07:00
Daniel Matz
2bdfac2036 Use local scope for variables in Mercurial completion functions. 2014-03-31 10:08:10 -07:00
Daniel Matz
d74a23e583 Improve Mercurial command completion.
Rewrote the completion file by hand.  Added completion of files, bookmarks,
revision labels, etc.
2014-03-31 10:08:09 -07:00
Anders Bergh
44b35f7735 fish_config: Listen on both IPv6 and IPv4.
A subclass of TCPServer was created to deny any non-local connections and to
listen using an IPv6 socket.
2014-03-31 10:06:46 -07:00
Kevin Ballard
fe3b439e31 Fix non-verbose, non-informative __fish_git_prompt
At some point the non-verbose, non-informative variant of the prompt
(e.g. the variant that looks like the bash prompt) was modified to try
and show the behind/ahead counts the same way the informative prompt
does. Besides being wrong, it also didn't work because behind/ahead
weren't defined.
2014-03-31 09:59:41 -07:00
Lukas Stabe
6c987d6708 add pacsrv completion 2014-03-31 09:54:28 -07:00
ridiculousfish
28fd1a4c5d Merge branch 'master' of github.com:fish-shell/fish-shell 2014-03-30 21:58:32 -07:00
ridiculousfish
d4fafeb6d6 Merge branch 'master' into 1218_rebase
Conflicts:
	builtin.cpp
	builtin_commandline.cpp
	highlight.cpp
	input.cpp
	input.h
	reader.cpp
	screen.cpp
	screen.h
2014-03-29 14:19:45 -07:00