Commit graph

4338 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
cfc06203e7 Add new functions flag -V/--inherit-variable
--inherit-variable takes a variable name and snapshots its current
value. When the function is executed, it will have a local variable with
this value already defined. Printing the function source will include
synthesized `set -l` lines for the values.

This is primarily useful for functions that are created on the fly, such
as in `psub`.
2014-10-02 18:41:39 -07:00
Kevin Ballard
6d7a7b00d7 Use ENV_USER with vars set via function -a
ENV_USER is intended to be used when setting any variable whose name is
controlled by the user. The names given to `function -a` certainly
qualifies. This wasn't an issue in practice because the only restriction
ENV_USER imposes is also imposed on ENV_LOCAL, but the rules may change
in the future.
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
ae7b6156ac Rewrite fishscript testrunner for better output
Update the fishscript testrunner to use the same output style as the
interactive testrunner.
2014-10-02 12:33:42 -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
Kevin Ballard
bae2b2cc47 Fix examples in bind documentation 2014-10-01 18:20:09 -07:00
Kevin Ballard
47c357a354 Tweak lexicon_filter.in for GNU sed 2014-10-01 18:19:38 -07:00
Kevin Ballard
b592da41f6 Fix doc example for echo 2014-10-01 15:30:36 -07:00
Jan-Thorsten Peter
646d9ab431 Added fish_preexec and fish_postexec events
Fixes #1549.
2014-10-01 15:09:35 -07:00
Kevin Ballard
43e451d4d8 Find fishd file even when $HOME is unset
env.cpp sets up $HOME based on the current user, if it's not inherited
from the environment. fishd_get_config should be using the same
calculated value of $HOME. To that end, move universal variable
initialization to after $HOME is set up, and read the value from the
fish environment instead of using getenv().

Fixes #1725.
2014-10-01 12:35:15 -07:00
Kevin Ballard
1be5e68e99 Export $HOME if we have to calculate it
If $HOME is unset in the environment, fish calculates it with
getpwnam(). However, it wasn't being exported. Just like the $USER
calculation, $HOME should probably be exported, because everyone will
assume that it's an environment variable (as opposed to an unexported
global variable).
2014-10-01 12:27:32 -07:00
David Adam
ab5b22982f fish.pc: add pkgconfig file for fish
Assists other packages in finding the path to install completions: call
`pkg-config --variable=completionsdir fish` or so (like
bash-completion).

As discussed in #1485.
2014-10-01 22:15:24 +08:00
David Adam
5157ac30fa Create and use $DATADIR/vendor_completions.d/ for upstream completions
Closes #1485.
2014-10-01 21:28:01 +08:00
Kevin Ballard
3616dd5889 Base status -b off the parser execution stack
Instead of globally marking the state as "in block" when evaluating
blocks/functions, update the "in block" status when pushing/popping
blocks on the parser stack.

Fixes #1729.

On a side note, `status -b` is actually pretty useless, because it
always returns 0 inside of a function (even without this patch).
2014-09-30 20:58:45 -07:00
Kevin Ballard
489fb7ec3f Expunge INTERNAL_BLOCK from the codebase
It's a relic of the old parser, and isn't used anymore.
2014-09-30 17:20:46 -07:00
Kevin Ballard
51527612d3 Don't leave is_block in bad state after bad redirection
Fixes #1728.
2014-09-30 17:06:56 -07:00
ridiculousfish
c181de1d7f Teach the highlighter about multiple adjacent square bracket expansions
Fixes #1627
2014-09-30 11:15:22 -07:00
Kevin Ballard
d67800bbce Make false/true into builtins
Making `true` into a builtin is a significant optimization to `while
true` loops. As long as `true` is a builtin, we may as well make `false`
builtin as well (despite the fact that it's not typically executed in a
loop).
2014-09-29 13:39:35 -07:00
ridiculousfish
27dd37ebb4 Fix to indent comments in blocks properly (#1710)
This makes two changes to parse trees:

1. Unmaterialized nodes no longer have an invalid source location
For example, with the code `while false;end` there are no tokens
associated with the while loop's job_list, and therefore it is
unmaterialized. Previously it would have had a SOURCE_OFFSET_INVALID.
But now it has a zero source length, but an offset equal to the end of
the while loop (i.e. the semicolon), and a zero length. Correspondingly,
the has_source function now checks the length instead of the offset.

2. Special (comment and error) nodes have always been "disconnected,"
meaning they are not the child of any other node. However, they now have
their parent offsets set to whatever the top of the node stack was when
the node was encountered. This gives us a sense of which node the
comment is "in", e.g. if we are constructing a job list then the
comment's parent will be the job list. This lets us determine the
comment's indent.
2014-09-29 11:30:21 -07: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
84af3dcd18 Fix YAML indentation in history. 2014-09-28 15:03:55 +02: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
ridiculousfish
b00cbae4b5 Fix for issue where comments are lost in function definitions
Fixes #1710
2014-09-27 17:32:54 -07:00
ridiculousfish
4f4734fc9b Fix some busted escape sequences in docs, and slightly reformat a few examples 2014-09-27 16:56:13 -07: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
2f71c15b93 Makefile: warn about SELinux; avoid a bashism
Closes #63.
2014-09-27 19:11:35 +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
David Adam
a0e5cdd178 Merge branch 'Integration_2.1.1' 2014-09-26 22:18:31 +08:00
David Adam
ba11a0eb9b Merge branch 'Integration_2.1.1' 2014-09-26 22:03:25 +08:00
ridiculousfish
b511550917 Revert "Prepend ./ to "flag-like file" wildcard expansions and completions"
This reverts commit 316d7004a3.

Reverts fix for 1519 in light of #1713

Conflicts:
	fish_tests.cpp
2014-09-25 22:18:36 -07:00
Kevin Ballard
7935b86cb2 Report expand errors better in fish tests
Print the expected and actual results if an error occurs.
2014-09-25 19:45:54 -07:00
Kevin Ballard
fb8eb22e56 Refactor expand tests slightly to handle errors better
If we get an error relating to our manipulation of the temporary
directory or cwd, we don't want to run the rest of the tests that assume
it worked.
2014-09-25 18:51:03 -07:00
Kevin Ballard
6925cd5d88 Escape the error string in process expansion errors
This prevents `echo %*` from printing a private-use character in the
error string.

Fixes #1720.
2014-09-25 18:24:10 -07:00
Kevin Ballard
35595dbffd Make escape() return a wcstring
This avoids the potential for leaking the resulting string.
2014-09-25 18:20:03 -07:00
Kevin Ballard
cd4fa518b8 Remove my_wcswidth() in favor of fish_wcswidth()
my_wcswidth() was just a wrapper around fish_wcswidth() already.
Instead, add two convenience overrides of fish_wcswidth() to common.h
that make it a drop-in replacement for my_wcswidth().
2014-09-25 18:04:11 -07:00
ridiculousfish
316d7004a3 Prepend ./ to "flag-like file" wildcard expansions and completions
If a wildcard or completion expands to a file that begins with
one or more dashes, prepend a ./ to it so that it doesn't get
parsed as an option.

Fixes #1519
2014-09-24 22:06:43 -07:00
ridiculousfish
1096b1acd5 Merge pull request #1708 from lledey/master
Fix emacs completion on OS X
2014-09-24 11:53:56 -07:00
Konrad Borowski
5766c7c53a Add empty virtual destructor for lru_node_t.
history_lru_node_t has implicit destructor defined. However, because
it's being deleted as lru_node_t, it's not being actually called, as
lru_node_t doesn't have a virtual destructor.
2014-09-24 16:37:32 +02:00
Konrad Borowski
bbce0909fe Remove dead code in history builtin. 2014-09-24 16:18:29 +02: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
ridiculousfish
0986b6d991 Ignore SIGPIPE in fishd. Fixes #1084 2014-09-24 17:51:07 +08:00