Bash's powerful command line editing in cmd.exe
GPL-3.0 License
Published by chrisant996 9 months ago
Features:
@
are supported, and completion correctly ignores the @
.&
or @2>
, and lines containing & &
or 2>&file
.2>file
or >file
or 2>&1
are colored instead of only the >
or >&
.clink set
color settings include a color sample in the description field (e.g. type clink set color
Alt-= to see the color settings and their current color samples).clink-reload
bindable command now reverts key bindings and config variables before reloading the inputrc file, so that old bindings and values don't linger in the current session if they've been removed from the inputrc file.clink-dump-functions
and clink-dump-macros
bindable commands. These behave similar to dump-functions
and dump-macros
, but they show user-friendly key names and luafunc:
macros are listed as functions instead of as macros.clink-backward-bigword
, clink-forward-bigword
, cua-backward-bigword
, cua-forward-bigword
.$if clink_version
in the inputrc file (e.g. $if clink_version >= 1.6.1
).prompt.spacing
setting which can control blank lines before the prompt (it was a clink-flex-prompt feature which has now been incorporated into Clink itself).match.coloring_rules
setting and %CLINK_MATCH_COLORS%
environment variable, both of which supersede Readline's %LS_COLORS%
definitions when displaying match completions.Lua:
line_state:getrangeoffset()
and line_state:getrangelength()
to get the beginning offset and length of the range in the input line described by the line_state.console.explodeansi()
to split a string into substrings on ANSI escape code boundaries.rl.getinputrcfilename()
to get the loaded inputrc file name.rl.translatekey()
to translate between key sequence formats (input key, key binding, and friendly key name).rl.bracketpromptcodes()
to apply \1
and \2
codes as needed by Readline in certain inputrc config variables.CLINK_EXE
global variable which has existed since v1.0.0 but was accidentally undocumented.Fixes:
;39
and/or ;49
from color setting escape codes in some cases.console.readinput()
repeatedly returning nil after console.checkinput()
returns true (regression introduced in v1.5.12).default_inputrc
file if it exists (introduced in v1.3.5, and it never worked properly until now).history-size
config variable to be completely ignored (it interfered with Clink's history database and settings, which were meant to supersede it).clink-popup-show-help
command when including unbound commands (numeric argument of 4) so it doesn't double-list the bound luafunc:
macros.clink.popuplist()
when Del is pressed (e.g. history timestamps in the clink-popup-history
command).clink.popuplist()
to take the title into account.rl_buffer:setcursor()
.console:getnumlines()
between onendedit and onbeginedit.clink set
(e.g. --help
).clink-reload
command so any inputrc file parse errors are printed on new lines.lua.break_on_error
setting so it works properly in released builds of Clink.Published by chrisant996 11 months ago
abc!$!$
).fetch-history
bindable command that retrieves the history entry corresponding to its numeric argument. Negative arguments count back from the end of the history.enable-active-region
. This separates control of the active region and bracketed-paste. It has the same default value as bracketed-paste
, and enabling bracketed paste enables the active region. Users can now turn off the active region while leaving bracketed paste enabled.%LS_COLORS%
for a custom filename extension (*.readline-colored-completion-prefix
) and uses that as the default color for the common prefix displayed when colored-completion-prefix
is set, superseding the so
type if both are present.active-region-start-color
and active-region-end-color
. The first sets the color used to display the active region; the second is unused and unnecessary in Clink, but exists anyway for compatibility. If set, these are used in place of terminal standout mode.unix-filename-rubout
that caused it to delete too much when applied to a pathname consisting only of one or more slashes.\r
output by turning off bracketed paste to overwrite the line if terminal echo was disabled.transpose-words
could corrupt the end of the input line.blink-matching-paren
setting works in Clink now.\\server\share
, not server names like \\server
).os.enumshares()
to enumerate the SMB UNC shares on a given server.autosuggest.hint
setting where it could apply incorrect input line coloring when the Right key isn't bound to one of the usual commands for that key.Published by chrisant996 11 months ago
Published by chrisant996 11 months ago
_argmatcher:addarg()
or _argmatcher:addflags()
is passed a table containing nowordbreakchars="chars" then the chars are not treated as word breaks for that argument index or for flags (see Overcoming Word Breaks for more information).user_data
argument to the custom classifier function for an argmatcher (set via _argmatcher:setclassifier()
).clink set
so that color.unexpected
is only used for a completed word that isn't a match.io.stdin:read()
).clink inject
if an explicit or implicit endlocal
happens after clink inject
but before the prompt is shown (the injection didn't finish successfully until the next time an environment variable was set, but now it finishes immediately).Published by chrisant996 11 months ago
color.suggestion
based on the current console colors.:chaincommand()
so that generators and classifiers that come after argmatchers in the priority order receive the same line_state
objects as ones that come before argmatchers in the priority order.:setdelayinit()
with linked argmatchers; the callback function was only called for registered argmatchers (e.g. clink.argmatcher("foo"):setdelayinit(func)
) and it wasn't called for linked argmatchers (e.g. "-x" .. clink.argmatcher():setdelayinit(func)
).loopchars
for characters like -
or *
that are also Lua pattern characters.Published by chrisant996 11 months ago
cmd
, cd
, and rd
.console.getcolortable()
which returns a table with the console's current 16 predefined colors. When possible, the table includes a field indicating whether the current console color theme is a light or dark theme.color.suggestion
so that it attempts to detect light themes (bright background colors) when possible, and it attempts automatically choose a default color for suggestions that is faint but has sufficient contrast to be readable.onlink
callback function in :addflags()
so that the arg_index
parameter is correctly 0
instead of 1
.console.getlinetext()
when emoji are present.Published by chrisant996 11 months ago
autosuggest.hint
setting.onadvance=your_callback_function
in the table given to :addarg()
(see Responding to Arguments in Argmatchers for more information).:chaincommand()
function (e.g. an alias foo=sudo dir $*
with an argmatcher like clink.argmatcher("sudo"):chaincommand()
so that completions and input line coloring work properly for the rest of the input line).exec.commands
setting with an argmatcher that uses the :chaincommand()
function._argmatcher:setclassifier()
so the custom classifier is called for flags as well as for arguments.Published by chrisant996 12 months ago
clink.onhistory()
to register a function to be called when the input line has been accepted and is about to be added to history (and optionally cancel adding it).history delete
with a negative number so it indexes backwards from the end, as advertised.clink.refilterprompt()
from a coroutine, and related fixes to ensure various Lua functions coexist properly with coroutines.Published by chrisant996 12 months ago
clink-popup-history
or win-popup-history
(regression introduced in v1.5.3; the fix in v1.5.4 was incomplete).console.checkinput()
so it doesn't eat whatever pending input it detects.Expand-Archive
cmdlet.Published by chrisant996 about 1 year ago
color.executable
and color.unrecognized
are both empty (regression introduced in v1.5.10).Published by chrisant996 about 1 year ago
clink update
to consider "up-to-date" as a successful case.completion
auto-suggest strategy could be temporarily prevented from providing a suggestion (regression introduced in v1.4.22).!
doesn't need to be treated as a word break character.Published by chrisant996 about 1 year ago
clink-popup-history
.match.max_rows
setting to control the number of rows of items (instead of the total number of rows including description rows).clink-popup-history
if history.time_stamp
is off
(regression introduced in v1.5.7).Published by chrisant996 about 1 year ago
Published by chrisant996 about 1 year ago
clink-select-complete
and in popup lists.terminal.scrollbars
setting which can disable the vertical scrollbars (e.g. according to preference, or if a terminal or font is incompatible with extended Unicode box drawing characters).clink set --info
flag.clink info
.-- More --
pager prompt (the enhancements were accidentally lost in v1.1.1-alpha).rl.getmatchcolor(match, type)
; when the optional type
parameter was passed in, the API could crash.autosuggest.enable
is False, cycling or searching through history and then pressing Right does nothing.Published by chrisant996 about 1 year ago
os.getpushddepth()
, which works when %PROMPT%
contains exactly one $+
.clink-popup-history
and win-history-list
commands show timestamps when history.time_stamp
is set to show
.os.geterrorlevel()
when cmd /u
was used.rl.getkeybindings()
if it's called by a Lua script running inside clink set
.clink set
.clink-select-complete
where typing to narrow the list to a single item accidentally made the column width at least 3 characters, even if the item was only 1 or 2 characters width.clink history
to handle escape codes embedded in the history.time_format
setting.remove-history
at the beginning of the history list.unicode.fromcodepage()
(reported and fixed before the bug was published).clink-select-complete
displays the selected item incorrectly if both colored-stats
and colored-completion-prefix
are off
(regression introduced in v1.5.5).Published by chrisant996 about 1 year ago
clink.autoupdate
setting to allow off
, check
(the default), prompt
, and auto
for more control over how and when updating happens. When set to prompt
or auto
Clink can trigger updates automatically, so you don't need to even run clink update
.debug.log_terminal
to include low level console keyboard and mouse input events.debug.log_terminal
to capture all input (regression introduced in v1.5.2).clink-select-complete
while typing, caused by excessive match generation.clink-select-complete
when the whole match text has been typed.Published by chrisant996 about 1 year ago
arginfo
field in builder:addmatches()
and in match display filtering.clink-popup-history
or win-popup-history
(regression introduced in v1.5.3).old-menu-complete
and menu-complete
when there's only one match. The first time it should insert the match, and subsequent times should ding instead of cycling through the same match over and over and requiring an equal number of undo
to undo.match.substring
setting.files.system
setting.clink-select-complete
is used in a session.undo
were required to fully undo what menu-complete
inserted.non-incremental-reverse-search-history
or non-incremental-forward-search-history
finds an exact match for the search text (since v1.1.5).Published by chrisant996 about 1 year ago
builder:setfullyqualified()
to force completions to be inserted as fully qualified path names.completions\
directory if the associated command exists in the file system. Also, pass the fully qualified file name as input to the script (in Lua, use ...
to get script arguments, e.g. local command = ...
).clink info
now reports whether Clink is injected.doskey.enhanced
setting is off or when doskey macro expansion is suppressed.line_state:getwordinfo()
to accurately set the .alias
field when the doskey.enhanced
setting is off or when doskey macro expansion is suppressed.clink.filematches(nil)
and clink.dirmatches(nil)
; they were meant to behave the same as passing an empty string.Published by chrisant996 about 1 year ago
clink.popuplist()
when the current
argument is past the end of the list of items.Published by chrisant996 over 1 year ago
rl.getcommandbindings()
to get info about a command, including the key(s) bound to it, if any.clink.popuplist()
inside a function registered by clink.onfiltermatches()
.ENABLE_VIRTUAL_TERMINAL_INPUT
since it interferes with input (especially Ctrl key combinations) and some console programs set it but accidentally neglect to clear it when they're finished.