Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Is there any way to integrate zoxide with TCC as it works with Bash, Zsh, etc?

Aug
185
5
One of the "holes" in my Windows terminal experience is the place occupied by zoxide, a fabulous directory changing utility I use regularly on Linux and macOS. I can get it working just fine with PowerShell, but I've struck out trying to make it work with TCC. Can anyone speak to how I might integrate it similarly to how it works with Bash, Zsh, etc.? Thanks!
 
Please tell us how it works. I can't imagine anything better than TCC's many ways to facilitate directory changes.
 
I frankly don't understand the masochism of those sticking to bare command prompt, when there are console file managers with much better experience.
 
I'm not familiar with zoxide, but I suspect the Windows version probably reads line input (like CMD and Powershell) and not character input like TCC. If so, you can make it work with an .INI directive (though you may not want to given the disadvantages). From the TCC help (Advanced INI directives):

ReadConsole=NO | yes

If YES, TCC will use the Windows ReadConsole API (like CMD.EXE) to read its line input. If you set ReadConsole=Yes, then you will lose all of the TCC line editing features. Windows will pass the line back to TCC for processing when you press Enter. This option is intended for users who have an extensive editing setup using something like CLink and don't want to convert everything over to the TCC format.
 
ut I suspect the Windows version probably reads line input (like CMD and Powershell) and not character input like TCC. If so, you can make it work with an .INI directive (though you may not want to given the
Please tell us how it works. I can't imagine anything better than TCC's many ways to facilitate directory changes.
I'll have to do some digging to get back to you both. But I can say this in response to vefatica, that part of it is the way it handles history and fuzzy finding. The tool keeps a database of prior directories you've visited and applies some sort of popularity-sorting algorithm. Consider the following example directory specifications in which the capital letters are shorthand for much longer names:
C:\A\B\C\D\E\F
D:\E\G\H\B\I
Note well that some of the terms re-occur as one might imagine for various reasons. I find it especially common when working on source code, for example, when every web project has an img subfolder or css subfolder or things like that. TCC does indeed give me many tools for changing to those folders. I can rely on the history for the command line, assuming I've changed to those directories recently, but of course that "fades" over time when you hit the command history limits. I can outright use the fuzzy searching options built into TCC with a database of folders once I've created/updated it using the cdd /s command. But of course that database goes "stale", and the text searching isn't as convenient as zoxide. And of course maybe the ultimate tool is the lovely aliases system, which I've tried to use in the past but always end up struggling to keep either my aliases up to date with the folder structure or can't rely on my fading memory :/

Using zoxide, I can change to the very deeply nested 'I' directory immediately via the z I command because it's unique. I can use a part of the name to get there as well, depending in part on the database it builds and maintains which is apart from the command-line history and doesn't go away over time/use. I don't have to use the '\' key and type all the separators. I can uniquely specify a subfolder even deeply nested like 'E' above (which isn't unique itself) by z D E or some part of those names. It's a tool like fzf that does one thing and does it really well, and once you get used to it there's also a certain amount of muscle memory involved.
 
I frankly don't understand the masochism of those sticking to bare command prompt, when there are console file managers with much better experience.
I type at 160 WPM. I usually find I can execute even complicated file operations with the tool set I have at the command prompt, or inside a terminal inside my preferred programming editor (Neovim these days), far faster than anyone can reach a mouse, open an Explorer window, click-click-clickety-click-click to get to the first folder, then click the file, then choose the operation, then click-click-clickety-click-click to get to the destination, etc. You get the idea no doubt.

Part of it as well is that with as much time as I spend working at the computer, the less I use the mouse the less my wrists hurt from the stress/strain of repetitive mouse usage. Ergonomics go only so far with that, and typing at a keyboard is much easier on the body. And another less easily defined factor is the "flow" or sense of being "in the zone" when you're working a programming problem in an editor/terminal, which is easily maintained when you stay in those tools but can be broken reaching for the mouse. It's not masochism, it's a natural consequence of being a power-user/nerd for as long as I have been. The GUI is the masochism from where I'm at.
 
I second that comment and would turn the earlier comment around: Why would you use TCC/TCMD if you are satisfied working with a mouse. I think most of us here use TCC/TCMD because we generally hate using the mouse (though it's fine when editing in Word or a text editor or working in a browser).
 
I second that comment and would turn the earlier comment around: Why would you use TCC/TCMD if you are satisfied working with a mouse. I think most of us here use TCC/TCMD because we generally hate using the mouse (though it's fine when editing in Word or a text editor or working in a browser).
Thanks for the support, though I suppose I should point out that I don't hate the mouse. I just find it a lot less productive for a lot of tasks. But I do still use the mouse quite a bit for graphics programs, music applications, gaming, etc.
 
Yes, I was being dramatic. I also use the mouse inside application programs. I hate to use it for executing application programs or for doing maintenance or utility tasks. Searching for the right folder using the mouse is a real nuisance -- and makes me wish that file managers, including the popups for saving or opening a file, would support directory aliases. (Do I remember correctly that even the TCMD file manager does not recognize aliases?)
 
Yes, I just verified that the TCMD file explorer does not recognize directory aliases. I can enter a real path and change to it:

1733701061122.webp


But if I enter a directory alias, it is ignored:

1733701088086.webp


I can use the CDD /TO command to change the explorer folder to a named directory, but this is more cumbersome than just entering it directly into the explorer.
 
Yes, I just verified that the TCMD file explorer does not recognize directory aliases. I can enter a real path and change to it:

View attachment 4740

But if I enter a directory alias, it is ignored:

View attachment 4741

I can use the CDD /TO command to change the explorer folder to a named directory, but this is more cumbersome than just entering it directly into the explorer.
I believe my workaround for that issue was using the command line cdd with the /t argument, which lets me use my aliases but then syncs the TCMD file explorer to the resulting folder.
 
As I wrote in my earlier message, one can use the /TO option with CDD to change only the file explorer folder. The /T option changes the current folder in TCC at the same time, which one may not want to do. I have the alias "dot" defined to update the explorer to the current directory.

cdd /to %_cwd

I guess I could make another alias with CDD to change the explorer directory, but it would be much more natural if one could do it right in the explorer window.

To make some of my application programs work with directory aliases, I often launch them with an alias that invokes a batch file that expands the file names on the command line using the %@full[] function. For example, for my macro text editor, VEDIT, which takes a list of the files to open on the command line, the batch file code vedit.btm includes:

set commandstring="c:\Program Files (x86)\vedit\vpw.exe"

iff %# GT 0 then
do ifile = 1 to %#
set commandstring=%commandstring %@quote[%@full[%[%ifile]]]
enddo
endiff

start /pgm %commandstring

Each file name is expanded and quoted if necessary.

This would fail if I included any command-line switches. For the few times I do that, I just have to remember to invoke the command as vpw instead of as vedit. If that proved to be a real problem, I'd just add code to the batch file to detect switches and pass them as-is.

Of course, now as I'm writing this message, I can see a simpler way to code that script and to deal with option switches (the code has lost its indentation for some reason).

@echo off
setlocal

set commandstring="c:\Program Files (x86)\vedit\vpw.exe"

do %#

iff %@left[1,%1] EQ / then
:: let option switches through
set commandstring=%commandstring %1
else
:: expand file names
set commandstring=%commandstring %@quote[%@full[%1]]
endiff

shift

enddo

start /pgm %commandstring
 
Not for me. I put a directory alias (e.g., fin:) into the "Folder:" field and hit ENTER. The folder did not change in the explorer. The "Filter:" field works. The folder box works only with DOS paths.
 
Not for me. I put a directory alias (e.g., fin:) into the "Folder:" field and hit ENTER. The folder did not change in the explorer. The "Filter:" field works. The folder box works only with DOS paths.
Works for me in the folder box FWIW. I'm using version:

TCC 33.00.20 x64 Windows 11 [Version 10.0.22631.4602]
TCC Build 20 Windows 11 Build 22631
 
Hmmm. I just checked again. Here's my version info.


TCC 33.00.20 x64 Windows 10 [Version 10.0.19045.5247]

Here's where I started in the explorer:

1734641264357.webp


I opened the VIEW menu and entered "sme:" in the folder field.

1734641332353.webp


Nothing changed in the explorer. Nor did anything change when I picked other directory aliases (that I had tried previously) from the drop down list.

Here's the alias definition:


When I enter "d:\sme\" in the folder selection box, the explorer window does change.

I wonder if there is some setting that has turned off this feature. I can't imagine that I would have changed it from the default.
 
I just tried it on my Windows 11 laptop, and I see the same behavior.

I also see something else that is very annoying. The explorer display has a blank line between each pair of entries, which greatly reduces the amount of information that can be seen. Does anyone know how the line spacing can be configured? Of course, I see the same thing if I open the Windows Explorer outside of TCMD (confirming what Rex wrote earlier that the explorer in TCMD is just the Windows program displayed inside TCMD).

Given the above observation, Rex, is there a way that you could add the folder and filter boxes in a window that could be kept open with the explorer? It's also not clear how the filter is implemented. In the "Search Results in" area at the top of the explorer window, I can enter standard paths but not the "&filter" part. I can't find any way to filter in the Windows Explorer.
 
That is interesting. So for sake of testing, I defined a new directory alias dbox:=%userprofile%\Dropbox and used it first at the command line (as you'll see in the screenshot) and when entering it in the folder filter it expands properly as you'll see below.
 

Attachments

  • 2024-12-19 13_22_09-TC 33.0 - TCC Prompt.webp
    2024-12-19 13_22_09-TC 33.0 - TCC Prompt.webp
    39.7 KB · Views: 7
In your screenshot, I see the regular DOS path in the folder selection box, not the directory alias. Are you doing something to expand the alias to its definition?
 
In your screenshot, I see the regular DOS path in the folder selection box, not the directory alias. Are you doing something to expand the alias to its definition?
Sorry, what I do is type it into the box and hit the enter key, so in this case I typed dbox: and hit enter to have it expand. Does that make more sense?
 
Not for me. I put a directory alias (e.g., fin:) into the "Folder:" field and hit ENTER. The folder did not change in the explorer. The "Filter:" field works. The folder box works only with DOS paths.

Are you using global aliases? If you have local aliases in TCC and/or you're not using SHRALIAS, then Take Command won't see the aliases.
 
I just tried it on my Windows 11 laptop, and I see the same behavior.

I also see something else that is very annoying. The explorer display has a blank line between each pair of entries, which greatly reduces the amount of information that can be seen. Does anyone know how the line spacing can be configured? Of course, I see the same thing if I open the Windows Explorer outside of TCMD (confirming what Rex wrote earlier that the explorer in TCMD is just the Windows program displayed inside TCMD).

Given the above observation, Rex, is there a way that you could add the folder and filter boxes in a window that could be kept open with the explorer? It's also not clear how the filter is implemented. In the "Search Results in" area at the top of the explorer window, I can enter standard paths but not the "&filter" part. I can't find any way to filter in the Windows Explorer.

The folder & filter comboboxes are part of the Take Command ribbon. You can keep the ribbon open by unselecting "Minimize Ribbon" in the View menu.
 
Are you using global aliases? If you have local aliases in TCC and/or you're not using SHRALIAS, then Take Command won't see the aliases.

I am using global lists, and SHRALIAS is running.
 
Back
Top