Columns managed by Search Function in Macros

Discussion related to "Everything" 1.5 Alpha.
Post Reply
runmode
Posts: 34
Joined: Sat May 27, 2023 11:22 pm

Columns managed by Search Function in Macros

Post by runmode »

I'm going to present a method for managing columns by the search function
columns:
used in macros, which has key advantages over doing it with the search command
/colums:
used in multi-line bookmarks, which I have seen in previous discussions dealing with colums. I want to help others avoid empty miles. Finally I will ask @void to add a few functions, to top off the toolbox for this method.

The purpose of column control is to maintain result views which can be bound to bookmarks, together with the search. Whether you search for documents, pictures, music, recent files or sidecar files, etc., the result gets displayed in a proper way you want it.

Steps to achieve this:

1. Create a macro with the search function for the layout
The search command
/define name=search
creates a macro. A search command is permanent until changed.
Example:
/define layout1=columns:[{"name":"Name","width":350},{"name":"Path","width":350}]
.

Use bookmarks to set and edit macro definitions, which works as a macro editor:
bookmark name: /define layout1
bookmark search:
/define layout1=columns:[{"name":"Name","width":350},{"name":"Path","width":350}]

You can organize all bookmarks with macro definitions in a bookmark folder.

2. Create a bookmark for your search that also calls the macro
Example: search for text files
bookmark name: Text files
bookmark search:
layout1: ext:txt


Advantages of
columns:
in a macro:

1. Set the column layout temporarily for the search avoids to restore the default layout:

The search function
columns:
is active only for the current search, compared to the search command
/columns
which is permanent until changed.
The search function leaves the default layout unchanged, so there is no need to restore the default columns afterwards, which is the issue discussed here: viewtopic.php?t=15288. One reason why the search command was featured in the foregoing discussions might be that multi-line searches accept only search commands but no search functions.

2. Avoid code redundancies in multiple bookmarks, and save space in the search bar

Macros are the one and only way to re-use the column setting in multiple bookmarks, for different searches with the same column layout.

At time of my tests (Version 1.5.0.1408a) this cannot be achieved with filters, because filters work only with the simple column command
columns:name;path;...
, but not with JSON arrays
columns:[{"name":"Name","width":350},{"name":"Path","width":350},...]
. Also nested bookmarks don't work with
columns:
in the search.

A multi-line search as seen in previous discussions have the advantage of hiding the column definition from the search bar, but the downside that they accept only search commands, which means the same search command must be written to all these bookmarks in a redundant way.

3. Macros can be nested,
so it is possible to organize columns: and custom columns in separate macros as well as other temporary layout settings and combine that in a structured way.

Example which shows the last path segment in a column "Folder":
/define mlayout1=columns:[{"name":"Column A","width":500},{"name":"Name","width":500},{"name":"Path","width":40}]

/define mcolumna=a-label:="Folder" a:=regexextract($path:,"\\([^\\]*)$")

/define mlayout2= mlayout1: mcolumna: preview: ?path:

bookmark search:
mlayout2:

Keep macro names short, to minimize the space occupied in the search bar. Macro names are case sensitive.

Finally, my wishlist @void:

- A search function
right_sidebar_wide:
(equivalent to existing search command
/right_sidebar_wide
). In the example above preview: is not Everything.

- A search function
column_colors:
(equivalent to existing INI setting
column_colors
). In the example above I would like to highlite the Path column.

- A key + left mouse to open the path instead of launching the file (this most likely exists and I don't know it). In addition to Open Path in the right mouse context menu which is not so fluent. In the example above I wouldn't need to dedicate space to the path column.

- A search function
tab_colors:
to assign a color to the tab title (but preferably the background color). The idea is that a bookmark assigns a specific color to the tab it is running within, and when many tabs stay open the bookmark is easy to find. I often run into the problem that I close tabs which I need frequently because I cannot tell from the title which bookmark search is hosted thereunder and changing the tab title doesn't do the job.

- Generally, all layout settings should have a search function version for a temporary effect.

- A way to list all macro names defined in "true" macros and also macro names defined in filter/bookmarks, to avoid and track down conflicts. Currently /define does not list macro names set in filters and bookmarks.

Thank you for Everything!
void
Developer
Posts: 19665
Joined: Fri Oct 16, 2009 11:31 pm

Re: Columns managed by Search Function in Macros

Post by void »

I have added to my TODO list:

add a right_sidebar_wide: search function to temporarily set the sidebar widths.
add a column_colors: search function to temporarily set column colors like the column_colors INI setting.
add a tab_color: search function to temporarily set the tab color.

Thank you for the good suggestions.


- A key + left mouse to open the path instead of launching the file (this most likely exists and I don't know it). In addition to Open Path in the right mouse context menu which is not so fluent. In the example above I wouldn't need to dedicate space to the path column.
Ctrl + double click is too finicky as it will toggle the selection.
Shift + double click is too finicky as it will extend the selection.
Alt + double click is currently hard coded as Properties.
I will consider an option to override Alt + Double click to open the path.
For now, please try Ctrl + Enter.
Post Reply