kyoheiu / felix

tui file manager with vim-like key mapping
https://kyoheiu.dev/felix/
MIT License
729 stars 26 forks source link

Adds ability to cd into last changed-to directory with ZZ #192

Closed ElSamhaa closed 1 year ago

ElSamhaa commented 1 year ago
ElSamhaa commented 1 year ago

Some systems/shells do not honor the POSIX TMPDIR environment variable spec. So I updated the calling shell function to account for that and match the Platform-specific behavior of std::env::temp_dir

kyoheiu commented 1 year ago

Interesting. I gave this a try, and found the following:

Edit: code indentation, typo

nthnd commented 1 year ago

what is the status of this? its a really neat feature

ElSamhaa commented 1 year ago

Sorry, this completely slipped my mind. I'll address @kyoheiu 's comments and push my changes.

ElSamhaa commented 1 year ago

@kyoheiu I've updated the PR with changes in line with your comments. I have added couple other enhancements:

I've tested my changes under MacOS, Linux, Zsh and Bash.

ElSamhaa commented 1 year ago

@kyoheiu I have also added you the collaborators on my fork of felix. I'm not sure whether this helps with the fact that you can't edit the PR, but you can test and feedback me.

nthnd commented 1 year ago

Tested on Void Linux - Bash. Works perfectly.

kyoheiu commented 1 year ago

Cool, looks great! I'll test this PR in this weekend.

kyoheiu commented 1 year ago

I tried this PR on my Arch Linux and when exiting by ZQ, received this error message, similar to before:

bash: bc: command not found
find: invalid argument `+' to `-mmin'

(though I succeeded to exit to the current dir)

Edit: The same log appears when exiting by ZZ.

I set source <(command fx --init) at the end of .bashrc. Could you tell me if something is wrong?

ElSamhaa commented 1 year ago

@kyoheiu Seems I was wrong in assuming that bc comes pre-installed on unix-like systems (Apparently it does not on Arch Linux, while it does on the systems I'd tested on). I'll replace that arithmetic expression with its result which is static anyways ~ 0.02 (fraction of a second to a minute). I only wrote it that way as a giveaway to my intent at the expense of the repeated cheap calculation.

The whole purpose of it is to remove any leftover LWD files everytime the fx function runs. I believe this might not be necessary as I can move that logic to run every time the fx --init is sourced instead; i.e every time an interactive shell is run.

I'll update the PR.

ElSamhaa commented 1 year ago

@kyoheiu I've updated the PR

kyoheiu commented 1 year ago

Works like a charm! Thank you. Looks good to me.