Commit Graph

6174 Commits

Author SHA1 Message Date
Kurtis Rader
e9b5505169 add a flag to limit history search results
This adds a flag to the `history search` command to limit the number of
matching entries to the first "n". The default is unlimited. This is
mostly useful in conjunction with aliases (i.e., functions) that are
intended to report the "n" most recent matching history entries without
piping the result through the user's pager.

Fixes #3244
2016-09-23 19:43:58 -07:00
Aaron Gyes
c2a8de4873 Make fish find config directories in source tree
If one does a make fish; ./fish - don't use the make-installed paths.

Also, remove huge chunk of nearly duplicated code #ifdef'd __APPLE__
for relocatable dirs in fish.app: the directories under Resources
in the bundle followed by the changes I made around here a few months
ago now are not different enough that they require a special case.
This works fine for fish.app.
2016-09-23 11:52:51 -07:00
Aaron Gyes
503edf2d49 Report exec_path and the final config paths via debug()
I was surprised fish_indent was running from /usr/local/bin
instead of the git checkout when I ran ./fish
after building fish there. This was more easily noticable after my last
commit. I added some debug lines which probably fish could have been
doing already when looking into that.

This is a pretty major thing during fish initialization, commit it for
everyone.
2016-09-23 08:55:26 -07:00
Aaron Gyes
4c34ba9959 Make fish_indent less spooky
Don't wrap fish_indent at all if the version in $PATH matches
$FISH_VERSION.

When we do wrap it, resolve the path once, and use that via alias
machinery instead of doing an eval each time.

In both cases, `type fish_indent` can tell us what it's actually going
to do now.

clarity aside, it's faster if we only eval the one time.
eval is not only evil, but slow.

> for h in $history[1..100]; echo $h | fish_indent --no-indent; end

before: CMD_DURATION = 1005
if fish_indent is kosher in PATH: 549
if not, using alias: 687
2016-09-23 07:59:45 -07:00
Kurtis Rader
204e79105a allow customizing history --show-time format
It would make fish more friendly if we allowed the user to specify the
format of the history entry timestamps.

Fixes #3361
2016-09-20 20:14:02 -07:00
Aaron Gyes
98470ab608 Something got caught in my sed net: $(b) -> $(bo)
Oops. Fixes #3394
2016-09-20 12:04:46 -07:00
Kurtis Rader
93bea5b321 make unit tests more hermetic regarding env vars
Specifically, the `TERM` and `ITERM_PROFILE` env vars. If we don't set
them to known values the unit tests can fail in unexpected ways.

Fixes #3395
2016-09-19 22:13:55 -07:00
Aaron Gyes
2c8bc05826 Skip OSC 7 inside emacs, let VTE/Terminal do title
these modern terminals both compose a nicer title if we don't try to provide a custom one (no path in title twice, "fish" in title twice) - and the user can configure which components they'd like in their terminal inside the terminal preferences.

Also make test "$VTE_VERSION" -ge .. work once I commit `test` strtoi
fix - the trick is to add a zero before it so the numeric comparison
works even if it's empty.

Fixes #107
2016-09-19 18:44:44 -07:00
Aaron Gyes
8b1625be2b Fix "libraryn" typo 2016-09-19 17:18:43 -07:00
Andrew Schulman
d71b97c2cf update and correct cygport completions (#3392) 2016-09-19 23:25:55 +02:00
Kurtis Rader
76c73aa8ce alter history sub-command handling
This deprecates the use of long options for history sub-commands (e.g.,
`history --delete`) in favor of proper sub-commands (e.g., `history
delete`). It also eliminates the short options for those sub-commands.

Also change option processing to allow options anywhere on the command
line to match how the vast majority of fish builtins handle flags.

Replace --with-time with --show-time.

Fixes #3367
2016-09-18 20:09:06 -07:00
Aaron Gyes
02ba7933e0 Fix syntax errors breaking make doc 2016-09-18 04:24:43 -07:00
Aaron Gyes
be0bd999ad Commit __fish_config_interactive where I have it
Nuke the cool surprise deletion feature
2016-09-18 04:18:33 -07:00
David Adam
92e3a3c8ef Merge branch 'master' of https://github.com/fish-shell/fish-shell 2016-09-18 18:12:34 +08:00
Aaron Gyes
96ebfaaf87 Use 'grealpath' if installed for realpath fallback (#3374)
* Use 'grealpath' if installed for realpath fallback

See discussion in #3370

* fish_realpath: filter out dangerous options

Per feedback do not use aliases to declare wrapped functions.
2016-09-18 02:08:19 -07:00
Aaron Gyes
30b71fbb78 $(v)echo foo -> $v echo foo for verbosity modifier
Not sure why I crammed $(v) up like that with the parens. This is
a little sed job after regretting the Makefile seeming harder to read.
Certainly better.

We want clang or gcc picked for both C++/C

Few final cleanups - time to feed it to Travis.
2016-09-17 16:29:43 -07:00
Clément Martinez
fc3cd77c2f Add pygmentize completions 2016-09-16 19:23:22 +02:00
Clément Martinez
22c20f36cb Add ranger completions 2016-09-16 19:23:22 +02:00
Clément Martinez
46ab1a155c Add mdbook completions 2016-09-16 19:23:22 +02:00
Clément Martinez
29b9e6705a Add figlet completions 2016-09-16 19:23:13 +02:00
Clément Martinez
ed7bf83b56 Fix xz file completion
The previous completion gave every files.
Here, we only show files with the .xz, .txz, .lzma or .tlz extension.
2016-09-16 19:22:59 +02:00
Andrew Schulman
0a6dc2addb use PATH to find getent in __fish_complete_groups (#3383) 2016-09-16 18:26:27 +02:00
Andrew Schulman
05b52eaa0b use __fish_complete_groups to complete group names for chown (#3380)
chown completion chown currently uses cat /etc/group to fetch the list of group names. In Cygwin there's no /etc/group file any more (user and group names are fetched directly from the OS), so when a user tries to tab-complete the group name they get an error message:

ASchulma@LZ77E1AASCHULMA ~/d/fish> chown ASchulma🐱 /etc/group: No such file or directory

This change fixes that by using getent group (via __fish_complete_groups) by preference to get the group names, and falling back to /etc/group. This is more portable.
2016-09-16 16:35:55 +02:00
Aaron Gyes
e14ae90cc8 mass-rename T_BLAH to cause less visual raucus
"em" is italics
"bo" is bold
sgr0 is sgr0
red  is red

.. and so on in an arbitrary manner.
2016-09-16 00:14:50 -07:00
Aaron Gyes
06c658dd5e Autotools build: teach it clang, utility macros
Teach autotools about clang++.
 - Use AC macros for these utilities in Makefile:
    LN_S, MKDIR_P, AWK, GREP, FGREP.
   This has the effect on OS X with prefixed coreutils installed
   from macports: > make show-LN_S show-MKDIR_P show-AWK show-GREP
    LN_S = 'ln -s'
    MKDIR_P = '/opt/local/bin/gmkdir -p'
    AWK = 'awk'
    GREP = '/opt/local/bin/grep'
    FGREP = '/opt/local/bin/grep -F'
 - Use GNU Make findstrings, wildcard,notdir,
 - SHELL = @SHELL@ per reccomended practice and in line with
    actual behavior.
 - Add output for string wrangling steps
2016-09-15 23:24:41 -07:00
EMayej Bee
85cd372a4e Fix index out of bounds
When current dir is the first one in history. There is no previous dirs.
2016-09-13 20:59:18 -07:00
Kurtis Rader
f9115b5ef1 fix use of subcommand in __fish_config_interactive.fish 2016-09-12 18:47:59 -07:00
Fabian Homborg
9d69f44550 Add completions for cd -
Fixes #3353.
2016-09-12 23:13:32 +02:00
Fabian Homborg
c57b30cba1 Check /etc/os-release for Suse's CNF-handler
This has the same name and path as ubuntu's, but takes less arguments.

So we need to actually find if the distro thinks it is suse, and then
use it.

Fixes #3366.
2016-09-12 22:59:35 +02:00
Fabian Homborg
bb754c2085 ls.fish: Replace eval with string 2016-09-12 20:20:40 +02:00
Aaron Gyes
f7c6426b21 Merge floam/colorfix #3260 2016-09-11 03:14:08 -07:00
Aaron Gyes
90e535f66f Update pager colors, tweak pager.cpp
Adds a color reset thing, to ensure fish tries to use hard colors during
testing.

Also, work on a discrepancy (not introduced by my changes, afaik) when
with some combinations of color settings, and usage of --bold, caused super
flakey color paninting in the pager. Downwards movements that trigger
scrolling vs. upwards movement in the pager would only apply bold to
selections when moving upwards. The bold state of the command completions in
the pager was flipping flops on and off, depending on if there is a description
on the preceding line.

Implement a lame fix by reseting the color to normal and applying a
different style on the rightmost ')' which seems to be what was influencing it.

Makes fish use terminfo for coloring the newline glich char.
2016-09-11 03:04:53 -07:00
Aaron Gyes
af95813514 Merge branch 'master' of https://github.com/fish-shell/fish-shell into colorfix 2016-09-10 15:09:12 -07:00
Aaron Gyes
82b298dcc5 __fish_config_interactive: remove Linux exception
And update colors.
2016-09-10 15:07:58 -07:00
Aaron Gyes
ae32d0288b Remove fish_wcstoi decl - fix style 2016-09-10 14:56:43 -07:00
Aaron Gyes
b17ebb4551 Merge branch 'master' of https://github.com/fish-shell/fish-shell 2016-09-10 14:52:15 -07:00
Aaron Gyes
6faa2f9866 Tighten up empty string checks.
Fixes various spots throughout fish where broken strtoi checks
were converting empty strings to zero. Zero is not a valid pid and
this was causing breakage as well when input.

Nix fish_wcstoi - wcstoimax does the same thing.
Improve comments and some general cleanup.
2016-09-10 14:46:06 -07:00
David Adam
0335921c3c Revert "Sync up autoconf with rest of project"
This reverts commit 2822dfc92d.

The commit broke the build on Ubuntu Precise:
 https://launchpad.net/~fish-shell/+archive/ubuntu/nightly-master/+build/10731279/+files/buildlog_ubuntu-precise-amd64.fish_2.3.1-523-g87a532f-1~precise_BUILDING.txt.gz
and increased the configure time by about 80%. None of the new symbols
are used yet.

Discussed with @floam (original committer) on Gitter.
2016-09-10 13:09:47 +08:00
Kurtis Rader
af0a2add10 fix check for unsupported op on BSD
Fixes #3362
2016-09-09 19:36:26 -07:00
Kurtis Rader
87a532f533 make it hard to use history command incorrectly
Fixes #3307
2016-09-09 19:23:06 -07:00
ridiculousfish
fa837a2e4a Prevent crash when reaping jobs in exit handlers
If an interactive job is started, and it is reaped within fish's
exit handler, we may attempt to print its status message after
cur_term has been set to NULL. This results in a crash.

This change makes fish only print the status message if cur_term is
not NULL.

Fixes #3222
2016-09-09 13:13:45 -07:00
Aaron Gyes
f0125734d0 Improve make install and make uninstall experience
Show the gist of what is going on during uninstall.

I had overlooked the uninstall target, with it mislabled as having
to do translations. Give make uninstall the full treatment here.

In addition to showing what is going on, give the user a 5^H7 second
warning before we blast away /usr/local/share/fish/ - it's not
unthinkable they might have a script or two in there.
2016-09-09 01:24:24 -07:00
Aaron Gyes
c0c8fffd50 Update install-sh
Copied in manually - this won't be done automatically by autotools.
(we only use autoconf)

From automake NEWS:

New in 1.15:

* Improvements and refactorings in the install-sh script:

  - It has been modernized, and now makes the following assumptions
    *unconditionally*:
    (1) a working 'dirname' program is available;
    (2) the ${var:-value} shell parameters substitution works;
    (3) the "set -f" and "set +f" shell commands work, and, respectively,
        disable and enable shell globbing.

  - The script implements stricter error checking, and now it complains
    and bails out if any of the following expectations is not met:
    (1) the options -d and -t are never used together;
    (2) the argument passed to option -t is a directory;
    (3) if there are two or more SOURCEFILE arguments, the
        DESTINATION argument must be a directory.
2016-09-09 01:24:24 -07:00
Aaron Gyes
2822dfc92d Sync up autoconf with rest of project
This has gotten very out of sync with the project - autoupdate it and
integrate what autoscan found.

I checked with @zanchey - it looks like even our oldest RHEL 5 machines
have a new enough M4 to be able to handle what will be produced by
autoconf 2.68; also use a closer-to-modern version of that (2.69 was
released 2012!)

Neither m4 nor autoconf are required to build a fish release.
2016-09-09 01:24:24 -07:00
Aaron Gyes
87fd9bca02 Group history items together with timestamps on separate line (#3333 from floam/historyout) 2016-09-07 07:57:06 -07:00
Aaron Gyes
3d6cb59b31 Use %Y-%m-%d %H:%M:%S format, update tests
Update history docs.

Note - the omission of a mention of timezone was intentional. These were recorded as naive timestamps lacking timezone information in the first place.
2016-09-07 07:52:45 -07:00
Aaron Gyes
6936e64b34 Show history timestamps on seperate lines #-prefixed.
Improves the grouping of multiline history entries
by sepearating the timestamps and history entires onto seperate lines.

Use wcsftime() Saves us a conversion, might as well.
2016-09-07 07:51:32 -07:00
Fabian Homborg
f78f51e2a7 dirh: Don't rely on negative increments in seq
Not available in BSD seq.

Fixes #3354.
2016-09-06 18:15:00 +02:00
Aaron Gyes
578e4e8207 Don't use colors over 8 during builds
T_DIM to only highlight the "important" CXX lines seems distracting.
Use it only for the pages of output from re-running configure
2016-09-06 04:59:37 -07:00
Aaron Gyes
f7daa5884a Update issue template
- Comment out asciinema - people too often leave a link there.
- "Launch fish" is probably a stupid thing to have a first step. 
- Combine the expected/actual result sections, maybe that was too tedious.
2016-09-06 03:58:06 -07:00