Skip to content

Commit

Permalink
Added function overriding TAB to provide completion of vars before a …
Browse files Browse the repository at this point in the history
…closing `"` (closes #1)
  • Loading branch information
laughedelic committed May 13, 2016
1 parent 27c449b commit bb357bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions functions/_pisces_tab.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function _pisces_complete -d "Invokes complete with modification for vars before a closing double quote"

if commandline --paging-mode
down-or-search
else
set token (commandline -t)
# checking that the current token ends on a $var + '"'
if [ (string match -r '\$.*"$' "$token") ]
commandline -f delete-char # which is '"'
end
commandline -f complete
end
end
3 changes: 3 additions & 0 deletions key_bindings.fish
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ function key_bindings
bind \b _pisces_backspace
# Terminal.app sends DEL code on ⌫:
bind \177 _pisces_backspace

# overrides TAB to provide completion of vars before a closing '"'
bind \t _pisces_complete
end
3 changes: 2 additions & 1 deletion uninstall.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ for pair in $pisces_pairs
end
end

bind \b backward-delete-char
bind \b backward-delete-char
bind \177 backward-delete-char
bind \t complete

set -e pisces_pairs

0 comments on commit bb357bf

Please sign in to comment.