Packages
Packages copied to clipboard
[Bash] Add support for history commands
- Sublime Version: 4079
- OS Version: MacOS 10.15.5
!!
!cmd
!?part of cmd
!?part ?with end trigger
sudo !! # This might depend on #1191
^ehco^echo
History commands are typically disabled in Bash scripts, but text highlighted by the syntax can be non-script. E.g. some Markdown showing sample terminal input.
Look for the packages you have symlinked...
``` sh
ls -l ~/Library/Application\ Support/Sublime\ Text/Packages
```
...then open one of them
``` sh
^ls^subl^/Python
```
What exactly do you expect to be highlighted how? The ! is scoped as history already (on my local patchset).

!! # Good
echo !! # Okay as-is. We could mark `!!` like above, though.
!cmd # Pretty good
echo !cmd # Okay as-is. We could mark `!cmd` like above, though.
!?part of cmd
#^ punctuation.definition.history
# ^^^^^^^^^^^ variable.function? string?
# This is actually a string that will run a function, not the function itself,
# but "feels" like a function in terms of use.
# I usually do `!?cher` to re-run the last `git cherry-pick`, since
# `!git` will run a more recent Git command.
echo !?foo
# ^^^^^ This starts getting weird
echo "!?foo"
# ^^^^^^ And more weird. The closing `"` is part of the history command
!?part ?with end trigger
#^ punctuation.definition.history
# ^^^^^ variable.function? string?
# ^ punctuation.definition.history
echo "!?foo?"
# ^^^^^^ The second `?` fixes the inclusion of `"` in the history command
^ehco^echo
# This one is weird. In a way, the whole thing is a function, but the `^` are
# also punctuation, and the internal text are strings.
# At least this type only appears to be valid as the first character.
^ehco^echo -e^
# This is like a combination of the two above.