2

I encountered an unexpected behavior while using Clink in my terminal. My system is Windows 10.0.18363. When I type:

(venv) C:\marat\programs\BASE\MiriadRobot>!p

... Before I even press Enter, !p gets highlighted, and the following text appears below (py is the last command starting with p that I used):

History expansion for "!p": py

Here is a screenshot for reference.

When I press Enter, the executed command shows that !p has been replaced with py. Running clink history confirms this:

  500  2025-01-22 08:16:42  py

However, if after exclamation sign i type the letter that hasn't been used in commands before, nothing is highlighted and nothing is replaced.

Picture, where nothing is highlighted

If I run clink history I see that nothing was replaced:

  502  2025-01-22 08:37:13  !b

How does it work and how can I disable this behaviour?

Destroy666
  • 12,350
Kitaram
  • 23

1 Answers1

1

As the message states, you are using history expansion feature. Which, as the name suggests, expands the command based on your history - in this case based on the first word, seems like you have not used any commands starting with b yet, so there's no recent one to pick.

To disable it:

If these are undesirable, they can be turned off by running clink set history.auto_expand off or clink set history.expand_mode off.

Especially history.expand_mode setting is what you should be interested in.

Destroy666
  • 12,350