Closed bushnerd closed 2 months ago
The default shell used on Windows is CMD, which doesn't support multiline commands. Since you're using PowerShell for scripting, you can configure lf
to use that instead of CMD:
set shell pwsh
cmd yd ${{
Set-Clipboard -Value $env:PWD
echo "Directory path copied to clipboard: $env:PWD"
}}
Thank you very much, but I experience a delay of about 2 seconds after clicking on yd
. Do you have the same issue?
I notice a small delay too, but I suspect that is just pwsh
being slow, nothing to do with lf
. Try running pwsh
directly, outside of lf
.
Thanks for your reply. I have try another way to get shorter time to get the path and dir like this:
cmd yank-dir ${{ echo %PWD:~1,-1% | clip}}
map yd :yank-dir
cmd yank-path ${{ echo %f:~1,-1% | clip}}
map yp :yank-path
cmd yank-name ${{
for %i in ("%f%") do @(echo %~nxi) | clip
echo File name copied to clipboard: %~nxi
}}
map yn :yank-name
But yank-name does not work well, anyone have try this?
I don't really have any proper experience with batch scripting, but I took what you have and ended up with the following which works for me:
cmd yank-name ${{ for %i in ("%f:~1,-1%") do @(echo %~nxi) | clip }}
map yn :yank-name
I don't really have any proper experience with batch scripting, but I took what you have and ended up with the following which works for me:
cmd yank-name ${{ for %i in ("%f:~1,-1%") do @(echo %~nxi) | clip }} map yn :yank-name
Thanks a lot for your reply, it has been solved.
My envs: Windows 11 Powershell 7 Window terminal lf r32。 lfrc as follows:
But the three shortcuts do not work, even there is nothing displayed