Commit Graph

776 Commits

Author SHA1 Message Date
Fabian Homborg
2768d2ea06 Style fixes for fish_vi_cursor
"$fcn"

[ci skip]
2016-05-30 16:40:49 +02:00
Fabian Homborg
bfb5fec330 Remove stray "0" output from man completions 2016-05-29 14:34:20 +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
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
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
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
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
149e601743 Remove the errant newline in __fish_cancel_commandline again 2016-05-13 12:10:17 -07: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
Elis Axelsson
1c6f6df2b3 Change abbr to allow non-letter keys (#2996) 2016-05-06 16:15:47 +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
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
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
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
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
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
Kurtis Rader
5f849d0264 provide a better experience when user presses \cC
Fixes #2904
2016-04-14 20:57:04 -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
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
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