Comments (2)
Below line may partially do what you want. You should change zsh
to bash
, fish
, sh
or whatever shell program you prefer.
Exec=st -e sh -c "cd %u; lf; zsh"
This does not follow the directory where lf ends up. The directory of the shell will be the the downloaded directory.
After few more tries, figured out how to follow the path. Nevertheless, the command gets long and dirty. You may improve the command further by removing the temporary file and whatnot.
Exec=st -e sh -c "cd %u; lf -last-dir-path='/tmp/tmp.lfdir'; cd \"$(cat /tmp/tmp.lfdir)\"; zsh"
from lf.
@gokberkgunes
Awesome, it does indeed worked as I expected.
Yesterday, I was looking around and also found a solution to this. I created a script which included the lfcd()
function then add lfcd "$@"; $SHELL
at the end of the script. Call the script inside lf.desktop Exec=st -e /path/to/script %u
which does exactly the same thing as
Exec=st -e sh -c "cd %u; lf -last-dir-path='/tmp/tmp.lfdir'; cd \"$(cat /tmp/tmp.lfdir)\"; zsh"
however, your version, it a lot shorter and doesn't require additional script and does exactly the same thing 👍
##### lf.sh
#!/bin/sh
lfcd () {
tmp="$(mktemp)"
# `command` is needed in case `lfcd` is aliased to `lf`
command lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
}
lfcd "$@"; $SHELL
from lf.
Related Issues (20)
- [question] path on windows HOT 2
- `select` command always selects top file when `dircache` option is disabled HOT 4
- File size displayed incorrectly after copy HOT 6
- gpm support HOT 3
- new lfcd in zsh tmux HOT 10
- [Feature] Search within marks in free text HOT 2
- Newest build from git and statfmt HOT 2
- [Feature] Filter by date and size HOT 2
- Recreating a folder with the same name shows files from the "old" folder HOT 8
- r32 changelog (preview)
- halted mpv playback in tty session HOT 1
- Sixel previews don't work HOT 3
- How to browse/operate on connected Android devices via MTP? HOT 2
- Possible bug after remote select HOT 3
- [Feature request] Equivalent of Range's `set draw_borders separators` setting HOT 6
- [bug] lf somehow causes a fatal error which crashes chromium-based web utilities HOT 2
- mapped copy command to other keybindings and get error message HOT 2
- Refreshing file information HOT 2
- lf can't preview long line strings HOT 5
- Using lf with cd on exit and show preview images? HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lf.