Giter VIP home page Giter VIP logo

Comments (10)

iamqiz avatar iamqiz commented on June 14, 2024

@chrisant996 hello, is there a setting to ignore leading spaces of doskey alias ?

from clink.

chrisant996 avatar chrisant996 commented on June 14, 2024

No. Doskey aliases are never expanded with a space before them.

Not by CMD.exe, not by Clink, not by the Windows OS.

from clink.

iamqiz avatar iamqiz commented on June 14, 2024

a workaround to strip leading spaces in current line is to
define a key bind in .inputrc :

"\e[27;8;65~":set-mark
"\e[27;8;66~":clink-forward-bigword
"\e[27;8;67~":kill-region
"\e[27;8;68~":end-of-line
"\e[27;8;69~":beginning-of-line

"\C-g\C-f":"\e[27;8;69~\e[27;8;65~\e[27;8;66~\e[27;8;67~\e[27;8;68~"

then use ctrl+g ctrl-f to delete leading spaces.
(\e[27;8;65~ mean ctrl+shift+alt+a , \e[27;8;66~ mean ctrl+shift+alt+b ,and so on
\C-g\C-f do these action: beginning-of-line > set-mark>clink-forward-bigword >kill-region > end-of-line
)

@chrisant996 will you consider to create a command such as clink-delete-leading-space to do that? ๐Ÿฅฐ

from clink.

chrisant996 avatar chrisant996 commented on June 14, 2024

will you consider to create a command such as clink-delete-leading-space to do that?

Why would it be needed?

  1. It seems you've already accomplished what you wanted, using the tools already available.
  2. It's confusing why a mechanism to strip leading spaces is desired -- why insert the spaces in the first place, if the intent is to remove them?

from clink.

iamqiz avatar iamqiz commented on June 14, 2024

@chrisant996 sometimes the leading spaces will be insert by users accidently;
someone hope terminal allow leading space,
clink-delete-leading-space maybe be useful for them (i guess)

from clink.

chrisant996 avatar chrisant996 commented on June 14, 2024

@chrisant996 sometimes the leading spaces will be insert by users accidently;
someone hope terminal allow leading space,
clink-delete-leading-space maybe be useful for them (i guess)

If spaces were instead accidentally, then the user probably isn't aware that spaces were inserted, and they probably won't press a special key to remove them.

Input line coloring will typically help make it clear when an alias will not be expanded.

Windows doesn't expand aliases when preceded by a space. This is generally considered a feature, so that you can prevent using an alias. For example if you have an alias dir that executes for example eza or dir /w. Then inserting a space lets you still be able to run literally dir when you need to.

from clink.

chrisant996 avatar chrisant996 commented on June 14, 2024

(Also, the issue you cited from the terminal repo says a leaving space is meant to bypass expanding a doskey aliases, but there was a bug where it accidentally didn't. The bug was fixed a few years ago. I'm not sure why that issue was cited. It seems to agree with what I've been saying.)

from clink.

iamqiz avatar iamqiz commented on June 14, 2024

@chrisant996 ๐Ÿ˜‚sorry, it is my mistake๐Ÿ˜‚
thank you for your patient explanation.
you let me realize i misunderstood that issue's intention, ๐Ÿ˜‚ because the word "bypass" is understood as "allow" by me๐Ÿ˜‚ forgive my poor english๐Ÿ˜‚
the example dir alias you mentioned above is really a common use case, for me, i want to use cd as a alias to cd /d.
i also realize why clink allow to use a leading semicolon :
Clip_2024-04-10_06-58-35

a printable leading char is better than a space to bypass doskey alias ๐Ÿ‘

from clink.

chrisant996 avatar chrisant996 commented on June 14, 2024

Try starting cmd.exe without Clink.

You will find that in cmd.exe doskey aliases are not expanded if they are preceded by a space or semicolon (or several other kinds of punctuation characters).

The only part that's new in Clink is that by default a space prevents adding the command to history. And that is controllable by the Clink setting that you found.

So it seems like you're asking me to change how cmd.exe and Windows and the ReadConsole system API work, and make it behave different from how it's meant to behave. The stated motivation for such a change doesn't seem compelling.

I'm not going to do that. It would create even more confusion, and would break some workflows, and would make troubleshooting and support even harder.

from clink.

iamqiz avatar iamqiz commented on June 14, 2024

@chrisant996
i have tried it, you are right!

i no longer hope clink or cmd.exe to remove leading space , i realized that keeping it is meaningful

from clink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.