Page 1 of 1
An alternative way to jump to specific line (and something else)
Posted: 08 Apr 2020 01:31
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.
Re: An alternative way to jump to specific line (and something else)
Posted: 08 Apr 2020 01:47
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 ":").
Re: An alternative way to jump to specific line (and something else)
Posted: 08 Apr 2020 02:09
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.
Re: An alternative way to jump to specific line (and something else)
Posted: 08 Apr 2020 09:08
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
Re: An alternative way to jump to specific line (and something else)
Posted: 08 Apr 2020 10:18
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?
Re: An alternative way to jump to specific line (and something else)
Posted: 08 Apr 2020 10:36
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...
Re: An alternative way to jump to specific line (and something else)
Posted: 08 Apr 2020 11:04
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...