Commit graph

2392 commits

Author SHA1 Message Date
maxfl
c0e996acf8 Implemented index ranges for command substitution
Now the following code works:
> echo (seq 10)[-1..1]
With output:
10
9
8
7
6
5
4
3
2
1
2012-07-07 22:01:28 +08:00
maxfl
41ec58a524 misc 2012-07-07 11:04:29 +08:00
maxfl
0a5e7be129 Add index ranges
Builtin 'set' now can set variable index ranges:
  set test[1..3] a b c #works
  set test[-1..-3] a b c #works if variable have enough elements
  set test[2..-2]  a b c #works
  set test[1..3 -1..-2] a b c b b #works

Expand now can parse index ranges. But not handle for now.

TODO:
  * Add variable substitution index ranges: echo $PATH[-1..1]
  * Add command substitution index range: echo (seq 10)[-1..-4]
  * Add process substitution indexes and ranges: echo %vim[-1]
2012-07-07 10:57:28 +08:00
maxfl
b23d65b014 Set single-line default prompt
Fish now doesn't join the fish_prompt output. This breaks the default
fish_prompt. Make default fish_prompt single-line. Fixes #203.

Add -l flag to 'read' documentation. Remove ambiguous '-x' description.
Fixes #157.
2012-07-07 10:17:24 +08:00
ridiculousfish
60ef7903e2 Tweaked __fish_print_help to not spew errors 2012-07-06 16:31:06 -07:00
ridiculousfish
ee8fd21d28 Fix for https://github.com/fish-shell/fish-shell/issues/209
Don't hang if stdin is closed and we have no bindings
2012-07-06 16:25:59 -07:00
maxfl
232ed91ec7 Fix read default prompt. It's now single line. 2012-07-06 15:31:45 -07:00
maxfl
7fccad156e Fix fish_prompt event
I've found that this modification fixes fish_prompt event
Fixes #164
2012-07-06 15:31:45 -07:00
ridiculousfish
11e56456a0 Fix for wrong sense for determining when an autoloaded function has changed
Addresses some of the complaints in https://github.com/fish-shell/fish-shell/pull/201
2012-07-06 15:30:41 -07:00
Emily Eisenberg
d07e78c59a Make prompt_pwd make a lot more sense
Remove the case statements, which were handled by the sed blocks anyway
Move around the '/' character in the regex, so only one regex is needed
Fix a bug where '/' is output as '//'
2012-07-06 14:46:50 -07:00
Sean DuBois
c45479a6e5 Created the man page for echo and test 2012-07-06 14:41:44 -07:00
ridiculousfish
345a528625 Untangle unescaping responsibilities in highlight.cpp. Fix cd autosuggestions to properly handle quotes. Factor out some of the quote unescaping behavior from reader.cpp to parse_util.cpp.
Add some autosuggestion tests
2012-07-06 14:34:53 -07:00
maxfl
01d8490255 Return the previous logic for '\\'.
The following expression now works:
```sh
switch '\\'
  case '\\'
  echo 1
end
```

Due to ambiguity, the following expression also works:
```sh
switch '\a'
  case '\\a'
  echo 1
end
```

By the way, the following expression now doesn't work, which was not the
case before, because of wrong escaping:
```sh
switch 'nn'
  case '\n'
  echo 1
end
```
2012-07-05 14:17:25 -07:00
maxfl
ea4b37d5c5 Fixed case behaviour
* case no properly handles -h and --help flags, i.e. treats it as
  pattern
* fixed case escaping:
The following expressions now work correctly:
switch '*'
  echo '*'
  echo Match any string
end
switch '*'
  echo '\*'
  echo Match asterix
end
switch '\\'
  echo '\\\\'
  echo Match slash
end

The same for '?' sign
2012-07-05 14:17:25 -07:00
Siteshwar Vashisht
a1319cb8aa Fixed crash caused by pressing pageup button when no match (for typed command) in history is found 2012-07-05 16:06:39 +05:30
ridiculousfish
35c49d62d7 Fix a class/struct disparity 2012-07-01 16:11:14 -07:00
ridiculousfish
0576a11a6f Added missing break in case R_SUPPRESS_AUTOSUGGESTION 2012-07-01 15:40:06 -07:00
Ian Munsie
c8f86d94c9 Add command to temporarily suppress the autosuggestion feature
Autosuggestion will be automatically re-enabled next time a character is
inserted. An alternative implementation would require another command to
explicitly re-enable it.

Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
2012-07-01 15:37:10 -07:00
Ian Munsie
2b24eab26a Fix off by two in move_word left
This can be demonstrated with something like:

echo howdy hi<control-w>
echo howdy I<alt-b>

Previousely this would delete/move all the way to the start of 'howdy',
rather than just the word 'hi'/'I'.

It seems that the code to ignore the character under the cursor was
redundant, as all the cases I've tried with it removed seem to do the
right thing.

Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
2012-07-01 15:37:10 -07:00
ridiculousfish
7bbc7a61ce Clarify the function name deferral in functions_def
Prohibit making a function with an empty name
2012-07-01 15:33:50 -07:00
maxfl
fe26284376 Doc is updated
btw. funced completion is updated
2012-07-01 14:20:43 -07:00
maxfl
ab62fe6496 Update funced
* Editor mode is no the default
* Use -i or --interactive or -e fish to edit function in interactive
  mode
* tmpname is now created with random number added and check that file
  do not already exist
* check $TMPDIR existence and put /tmp if it does not exist
* There is an undocumented feature to use functions, started with dash.
  Introduce necessary changes to funced, functions, def_function()
  in order to make it work properly.
* Delete editor guessing. Use $EDITOR variable or -e key
2012-07-01 14:20:43 -07:00
ridiculousfish
bc9bae0f7f Update make_tarball.sh to respect new branch name 2012-07-01 14:19:39 -07:00
maxfl
e5939d1a18 Disable default fish_pager_color_secondary
since it should be different, depending on terminal background
2012-06-29 18:53:22 -07:00
maxfl
5fadb7f200 fix logic 2012-06-29 18:53:22 -07:00
maxfl
a02aa7a316 Step coloring for fish_pager introduces new variable
fish_pager_color_secondary to set background of every second completion
line. It simplifies finding the options corresponding to given
description. Default color is 151515.
2012-06-29 18:53:22 -07:00
ridiculousfish
3ab26a5d40 Updated funced documentation to reflect new behavior 2012-06-29 18:41:37 -07:00
ridiculousfish
a8bae31939 Change funced script to default to using $EDITOR if set, and to allow -e to specify a particular editor (with fish meaning the builtin editor) 2012-06-29 18:35:26 -07:00
maxfl
faea588fb8 Support editing functions starting with dot 2012-06-29 16:42:34 -07:00
maxfl
792e246262 Add emacs to 'funced -e'
The order is also changed.
2012-06-29 16:42:34 -07:00
maxfl
85f19f9b8c Add -e option to funced
New option -e or --editor allows to edit function inside external
editor, rather than in reader.
2012-06-29 16:42:34 -07:00
ridiculousfish
40e4f49dbe Disable process expansion in autosuggestions
Addresses https://github.com/fish-shell/fish-shell/issues/39
2012-06-29 16:40:54 -07:00
Siteshwar Vashisht
05c721bebb Some improvements to validate commands suggested from history 2012-06-29 00:24:37 +05:30
maxfl
e995cc9329 fix #177 (complete 'cd' only with paths) 2012-06-26 19:17:32 -07:00
ridiculousfish
9457c115be Merge pull request #181 from kballard/fish_git_switch
Remove __fish_git_prompt's switch bug workaround
2012-06-26 13:00:31 -07:00
Kevin Ballard
1eddc79a90 Remove __fish_git_prompt's switch bug workaround
With the switch bug fixed, __fish_git_prompt can be very slightly
simplified by not recording the exit status of every case in the
describe style switch individually.
2012-06-25 15:19:47 -07:00
Siteshwar Vashisht
ccfc909eb2 Fixed crash caused by pressing pageup button 2012-06-25 03:02:37 +05:30
Kevin Ballard
1a93cbba1e Bring prompt_pwd under Darwin to parity with non-Darwin
The echo command to print the last path segment got a couplel of fixes,
but these fixes were only applied to the non-Darwin version. Copy these
fixes over to the Darwin version. Notably, this makes `/` stop
displaying as `//`.
2012-06-24 14:04:43 -07:00
Kevin Ballard
529d410bec Fix prompt_cwd on darwin systems when $PWD is "/private"
When $PWD is "/private", the prompt was printing "rivate". Skip the
"/private" stripping if there's nothing after it.

Prevent "/private" from being stripped anywhere but the beginning of the
PWD.

Fixes #173
2012-06-24 14:04:43 -07:00
Kevin Ballard
4d1c0eaa52 Fix var set in __fish_config_interactive.fish
__fish_config_interactive.fish uses the presence of __fish_init_1_50_0
to decide whether it should perform a one-time initialization of
universal variables. Unfortunately, it sets the variable
__fish_init_1_23_0. Fix this to set __fish_init_1_50_0 instead.
2012-06-24 13:57:15 -07:00
Kevin Ballard
adfd3c1098 Don't blow away $status in switch statements
Tweak the switch and case builtins to not blow away $status
inappropriately. Fixes issue #161.
2012-06-24 13:43:44 -07:00
Kevin Ballard
f7d0c4b065 Add a test case for switch error code (issue #161) 2012-06-24 13:43:44 -07:00
Siteshwar Vashisht
5fb32f1e2d Fixed declaration of wrealpath() function on FreeBSD 2012-06-23 10:59:53 +05:30
ridiculousfish
f69489a4fc Mostly fix https://github.com/fish-shell/fish-shell/issues/72 2012-06-21 16:58:26 -07:00
ridiculousfish
d34ce26c4e Merge pull request #169 from kballard/git_prompt_docs
Tweak documentation for __fish_git_prompt
2012-06-21 16:34:12 -07:00
Kevin Ballard
3f7fe94009 Tweak documentation for __fish_git_prompt
Add mention of the __fish_git_prompt_color variable.
2012-06-21 11:14:01 -07:00
Kevin Ballard
ae593decfc Replace __fish_git_branch_prompt.fish with __fish_git_prompt.fish
__fish_git_prompt.fish is a complete port of the __git_ps1 function from
git-completion.bash, with the relevant configuration variables changed
and some extra configuration added (namely, control over individual
colors and the status indicator characters).
2012-06-21 11:03:15 -07:00
Emil Eriksson
eea62125a1 Fixes title update in tmux and screen
* Seems that writestr( L"\x1b];" ); doesn't work in tmux and
	  screen. As discussed in fish-shell/fish-shell#47 the 2 was
	  removed. This commit adds the zero (L"\x1b]0;").
	* Tested in screen,tmux,iTerm and xterm.
2012-06-21 10:30:12 -07:00
Emil Eriksson
96f36a63dc Enable window title update when TERM is screen-X
* Uses the same logic as when TERM is
	  xterm-X to enable window-title updates when
	  running in screen.
2012-06-21 10:30:12 -07:00
ridiculousfish
19e183f02f Squashed commit of the following:
commit 5b7659ec3d5e67b8dad8d3543d87a0169dc9a9e9
Merge: 57f3df3 22a4cd6
Author: ridiculousfish <corydoras@ridiculousfish.com>
Date:   Thu Jun 21 10:15:41 2012 -0700

    Merge branch 'master' of https://github.com/maxfl/fish-shell into maxfl-master-base

commit 22a4cd686f
Author: maxfl <gmaxfl@gmail.com>
Date:   Tue Jun 19 15:51:43 2012 +0400

    set now expands the variable size, if index is outside it

commit 9b0ffa8315
Author: maxfl <gmaxfl@gmail.com>
Date:   Mon Jun 18 21:30:44 2012 +0400

    fixes #78

commit 78387fb391
Merge: c0e6096 93dc7d4
Author: maxfl <gmaxfl@gmail.com>
Date:   Mon Jun 18 21:27:47 2012 +0400

    Merge remote-tracking branch 'fishfish/master'

commit c0e60963c1
Merge: 32a98e7 1bead8a
Author: maxfl <gmaxfl@gmail.com>
Date:   Mon Jun 18 10:29:42 2012 +0400

    Merge remote-tracking branch 'fishfish/master'

commit 32a98e799e
Merge: 6e71021 f2b5292
Author: maxfl <gmaxfl@gmail.com>
Date:   Sat Jun 16 18:42:07 2012 +0400

    Merge remote-tracking branch 'fishfish/master'

commit 6e710211bc
Author: maxfl <gmaxfl@gmail.com>
Date:   Thu Jun 14 11:01:13 2012 +0400

    revert fish_pager

commit 731a29f35b
Author: maxfl <gmaxfl@gmail.com>
Date:   Thu Jun 14 10:57:41 2012 +0400

    revert fish_pager.cpp

commit 72c1bfc7bf
Merge: ea74ffa 9b781c4
Author: maxfl <gmaxfl@gmail.com>
Date:   Wed Jun 13 17:54:11 2012 +0400

    Merge branch 'master' into maxfl_completions

commit ea74ffa086
Author: maxfl <gmaxfl@gmail.com>
Date:   Wed Jun 13 17:35:20 2012 +0400

    __fish_complete_command now can understand '--arg=option' tokens
    latexmk completion is updated

commit 45b667826f
Author: maxfl <gmaxfl@gmail.com>
Date:   Wed Jun 13 16:46:47 2012 +0400

    . completion

commit 1c9f8ffc9e
Author: maxfl <gmaxfl@gmail.com>
Date:   Wed Jun 13 16:46:13 2012 +0400

    a lot of new completions

commit 8224d9f984
Author: Maxim Gonchar <gonchar@myhost.localdomain>
Date:   Tue Jun 12 20:19:31 2012 +0400

    A lot of new completions.
    Some small updates and fixes of old functions and completions.

commit 234ed8f5da
Author: Maxim Gonchar <gonchar@myhost.localdomain>
Date:   Tue Jun 12 20:03:44 2012 +0400

    step-coloring initial
    set_color correction
2012-06-21 10:24:49 -07:00