Commit graph

904 commits

Author SHA1 Message Date
Fabian Homborg
c1ea9c7025 Document local-exported variable change
This is a bit minimal, but I'm not sure how often it should be mentioned.
2017-07-20 18:25:18 -07:00
Kurtis Rader
9ef47a43a4 change how argparse handles boolean flags
When reporting whether a boolean flag was seen report the actual flags
rather than a summary count. For example, if you have option spec `h/help`
and we parse `-h --help -h` don't do the equivalent of `set _flag_h 3`
do `set _flag_h -h --help -h`.

Partial fix for #4226
2017-07-20 17:54:06 -07:00
Kurtis Rader
4a7aa98e93 modify read to require at least one var
Fixes #4220
2017-07-20 13:07:30 -07:00
Kurtis Rader
2d5b698f0b add entry about set -Ux to the FAQ
This was inspired by this stackoverflow question:
https://stackoverflow.com/questions/45119425/how-can-i-set-environment-variables-in-fish/
2017-07-19 13:21:56 -07:00
Kurtis Rader
4e1303823b add ability for argparse to validate args
Fixes #4211
2017-07-18 14:42:50 -07:00
Fabian Homborg
2dfb615d7b Fix typo
Fixes #4225.
2017-07-18 23:37:14 +02:00
Kurtis Rader
8f22def8f7 return to psub --file being the default
The recent change to switch `psub` to use `argparse` caused it to use
a fifo by default because it inadvertently fixed a long standing bug in
the fish script. This changes the behavior back to `psub --file` being
the default behavior and introduces a `--fifo` flag. It also updates the
documentation to make it clearer when and why `--fifo` mode should not
be used.

Fixes #4222
2017-07-17 14:33:51 -07:00
Kurtis Rader
3e226f0a5e implement a new implicit int option spec
While updating the `history` function to use `argparse` I realized it is
useful to define an option that can be used in three ways. First by
using the short flag; e.g., `-n NNN`. Second by using the long flag;
e.g., `--max NNN`. Third, as an implicit int flag; e.g., `-NNN`. This
use case is now supported by a spec of the form `n#max`.
2017-07-16 18:27:41 -07:00
Kurtis Rader
06d071dd94 clarify argparse documentation 2017-07-16 15:33:04 -07:00
Kurtis Rader
98449fec51 fix math regression
The previous change to use `argparse` for parity with every other
builtin and function introduced a regression. Invocations that start
with a negative number can fail because the negative value looks like an
invalid flag.
2017-07-14 16:03:31 -07:00
Kurtis Rader
63d601610d implement -nnn style flags in argparse
This implements support for numeric flags without an associated short or
long flag name. This pattern is used by many commands. For example `head
-3 /a/file` to emit the first three lines of the file.

Fixes #4214
2017-07-13 20:36:59 -07:00
Kurtis Rader
49a0841533 update type to use argparse 2017-07-13 15:19:02 -07:00
Kurtis Rader
0d08bfd6ff document new argparse command
Fixes #4190
2017-07-12 22:38:32 -07:00
Kurtis Rader
a4dc2b872b implement fish_opt helper command
This implements a `fish_opt` command that provides a way for people
to create option specs for the `argparse` command as an alternative to
creating such strings by hand.

Fixes #4190
2017-07-12 22:38:32 -07:00
Kurtis Rader
b88cacf03e fix some documentation errors 2017-07-11 22:50:55 -07:00
David Adam
798f1a7050 docs: tighten language in FAQ 2017-07-09 14:11:15 +08:00
David Adam
285af8c4b4 docs: add FAQ for error caused by empty braces in find
See #95, #1109, #1468, #2206, #2840, #4202, etc.
2017-07-09 14:10:10 +08:00
Kurtis Rader
8cc4639ea6 implement cdh command
Fixes #2847
2017-07-05 13:25:18 -07:00
Fabian Homborg
9fb7037174 fish_key_reader: Add --version option
This should be there anyway, and we try to find fish_key_reader for
.app bundles, so this stops us from defining aliases to the command.

See #4179.
2017-07-04 22:55:47 +02:00
Kurtis Rader
c6093ad782 make read honor FISH_HISTORY
The `read` command `-m` and `--mode-name` vars are now deprecated and do
nothing other than result in a warning message. The `read` command now
honors the `FISH_HISTORY` var that is used to control where commands are
read from and written to. You can set that var to the empty string to
suppress the use of both history files. Or you can set it to a history
session ID in which case that will limit the `read` history that is
available.

Fixes #1504
2017-06-30 21:03:05 -07:00
Kurtis Rader
ec14527545 don't import bash history if not default fish hist
Don't import the bash history if the user has specified that a non-default
fish history file should be used. Also, rename the var that specifies
the fish history session ID from `FISH_HISTFILE` to `FISH_HISTORY`.

Fixes #4172
2017-06-30 20:24:55 -07:00
tomassedovic
aec0973196 Make the history session configurable
Using the FISH_HISTFILE variable will let people customise the session
to use for the history file. The resulting history file is:

    `$XDG_DATA_HOME/fish/name_history`

Where `name` is the name of the session. The default value is `fish`
which results in the current history file.

If it's set to an empty string, the history will not be stored to a
file.

Fixes #102
2017-06-30 17:13:02 -07:00
Nick Tzaperas
eaa0fdaeba fish_bind_mode variable documentation 2017-06-29 22:11:31 -07:00
Charles Ferguson
053d940d0a Add '--init-command', '-C' to the command line switches.
In order to allow the execution of commands before dropping to an
interactive prompt, a new switch, '-C' or '--init-command' has been
added to those switches that we accept.

The documentation has been updated correspondingly.

The original code only supported a single command list to be executed,
and this command list terminates the shell when it completes. To allow
the new command list to preceed the original one, both have been
wrapped in a new container class 'command_line_switches_t'. This is
then passed around in place of the list of strings we used previously.

I had considered moving the interactive, login and other command line
switch states into this container, but doing so would change far more
of the code, moving the structure to be available globally, and I
wasn't confident of the impact. However, this might be a useful thing
to do in the future.

A new function, run_command_list, was lifted from the prior execution
code, and re-used for both the initial command and the regular command
execution.
2017-06-29 20:59:58 -07:00
Kurtis Rader
bb29f9f990 replace __fish_urlencode with string escape
We now have a builtin that can do URL escaping so use it. I can't find
any uses of our private `__fish_urlencode` function in any Oh-My-Fish or
Fisherman code so remove it.
2017-06-23 22:46:36 -07:00
Kurtis Rader
f3cb625802 implement string unescape
Fixes #3543
2017-06-23 22:23:01 -07:00
Kurtis Rader
60bca14b37 implement string escape --style=xxx
We need a way to encode arbitrary strings into valid fish variable
names. It would also be nice if we could convert strings to valid URLs
without using the slow and hard to understand `__fish_urlencode` function.
In particular, eliminating the need to manipulate the locale.

Fixes #4150
2017-06-23 22:23:01 -07:00
Kurtis Rader
30368d5526 implement status function when in a breakpoint
Another step to fixing #1310. This changes means that `status -L0
function` reports the correct function when inside a breakpoint.
2017-06-23 22:14:21 -07:00
Kurtis Rader
c31b9f430f implement command -a
Fixes #2778
2017-06-23 15:43:37 -07:00
Kurtis Rader
e26f7aacc4 provide shorter status subcommands
As part of addressing #1310 I decided it makes more sense to replace
`current-function` with just `function`, etc., because I'm going to add
flags to let the user specify which stack level they are interested in.
With the default being zero or the "current" level.
2017-06-20 21:10:15 -07:00
Kurtis Rader
0ffc2899dc document previous two changes 2017-06-20 17:59:50 -07:00
Kurtis Rader
df01547eab implement the fish_breakpoint_prompt function
This is another step to resolving issue #1310. It makes
`fish_breakpoint_prompt` a replacement for `fish_prompt` if it is defined
and we're presenting a prompt in the context of a `breakpoint` command.
2017-06-20 17:18:59 -07:00
Kurtis Rader
bd299e96b2 implement status is-breakpoint
This implements `status is-breakpoint` that returns true if the current
shell prompt is displayed in the context of a `breakpoint` command.

This also fixes several bugs. Most notably making `breakpoint` a no-op if
the shell isn't interactive. Also, typing `breakpoint` at an interactive
prompt should be an error rather than creating a new nested debugging
context.

Partial fix for #1310
2017-06-20 17:18:59 -07:00
Kurtis Rader
ed6c8a95d7 improve debugger documentation
Fixes #4125
2017-06-15 16:53:56 -07:00
Kurtis Rader
955ae76cb3 minor fix to string man page 2017-06-11 11:59:36 -07:00
Fabian Homborg
65b80da60b tutorial: Mention combiners in conditionals section
See #4116.
2017-06-11 13:58:43 +02:00
Fabian Homborg
7bdcbc1775 tutorial: Add section on the semicolon
See #4116.
2017-06-11 13:58:39 +02:00
Kurtis Rader
f6c9bfc0e8 implement string lower and string upper
Fixes #4080
2017-06-10 17:35:25 -07:00
Kurtis Rader
a520d97752 there is no "undo" key binding 2017-06-07 17:04:17 -07:00
Fabian Homborg
822ee634c4 docs: Mention command-substitution splitting in tutorial
See #4097.
2017-06-06 22:06:09 +02:00
Kurtis Rader
c263c59346 document that set -n output is sorted 2017-05-31 13:22:49 -07:00
Kurtis Rader
6f6d3ce520 note in the tutorial the vars that are auto split
Users continue to be surprised that fish auto splits/joins three env
vars but not other similar vars. Mention this in the tutorial to make it
less likely new users are surprised by this behavior.

Fixes #4009
2017-05-26 17:00:57 +02:00
Fabian Homborg
0ee24b9bce docs: Change misleading $status comment for set
It still performs the assignment even if the command substitution
returned unsuccessfully - `set foo (echo bar; false)` returns 1 but
sets $foo to bar.

Also use `type -p` instead of `which`.
2017-05-19 19:06:44 +02:00
Fabian Homborg
64d33fac5d docs: Improve faq-exit-status
Add examples, a mention of `if command` and link to test/if.

See #2773.
2017-05-19 19:05:47 +02:00
Kurtis Rader
e84200b847 remove incorrect statement from string docs
Another change related to issue #3985. I forgot to includes this in my
previous two changes related to to consistently returning status 121
when any command, not just `string`, is handed invalid args.
2017-05-07 21:26:45 -07:00
Kurtis Rader
4c38867768 another step in fixing issue #3985
This primarily replaces "STATUS_BUILTIN_OK" with "STATUS_CMD_OK" and
"STATUS_BUILTIN_ERROR" with "STATUS_CMD_ERROR". That is because we want
to make it clear these status codes are applicable to fish functions as
well as builtins. Future changes will make it easier to use these
symbols and values in functions.
2017-05-04 00:18:02 -07:00
Kurtis Rader
fb54d34788 change string match --filter to --entire
Per discussion in PR#3998 to review adding a `--filter` flag to `string
replace` rename the same flag in the `string match` subcommand to avoid
confusion about the meaning of the flag.
2017-05-01 22:19:58 -07:00
Kurtis Rader
16816a1202 add string replace --filter flag
Fixes #3348
2017-05-01 22:07:30 -07:00
Kurtis Rader
6b1c939b67 rename --metadata to --details
Discussion in issue #3295 resulted in a decisions to rename the
functions --metadata flag to --details.

This also fixes a bug in the definition of the short flags for the
`functions` command. The `-e` flag does not take an argument and
therefore should not be defined as `e:`. Notice that the long form,
`--erase`, specifies `no_argument`. This discrepency happened to work
due to a quirk of how the flag parsing loop was written.
2017-04-30 20:21:40 -07:00
David Adam
4fde67fa50 implement disown builtin
Closes #2810.

The syntax mirrors that of zsh.
2017-04-29 19:20:03 +08:00
Marc Garcia Sastre
980af4aa5b status returns the function name when called with -u parameter
Fixes #1743
2017-04-26 20:15:45 -07:00
Kurtis Rader
a1d5a19e24 fix string man page
Fixes #3987
2017-04-25 08:48:00 -07:00
Kurtis Rader
5b6814d6ad add string match --filter flag
Fixes #3957
2017-04-24 21:45:06 -07:00
Fabian Homborg
30e02383a5 Identifiers: Fix typo.
Function names can indeed not contain a "/".
2017-04-23 13:46:56 +02:00
Kurtis Rader
275d658616 simplify and clarify valid identifiers
This is the first step in addressing issue #3965. It renames some of the
functions involved in validating variable and function names to clarify
their purpose. It also augments the documentation to make the rules for
such identifiers clearly documented.
2017-04-21 21:55:06 -07:00
Kurtis Rader
15e1f4349b document [alt-enter] behavior in funced command
Fixes #893
2017-04-21 17:15:56 -07:00
Fabian Homborg
3c95e00e8a It's "single quotes", not "single-quotes" 2017-04-21 13:43:02 +02:00
Francisco Giordano
349eff0df7 change cancel_commandline function to use color from variable
This allows the user to define how they want the "^C" rendered when a
pending command line is interrupted.
2017-04-17 21:16:42 -07:00
Kurtis Rader
fae1a398bd document new read --silent flag 2017-04-11 19:30:12 -07:00
Fabian Homborg
2a2ccea24e Document special-paste 2017-04-11 14:42:36 +02:00
Rory O’Kane
35e1d1e2d8 Fix deprecated flags in history example in docs
Update the Example section in the documentation for the `history` command so that it uses the subcommands instead of the deprecated long options.
2017-04-05 19:55:58 +02:00
Fabian Homborg
3edb7d538f Improve bg argument handling
- Error out if anything that is not a PID is given

- Otherwise background all matching existing jobs, even if not all
  PIDs exist (but print a message for the non-existing ones)

Fixes #3909.
2017-04-04 14:59:43 +02:00
Kurtis Rader
38c851f4cf let read take a simple string for the prompt
Fixes #802
2017-03-25 20:24:43 -07:00
Fabian Homborg
e1c3ec25ab Document snippet sourcing order
Fixes #3099.
2017-03-23 17:46:11 +01:00
Kurtis Rader
542962bc69 document events are per fish process
Fixes #2954
2017-03-22 20:53:39 -07:00
Fabian Homborg
2118973251 Document \cn/\cp bindings
We want to downplay this in favor of the arrow keys, but mentioning it
is still the right thing to do.

Supersedes #3879.
2017-03-20 16:49:29 +01:00
Fabian Homborg
70354f9f5e Add bind --list-modes option
Fixes #3872.
2017-03-20 16:42:53 +01:00
Kurtis Rader
6fd8dc44fb support test -k to test the sticky bit
Fixes #733
2017-03-14 21:43:15 -07:00
Kurtis Rader
6123d3cb50 document trap ... EXIT
Fixes #1180
2017-03-14 21:02:02 -07:00
Kurtis Rader
1afea1b650 add description to functions -m -v output
Fixes #597
2017-03-13 20:52:31 -07:00
Greynad
98f4e49669 Add string 'repeat' subcommand
This feature add the ability to repeat a string a given number of times.
For example: string repeat -n 3 foo
2017-03-12 20:30:36 -07:00
David Adam
40de253b3a Upgrade git:// and http:// URLs to https://
Work on fish-shell/fish-site#47

[ci skip]
2017-02-17 21:31:44 +08:00
ridiculousfish
2ea2a4c831 Make error color in tutorial a more pastel red 2017-02-12 15:41:31 -08:00
ridiculousfish
67c18c77d0 'Correct' error to eror in lexicon_filter
This changes the error examples in the tutorial to properly show in
red
2017-02-12 15:39:22 -08:00
Kurtis Rader
af7f5f42b6 put upper bound on data read will consume
This puts a hard upper bound of 10 MiB on the amount of data that read
will consume. This is to avoid having the shell consume an unreasonable
amount of memory, possibly causing the system to enter a OOM condition,
if the user does something non-sensical.

Fixes #3712
2017-02-09 21:04:46 -08:00
Kurtis Rader
9b24d26972 document creating - abbreviation in FAQ 2017-02-08 13:22:47 -08:00
Kurtis Rader
2e38cf2a4b implement means to learn about a functions source
This implements a way to use the `functions` command to perform
introspection to learn about the characteristics of a function. Such as
where it came from.

Fixes #3295
2017-01-20 21:48:41 -08:00
Kurtis Rader
2be1288cac handling when stty reports zero for termsize
If the kernel reports a size of zero for the rows or columns (i.e., what
`stty -a` reports) fall back to the `COLUMNS` and `LINES` variables. If
the resulting values are not reasonable fallback to using 80x24.

Fixes #3740
2017-01-20 15:34:29 -08:00
mathbunnyru
7a80610300 Delete trailing spaces 2017-01-15 14:57:21 -08:00
Cristian Prieto
6f9f7632f3 Added default mode prompt function (#3727)
* Added new function for the default prompt mode

Now fish mode prompt will call fish_default_mode_prompt, this will solve #3641

* Added function description

* Change wording for documentation about default mode prompt

* Finish changes requested in code review
2017-01-12 16:07:41 +01:00
Kurtis Rader
f365f720da don't warn about using obsolete complete options
Fixes #3640
2017-01-09 11:21:34 -08:00
Fabian Homborg
c5a6d87c5e Add while-read example to read docs 2017-01-07 14:31:05 +01:00
Fabian Homborg
e1b445f934 Document read return status
Fixes #3711.
2017-01-07 14:22:15 +01:00
Fabian Homborg
af022728bd Document complete-and-search moving backwards in pager
This isn't _clean_, but making a real binding that moves backwards if
in pager and does something else if not is more work.

Fixes #3703.
2017-01-06 16:13:01 +01:00
Kurtis Rader
05f19ad09c clarify autoloading and aliases
Another dev pointed out my previous attempt to resolve issue #3612 did
not do a good job of clarifying the matter. Hopefully this change is
better at explaining why autoloading is not applicable to aliases.
2017-01-02 17:15:18 -08:00
Anders Rasmussen
b22842a52f Add italics, dim, reverse video to set_color (#3650)
* Add italics and dim modifier to set_color

* update documentation for set_color

* add reverse mode to set_color

* Use standout mode as fallback for reverse mode

* Apply patch from @Darkshadow2 adding additional modes
2016-12-30 11:33:25 -08:00
Kurtis Rader
ee6691458e clarify that aliases are not autoloaded
Fixes #3612
2016-12-28 19:44:25 -08:00
Kurtis Rader
f31f53f61f fix random.1 man page
Trailing whitespace on a `\fish` command was causing this build failure:

/private/var/folders/T/fish_doc_build_3RT8yS/random.doxygen:44:
   warning: found </pre> tag without matching <pre>
2016-12-24 13:52:49 -08:00
Kurtis Rader
fe8fb2dccf clarify --inherit-variable option
Fixes #3626
2016-12-20 19:30:11 -08:00
Olivier Perret
1ace742b6c implement an improved random command
Fixes #2642
2016-12-20 16:46:33 -08:00
Fabian Homborg
a8a10d634b Document *-of-buffer functions
See #3632.
2016-12-09 19:34:26 +01:00
Kurtis Rader
59fa04bd91 function for editing command line in ext editor
This implements a standard function and bindings for editing the command
line in an external editor. This feature has been requested multiple
times in the past year with various solutions cut and pasted into those
issues. This change combines the best aspects of those solutions.

Fixes #1215
2016-12-08 19:17:09 -08:00
Kurtis Rader
d0077d0910 fix default binding documentation
Several uses of @key{Alt,x} incorrectly used uppercase "X" where the
binding is only for the lowercase "x".
2016-12-06 21:04:05 -08:00
Radomír Bosák
254762f30f Fix status code when bad command name is entered
This commit fixes a bug which causes that

   fish -c ')'; echo $status

("Illegal command name" error) returns 0. This is inconsistent with
e.g. when trying to run non-existent command:

   fish -c 'invalid-command'; echo $status

("Unknown command" error) which correctly returns 127.

A new status code,

    STATUS_ILLEGAL_CMD = 123

is introduced - which is returned whenever the 'Illegal command name *'
message is printed.

This commit also adds a test which checks if valid commands return 0,
while commands with illegal name return status code 123.

Fixes #3606.
2016-12-03 13:14:40 -08:00
David Adam
2b7dddf342 add flock fallback
Import the flock compatibility wrapper from NetBSD.

Work on #3340.
2016-12-03 16:36:06 +08:00
Radomír Bosák
1fbcb1ee9d Add the possibility to rename abbreviations
The abbr function doesn't have the possiblity to rename abbreviations.
You have to delete the old one and create a new one. This commit adds
this functionality and uses the syntax:

abbr -r OLD_KEY NEW_KEY

Fixes #2155.
2016-12-01 14:42:20 -08:00
Aaron Gyes
121109ee4d Adds a --quiet/-q option for command -s (#3591)
devnull'ing this builtin to check presence is a common
enough chore that a --quiet option which works like it does on
`type` would be handy.
2016-11-28 07:26:01 -08:00
David B. Lamkins
5ec9fcd8d4 Allow browser for help to be chosen indenpendent of $BROWSER. 2016-11-25 18:35:22 -08:00
Valentin Hăloiu
ed5f90d22e Update key binding docs to reflect actual behavior
Some key bindings were updated in fish 2.4.0 but in some cases the
documentation does not correctly reflect the actual behavior. This
commit attempts to fix that.
2016-11-24 18:58:08 -08:00
Kurtis Rader
9e922a6e02 make status saner vis-a-vis arg parsing
The `status` command currently silently allows incompatible flags (i.e.,
subcommands). Too, using flags to specify subcommands misleads the user
into thinking they can specify multiple subcommands.

We recently modified the `history` command to deprecate using flags for
subcommands. This change does the same for the `status` command.

Fixes #3509
2016-11-07 12:11:08 -08:00
Aaron Gyes
6e873719fd Fix alias doc typo
Fix spelling typo, and a couple small tweaks.
2016-10-30 21:25:21 -07:00
Aaron Gyes
fb979922b3 Update alias docs 2016-10-29 13:57:05 -07:00
Fabian Homborg
56679d4776 Don't use open function if a command exists
Turns out this is also the case on Haiku.

It also eliminates a fork.

Closes #3487.
2016-10-26 15:48:42 +02:00
Kurtis Rader
a26f68d63f handle multiline commands in history search output
Fixes #31
2016-10-16 21:33:12 -07:00
Kurtis Rader
f490b56378 make history searching case insensitive by default
Fixes #3236
2016-10-16 20:18:16 -07:00
Fabian Homborg
44baf0f9bd docs: Correct history path.
Fixes #3462.
2016-10-15 19:50:23 +02:00
Fabian Homborg
4acfdcb0a0 Remove CDPATH default from docs
This was overlooked in 0e4f2cca01.
2016-10-15 19:40:17 +02:00
Anmol Sethi
e8ed45ecd3 docs: fixed incorrect phrasing in Variable expansion section 2016-10-14 19:03:33 -07:00
Anmol Sethi
3c0de01c07 docs: set should have -x for PATH in config.fish 2016-10-13 20:06:54 -07:00
Kurtis Rader
1d418365b5 fix misplaced backtick 2016-10-12 18:04:20 -07:00
Kurtis Rader
a3d0ea5c7f document making abbreviations global
People regularly ask how to make abbreviations global (i.e., private to
a fish session) rather than universal. So explain how to do so in the
`abbr` man page.

Fixes #3446
2016-10-12 15:36:03 -07:00
Kurtis Rader
d35cbb6594 fix string documentation wrt --no-quoted 2016-10-11 20:08:07 -07:00
Aaron Gyes
ea3e144f2d Fix warning: Found unknown command `\args'
The problem was that 'cd' is a builtin.
Thanks @MarkGriffiths

Fixes #3418
2016-10-10 11:50:39 -07:00
Kurtis Rader
f7f39b8c90 make fish's realpath compatible with GNU realpath
After implementing `builtin fish_realpath` it was noticed that it did
not behave like GNU `realpath` without options. Which is super annoying
since that was the whole point of implementing the command. Major
failure on my part since I wrote the unit tests to match the behavior of
the existing `wrealpath()` function that I simply exposed as a builtin
command. Rather than actually verifying it behaved in a manner
compatible with GNU realpath.

Also, while the decision to call the builtin `fish_realpath` seemed to
make sense at the time of the original commit further reflection has
shown that to be a silly, idiosyncratic, thing to have done. So rename
it to simply `realpath`.

Fixes 3400
2016-10-04 20:19:44 -07:00
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
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
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
af95813514 Merge branch 'master' of https://github.com/fish-shell/fish-shell into colorfix 2016-09-10 15:09:12 -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
cac3b239e3 Use fish_vi_cursor by default
Fixes #3215.
2016-09-05 01:28:21 +02:00
Fabian Homborg
7ce042ccff Really allow for hybrid bindings
The previous solution would not erase the previous bindings if
fish_vi_key_bindings was called with a mode argument. So if the user
switched to vi with a different initial mode, they'd keep their previous
bindings also.

Supersedes e89057b.
2016-09-05 00:47:37 +02:00
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
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
David Adam
4f596536f5 docs: clarify configuration file locations
Altered the language from 2047351723 to be clearer.
2016-08-25 05:48:19 +08:00
Fabian Homborg
2047351723 Mention variables in doc on config file locations
Fixes #3291.
2016-08-24 23:35:22 +02:00
Martin Pool
386c698d45 Remove optimizeLegibility and display:inline-block
Fixes fish-shell/fish-site/issues/34.

These make the inline commands illegible on Android Chrome:
respectively, overlapped with other text, and smaller than the body
text.
2016-08-14 16:52:27 -07: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
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
3f9bd72bca Revert "add files for the fish logo as used for the fish-shell stickers"
This reverts commit c4cc9f9b8d.

See #3278
2016-08-01 16:30:14 -04:00
Kurtis Rader
b12c413c28 add sources of 3rd-party extensions to the FAQ
Fixes #2103
2016-07-27 20:55:04 -07:00
Aaron Gyes
644ea82c2f Update set_color documentation
Update docs for "brblack", "brwhite"  existing.

We no longer mention colors like grey, brown and purple, which are aliases
for yellow, magenta, white/black. The color names still work but there
isn't a good argument for there being two ways to do that: especially in
the age of 24-bit terminals where one might expect yellow and brown or
magenta and purple to actually be different colors.

Copyedit rest of document for inaccuracies, strange advice, brevity (a lot
of "you" pronouns, for example.)

Document the color fallback feature (set_color 313554 blue) that's been
present quite a while.
2016-07-24 17:50:13 -07:00
ridiculousfish
450d4be88f Shorten an overlong set_color example in the man page
The `set_color normal` text had a comment that caused
the example to wrap to the next line in an 80 column window.
Shorten the comment so the example fits on one line.
2016-07-24 17:04:51 -07: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
Mark Griffiths
eb0d04d7ff Fix imbalanced backticks
Only found one instance, which I’d already identified.
2016-07-16 20:22:41 -07:00
Mark Griffiths
b2be50f081 Fix documentation
Restores erroneous changes to lexicon_filter and changes to doc_src/ pages. Done by hand to ensure version history.

Fixes display of % when misinterpreted by Doxygen.
2016-07-16 20:22:41 -07:00
Fabian Homborg
733e960c11 Document that set_color works with escape sequences
Fixes #2378.
2016-07-08 12:58:39 +02:00
Kurtis Rader
3c4e322ec1 make fish_indent options consistent with fish
Make `fish_indent`, `fish_key_reader` and `fish` recognize and assign
the same meaning to the `-d` and `-D` flags. Also, fix some errors and
stylistic issues in the associated man pages.

Fixes #3191
2016-07-05 20:22:44 -07:00
Aaron Gyes
f839282ac0 fish_key_reader had no -h output 2016-07-03 05:03:32 -07:00
Aaron Gyes
163e16f546 fkr manual improvments. 2016-07-03 03:43:14 -07:00
Aaron Gyes
5a1a25bfbe Fix docs 2016-07-03 02:02:44 -07:00
Aaron Gyes
ca15a22cd1 doc grammar: s/learning/learn 2016-07-03 00:16:05 -07:00
Aaron Gyes
417d53a58f Update fish_key_reader docs
* Document all options
 * Document bind command output
 * Remove session output - it's enough to explain how one exits.
2016-07-03 00:03:39 -07:00
Aaron Gyes
9642fcb589 Update suspend docs. When used, show how to resume
Fixes #3154
2016-07-01 01:18:07 -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
Fabian Homborg
ea71f0b610 Reword variable expansion docs 2016-06-26 11:36:31 +02:00
Fabian Homborg
a3e9e179eb Document fish_mode_prompt 2016-06-26 11:36:31 +02:00
bgeron-g
5d680f6dbc Fix typo 2016-06-23 18:23:10 +02:00
Fabian Homborg
f9edcbbbe2 Document clipboard bindings. 2016-06-21 16:25:11 +02:00
Aaron Gyes
f04644f749 Lossless recompress of images with pngcrush+zopfli
And tweak RTF.
2016-06-18 10:03:26 -07:00
Fabian Homborg
8829bb1364 Expand string documentation
Explain that globs need to match the entire string and a bit about our
regular expressions.
2016-06-08 15:04:54 +02:00
David Adam
bb11999bf7 license.hdr: remove strlcat license information
Function and code removed in 5bf1b0e5f

[ci skip]
2016-05-30 16:00:23 +08:00
Fabian Homborg
ffe5736abb History docs: Move descriptions to the corresponding options
This should clarify `--delete`s behavior without `--prefix` or
`--contains` a bit.

Fixes #3054.
2016-05-28 14:22:16 +02:00
Fabian Homborg
d55b226f19 Document the rest of the electric/ro vars
Fixes #3072.
2016-05-26 18:27:39 +02:00
Fabian Homborg
1bad956633 docs: Remove section about clipboard integration 2016-05-25 16:10:16 +02:00
Dennis Ideler
0a40dcdb44 Fix documentation links to or and and command 2016-05-24 17:16:30 -07:00
Fabian Homborg
dc470bcad3 Document noclobber redirections
Fixes #2812.
2016-05-23 11:29:38 +02:00
Camille Scholtz
2606cfe72d add option to modify script being restyled
This change allows the user to specify the script name on the CLI in addition
to being redirected from stdin. It also adds a `-w` flag to write the modified
script to the original file.
2016-05-22 20:00:23 -07:00
James Campos
432c0058a9 [doc] move regex example (#3045)
this example uses regex, so it should not be in the glob examples
2016-05-20 15:57:29 +02:00
ridiculousfish
30ea7cc3f8 Update docs to reflect new if/while condtion chaining
Documents new behavior in #1428
2016-05-19 13:01:12 -07:00
Kurtis Rader
73f2992a2e make debug() output more useful
This change does several things. First, and most important, it allows
dumping the "n" most recent stack frames on each debug() call. Second,
it demangles the C++ symbols. Third, it prepends each debug() message
with the debug level.

Unrelated to the above I've replaced all `assert(!is_forked_child());`
statements with `ASSERT_IS_NOT_FORKED_CHILD()` for consistency.
2016-05-17 14:52:55 -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
Kurtis Rader
b055b8440c enhance the key_reader program
The original `key_reader` program was useful but didn't do much that `xxd`
or `od -tx1z` didn't do. Furthermore, it wasn't built and installed by
default. This change adds features that make it superior to those programs
for decoding interactive key presses and makes it a first-class citizen
like the `fish_indent` program that is always available.

Fixes #2991
2016-05-10 14:11:30 -07:00
Vladimír Čunát
100eef4e42 docs: fix location of generated_completions (#3010) 2016-05-08 13:51:30 +02:00
Fabian Homborg
1d101ef3d0 docs: Mention cartesian product in variable-expansion section
See #3002.
2016-05-07 19:49:15 +02:00
Alexey Alekhin
01e5ca5c96 Changed the code to add fish to /etc/shells to the one that is mentioned in the Readme 2016-05-06 18:47:57 -07: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
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
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
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
Kurtis Rader
dcef1a5593 more doxygen lexicon changes to eliminate errors
I noticed that Doxygen was also complaining about the "<asis>" and "<bs>"
tags. So convert those to the backslash form like we did for "<outp>" in the
previous commit.
2016-04-24 15:02:52 -07:00
Kurtis Rader
5df8fab463 replace <outp> command with \outp in docs
Doxygen has been warning that `<outp>` and `</outp>` are not valid XML/HTML commands since commit cb6d5d76 on 20016-04-04. That's primarily because there is at present no way to tell Doxygen to recognize new XML/HTML tags. The actual errors look like this:

```
.../string.doxygen:187: warning: Unsupported xml/html tag </outp> found
```

I hate build errors since they a) cause needless concern, and b) make it harder to notice when I've introduced a new error. So switch from XML/C## style markup to Doxygen style markup for the "outp" annotation.
2016-04-23 21:19:58 -07:00
Kurtis Rader
b8817215dc trivial fixes to make doxygen happy 2016-04-23 12:26:57 -07:00
Fabian Homborg
6c5f923a47 Remove non-existing functions in bind docs
At least delete-line was previously a thing, but none of these are still available.

First part of #2914
2016-04-08 16:35:12 +02:00
Aaron Gyes
790c7f80c7 Implement an --invert/-v for string match, like grep -v.
Only lines that do not match the pattern are shown.
2016-04-08 10:49:29 +08:00
Fabian Homborg
8477126ae4 Correct true-color statement in set_color docs
- OSX Terminal does not support it

- We do some detection
2016-04-07 18:27:34 +02:00
Kurtis Rader
35e282928a clarify documentation for the source command
Make it clear that fish 2.3.0 changed how `$argv` is initialized.
2016-04-06 17:18:06 -07:00
Kurtis Rader
4ff8e6e781 change how redirections are formatted
Modify `fish_indent` to emit redirections without a space before the target of
the redirection; e.g., "2>&1" rather than "2>& 1" as the former is clearer to
humans.

Fixes #2899
2016-04-05 19:29:23 -07:00
David Adam
200a10e78d Rename "snippets" to "conf" internally, and document them as snippets
Discussed in #2896.
2016-04-06 09:33:09 +08:00
Mark Griffiths
9e93ddc097 Fix a couple of minor issues in string examples
Print correct return code in 2nd example
Remove syntax colouring in \cg

Signed-off-by: Mark Griffiths <mark@thebespokepixel.com>
2016-04-05 10:57:32 -07:00
Kurtis Rader
3435e94994 make the string man page more readable
I didn't notice when I merged commit cb6d5d76c8
by thebespokepixel.com that it removed the explicit wrapping in the `string`
man page. That makes `man string` harder to read so reinstate the explicit
wrapping.
2016-04-04 21:32:03 -07:00
David Adam
484c1484c9 Customisable extra configuration, completion and function directories
- Add options to the autotools build to set the path for the "vendor"
   or "extra" configuration snippets, functions and completions
   directories.

 - Remove the vendor_completions directory from the Xcode build, as
   these are relocatable and compiling the paths in does not make sense.

This allows packaging tools like Homebrew and Nix to use a common
directory outside of the main prefix for third-party completions, and
to make these available for programmatic discovery through `pkg-config`.

Closes #2113
2016-04-04 15:58:13 -07:00
Mark Griffiths
cb6d5d76c8 update lexicon for latest docs
Closes #2699

Fixes issues with:
* 'string' function synopsis
* Redirection display issues
* Better file & path detection
* Rendering of % & @ chars in both html and man
* @ symbol in tutorial

Improves robustness by implementing an @EOL marker to prevent hold buffer dumping extra chars after the end of an expression.

Added new '{{' and '}}' meta-chars for when you want curly braces in a regexp that was previously tripping up the lexicon.

Improve man/html presentation consistency for
* string
* printf
* prompt_pwd
* type

Use cli-styling for 'practical' examples.

Add <bs> tag for presenting content with preceding backslash.

Signed-off-by: Mark Griffiths <mark@thebespokepixel.com>
2016-04-04 15:23:56 -07:00
Kurtis Rader
35cee1e39c remove "doc" make target and rename "user_doc"
Fixes #2874
2016-03-30 19:20:23 -07:00
Kurtis Rader
0e18e2ba78 clarify behavior of ** glob
Fixes #2680
2016-03-29 16:44:44 -07:00
Fabian Homborg
d30f8fffc8 Reword: Always call suggestions sugggestions
Not completions.
2016-03-29 15:55:42 +02:00
Fabian Homborg
19dd28e400 Document pager search
Fixes #2866.
2016-03-29 15:55:42 +02:00
Fabian Homborg
daf94e14d4 Document more keybindings
Fixes #2866.
2016-03-29 15:55:42 +02:00
Fabian Homborg
7accadc33f Only read .fish files in the snippets directories
This would allow us to add a README and allows users to easily disable
something temporarily.
2016-03-26 19:20:40 +01: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
Nyanpasu
2e0205a746 Add missing "Universal Variables" to tutorial.hdr 2016-03-22 06:52:11 +08:00
Federico Ferri
168a156e58 implement swap-selection-start-stop function
The swap-selection-start-stop function goes to the other end of the highlighted text, the equivalent of `o' for vim visual mode.

Add binding to the swap-selection-start-stop function, `o' when in visual
mode.

Document swap-selection-start-stop, begin-selection, end-selection, kill-selection.
2016-03-20 19:22:04 -07:00
Fabian Homborg
5e09411340 Document more bind functions
Fixes #2534 as backward-kill-path-component is now documented.
2016-03-06 15:23:55 +01:00
Fabian Homborg
333415f42a Fix stylistic nit in glob documentation
The test is unnecessary.
2016-03-03 10:30:53 +01:00
Fabian Homborg
0e8a8a7c80 Migrate abbrs from =-separated to space-separated
We silently upgrade existing abbreviations and change the separator when
saving.

This does not yet warn when the user is using the old syntax.

Resolves #2051
2016-03-02 10:59:12 -08:00
Kurtis Rader
f2246dfb34 reduce number of Unicode private-use characters
This narrows the range of Unicode codepoints fish reserves for its own
use from U+E000 thru U+F8FE (6399 codepoints) to U+F600 thru U+F73F (320
codepoints). This is still not ideal since fish shouldn't be using any
Unicode private-use codepoints but it's a step in the right direction.

This partially addresses issue #2684.
2016-02-28 18:36:34 -08:00
Fabian Homborg
b41b962336 Clarify example in $PATH tutorial
See #2777
2016-02-29 00:12:26 +01:00
Fabian Homborg
60bd3c809a Try to clarify test documentation for newbies
See #2773
2016-02-28 17:52:42 +01:00