Commit graph

852 commits

Author SHA1 Message Date
Fabian Homborg
e89057b70c Make hybrid bindings easier to achieve
The vi-bindings function would unconditionally erase all bindings,
making it impossible to call it last. This would disable the
mode-indicator (and in future also the cursor).

Make it so any argument to fish_vi_key_bindings stops it from erasing
bindings.

It would also be possible to demand an argument to erase (or to erase as
a separate step). but the usual case seems to be _switching_ to a set of bindings.
2016-09-03 23:11:36 +02:00
Fabian Homborg
1bc887cd9f Vi-mode: Also share end/home bindings
Fixes #3298.
2016-09-03 23:11:36 +02:00
Aaron Gyes
8ca3adaa91 Fix ^C at commandline indicator for FreeBSD
This didn't work on platforms where tput exists but can never accept
terminfo names. This includes the current versions of FreeBSD - it
used to do both, now it doesn't. So, fall back to the old termcap names
by (tput smso; or tput so). Add check for the tput program before we
even try.
2016-09-01 07:30:50 -07:00
Fabian Homborg
443fc66048 alias: Use source directly
The extra things `eval` does are all for code that runs
interactively. Because we just define a function, we don't need it.

This improves alias' performance by about 20-25% (0.783608s to 0.585585s
on about 500 aliases) and avoids triggering #3345.
2016-09-01 12:27:10 +02:00
Fabian Homborg
3702616b60 pushd: Remove unnecessary forks
Convert sed to string and remove unnecessary math calls.
2016-08-29 00:01:13 +02:00
Kurtis Rader
cfefaaf4ee revert the --shadow-builtin flag
Implementing the --shadow-builtin flag has proven to be highly controversial.
Revert the introduction of that flag to the `function` command. If someone
shoots themselves in the foot by redefining a builtin as a function that's
their problem and not our responsibility to protect them from doing so.

Fixes #3319
2016-08-24 22:56:19 -07:00
Fabian Homborg
4e2d2c125c Silence math errors in git prompt
It's not ideal since we can't get the real result so we just assume it's
"0". That triggers the easier path, which still might display the wrong
thing, but we have to pick something.

Possible fix for #3321.
2016-08-22 17:06:29 +02:00
Fabian Homborg
790968120d Give up earlier when we can't find default key bindings.
This relates to #3302.
2016-08-15 22:39:51 +02:00
Kurtis Rader
710addde16 fix history --delete regression
The recent change to reconcile the history builtin command and function
broke an undocumented behavior of `history --delete`. This change
reinstates that behavior. It also adds an explicit `--exact` search mode
for the `--search` and `--delete` subcommands.

Fixes #3270
2016-08-10 21:51:01 -07:00
Boris Aranovich
dc02587ac4 __fish_git_prompt: untracked files using git ls-files | wc -l | string trim 2016-08-10 14:51:18 -07:00
Boris Aranovich
077a0e1b47 Counting the number of unstaged files using wc -l pipe 2016-08-10 14:51:18 -07:00
Kurtis Rader
e46978fedb simplify previous change to the _ script
There's no need for a local var or echo in a subcommand. Also, fix the
formatting to match the style guide.
2016-08-07 19:29:14 -07:00
Aaron Gyes
7e0e745958 The last commit introduced a Travis failure.
Only on the OS X travis build.

I can't reproduce it but I figure it's something to do
with test -e vs test -x or the echo -n in command substitution.
Oops.
2016-08-07 15:48:41 -07:00
Aaron Gyes
43515e1298 Use command -v instead of which in _.fish
I didn't know that there was any which usage outside of type -a
in our functions, until I grepped and noticed this.
2016-08-07 15:23:51 -07:00
Fabian Homborg
744da2cab2 Add backspace bindings to vi-mode
This was erroneously omitted from the previous commit.

Now backspace in insert mode does backward-delete-char, in default mode
backward-char (i.e. no deleting, just moving). This is consistent with vim.
2016-08-04 20:45:21 +02:00
Fabian Homborg
93b9e7443e Share some bindings between vi- and emacs-mode
This undoes the inheritance since it shared too much.

The idea here is to share bindings that aren't something the editors we're inspired by do - there's no "execute" in vi.
The basic editing and moving bindings are now vi-style in vi-mode and emacs-style in default mode.
2016-08-04 14:03:13 +02:00
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
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
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
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
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
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
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
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