An alternative way to jump to specific line (and something else)

Features wanted...
Post Reply
John_C
Posts: 336
Joined: 16 May 2018 20:04

An alternative way to jump to specific line (and something else)

Post by John_C »

When you press :, your input should be redirected to Live Filter Box. Supplement : with line number, press Enter, and you will be moved thither. That is, :15<Enter> - to jump to line 15. (Notice that :line shouldn't activate the normal live filter.)

Also notice the Enter behavior. When you press Enter inside Live Filter Box, your focus should be switched to the previously active area. That is,

Examples 1: You are in the "main" area. That is, in the area with your files. You press :15<Enter>, and it will bring you to live filter box and then back to the "main" area.

Example 2: You are in the tree area. You click the live filter box with mouse, then type something, e.g. txt, and press Enter, and then it will bring you back to the tree.

The described behavior of Enter could be useful even without :line jumping. Currently, pressing Enter in Live Filter Box do nothing.
Last edited by John_C on 08 Apr 2020 01:48, edited 1 time in total.

highend
Posts: 14954
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: An alternative way to jump to specific line (and something else)

Post by highend »

Currently, pressing Enter in Live Filter Box do nothing
Mine does "execute" whatever item (in the list pane) got selected through the live filter.

Btw, it's a live filter box, not a command palette.

What you want can be already easily achieved by using a simple script (apart from the fact that you can't assign it to ":").
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: An alternative way to jump to specific line (and something else)

Post by John_C »

Mine does "execute" whatever item (in the list pane) got selected through the live filter.
Just tested with 20.30 and 20.90. On my system, it is Ctrl+Enter.
Btw, it's a live filter box, not a command palette.
Yeah, I see your point and irony, and I agree that it's not good to mess the things. To show the context switch, it is possible to change the icon from the funnel to the lightning (when you press :), like this one: https://www.shutterstock.com/image-vect ... 725367097/

I don't call it "wishes". It's nothing more than ideas, a part of collaborative brainstorming. I have bad ideas very often.

highend
Posts: 14954
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: An alternative way to jump to specific line (and something else)

Post by highend »

Just tested with 20.30 and 20.90. On my system, it is Ctrl+Enter.
On my system a fresh instance just needs Enter.
and irony
There wasn't any irony involved. It's in its current state just a filtering box...

@Don
A feature request for the rewritten app: A real command palette
It should be a general access thing (which includes the "List all commands" feature) but can also act as a live filter, go to <anything>, etc.
If you'd like some inspiration: Try Visual Studio Code's one!
It's driven with context switches...

The standard when it is opened (it can show recent ones on top, great feature...)
2020-04-08_090739.png

When you're looking for a command
2020-04-08_090933.png

Go to <line> in a file (context = :)
2020-04-08_091013.png
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: An alternative way to jump to specific line (and something else)

Post by John_C »

Another implementation of similar idea could be seen in Vim. For example,

* to move to line 15: 15G. It will be executed in the background.
* to set/unset word wrap: :set wrap and :set wrap!. It will be executed using the command line.

One difference between Vim and Visual Studio Code (or between Vim and Sublime Text) is that you don't have drop-down menu that overlaps the screen. That is, it's a little more hardcore, but less distracting.
What you want can be already easily achieved by using a simple script (apart from the fact that you can't assign it to ":").
I know about ::sel <number>; focus;, but I don't understand how to bind it to the shortcut so that it will work for an arbitrary line like 5, 10, or 100. In case it's not time-consuming, I would be appreciated for code or directions.

This is what I use for myself, an awkward workaround with AutoHotkey:

Code: Select all

; <number>G - to move to line <number>.

#SingleInstance, Force

ExecuteXYplorerScript(Script) {
    Run, % A_ProgramFiles . "\XYplorer\XYplorer.exe /script="
           . """" . "::" . Script . """" . A_Space . "/flg=2"
}

#If, WinActive("ahk_exe XYplorer.exe")

; Continue it yourself: 3, 4, 5, etc. From lesser numbers (alow)
; to greater ones (atop). Works with 15, 20, 100 as well.
; To disable case sensitivity, remove C.
:C*?B0:2G::
    ExecuteXYplorerScript("sel 2; focus;")
Return
:C*?B0:1G::
    ExecuteXYplorerScript("sel 1; focus;")
Return

#If
A feature request for the rewritten app
Don is going to rewrite it?
Last edited by John_C on 08 Apr 2020 10:39, edited 1 time in total.

highend
Posts: 14954
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: An alternative way to jump to specific line (and something else)

Post by highend »

Nobody said that you're be able to use any vim techniques in XY -> No fancy stuff like 15G as a keyboard binding

viewtopic.php?f=3&t=21626

The simplest of all scripts (that can be invoked by any hotkey that XY provides) to go to a specific line in the list view:

Code: Select all

    $fc = get("FocusedControl");

    if ($fc == "L") {
        $line = input("Enter line number", , "1");
        $cnt = get("CountItems");
        if ($line <= 0) { $line = 1; }
        elseif ($line > $cnt) { $line = $cnt; }
        sel $line;
    }
Took one minute...
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: An alternative way to jump to specific line (and something else)

Post by John_C »

Surprising. I love this app, I hope nothing bad will happen.

Code: Select all

    $fc = get("FocusedControl");

    if ($fc == "L") {
        $line = input("Enter line number", , "1");
        $cnt = get("CountItems");
        if ($line <= 0) { $line = 1; }
        elseif ($line > $cnt) { $line = $cnt; }
        sel $line;
    }
It gives an overlapping window (this is what I tried to avoid) and hence I don't see a big difference with the default Ctrl+Shift+L shortcut...

Post Reply