Commit Graph

13 Commits

Author SHA1 Message Date
Eric Freese 50e6832b8c Escape the prefix passed into the match_prev_cmd strategy 2017-01-24 23:06:41 -07:00
Eric Freese 0305908adf Revert `fc` usage in calculating suggestion
As far as I know, `fc` makes it impossible to tell whether history items
used an actual newline character or the string "\n". Pulling from the
`$history` array gives a more accurate representation of the actual
command that was run.
2017-01-24 23:04:07 -07:00
Eric Freese e33eb570c4 Send only the prefix to the suggestion server 2017-01-24 20:01:11 -07:00
Eric Freese 63816c5da8 Fix #164: Use `fc` builtin instead of `$history` array for lookup
According to a few tests, the `fc` builtin appears to be quite a bit
faster than searching through the `$history` associative array when
dealing with large history files (500K+).
2016-06-10 13:52:24 -06:00
Tassilo Horn ca70612d3c Document caveats of match_prev_cmd strategy
This strategy relies on the history being exactly in the order in which
commands have been entered.  Therefore, options like suppressing
duplicates or expiring duplicates first will lead to unexpected
suggestions.
2016-05-28 21:23:35 +02:00
Eric Freese 011d8bdfd1 Refactor to remove prev cmd function and simplify escaping 2016-04-25 14:19:26 -06:00
Eric Freese 46d5fe174d Remove extra newline 2016-03-14 18:02:16 -06:00
Eric Freese a314a01a6a Fix various bugs found while testing 2016-03-14 16:51:27 -06:00
Eric Freese ab0f4c0bd0 Grammar and formatting 2016-03-14 16:51:20 -06:00
Eric Freese ee6dde9ee8 Rename escape command function 2016-03-14 16:51:20 -06:00
Geza Lore 73f774bd5d Add match_prev_cmd strategy.
A new suggestion strategy 'match_prev_cmd' is available. This is a bit
more context aware variaton on the default strategy.
The suggestion will be:
- The newest history entry that matches the current prefix, AND
- Whose preceding history entry also matches the previously executed
command.

See src/strategies/match_prev_cmd.zsh for an example.
2016-03-14 16:51:20 -06:00
Geza Lore 976acc708c Fix default suggestion strategy and add testing 2016-03-14 16:51:20 -06:00
Eric Freese 83f78d0760 Add suggestion "strategy" concept with default strategy 2016-03-14 16:51:20 -06:00