Skip to content

Commit bb357bf

Browse files
committed
Added function overriding TAB to provide completion of vars before a closing " (closes #1)
1 parent 27c449b commit bb357bf

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

functions/_pisces_tab.fish

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function _pisces_complete -d "Invokes complete with modification for vars before a closing double quote"
2+
3+
if commandline --paging-mode
4+
down-or-search
5+
else
6+
set token (commandline -t)
7+
# checking that the current token ends on a $var + '"'
8+
if [ (string match -r '\$.*"$' "$token") ]
9+
commandline -f delete-char # which is '"'
10+
end
11+
commandline -f complete
12+
end
13+
end

key_bindings.fish

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ function key_bindings
1111
bind \b _pisces_backspace
1212
# Terminal.app sends DEL code on ⌫:
1313
bind \177 _pisces_backspace
14+
15+
# overrides TAB to provide completion of vars before a closing '"'
16+
bind \t _pisces_complete
1417
end

uninstall.fish

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ for pair in $pisces_pairs
44
end
55
end
66

7-
bind \b backward-delete-char
7+
bind \b backward-delete-char
88
bind \177 backward-delete-char
9+
bind \t complete
910

1011
set -e pisces_pairs

0 commit comments

Comments
 (0)