Comments (4)
Great, I went with that idea and it worked! If anyone wants to do something similar, this is what I ended up with:
on_close = {
function()
local file = io.open("/tmp/ranger_dir", "r")
io.input(file)
local dir = io.read()
command('cd ' .. dir)
end,
},
and a mapping to this command (Ranger):
<CMD>Ranger --choosedir="/tmp/ranger_dir"<CR>
from fm-nvim.
You can actually do this with a vim setting called autochdir
. You can set this by using the following in your init.lua
...
vim.opt.autochdir = true
Is this what you had in mind?
from fm-nvim.
I more had in mind that I would like to be able to navigate to the root of a project, exit the file manager (without opening a file) and have cwd be in the directory that I left the file manager. I usually like to navigate to a project root (with something like this plugin), and then use a fuzzy-finder to open some file from there.
from fm-nvim.
Sorry for the late response but after the latest commit, you might be able to do this.
The latest commit allows you to run functions upon exiting the floating window. This can be seen on the README.
If you were using Lf for example, you could change the command to use -last-dir-path
which would write the file manager's last directory path to a specified file. Then using on_close
and your function, you could read that file and then cd
there.
The code would be something like...
local function updateCWD()
-- some code that checks /tmp/cwd
end
require('fm-nvim').setup{
cmds = {
lf_cmd = "lf -last-dir-path /tmp/cwd"
}
on_close = { updateCWD }
}
I think the issue should be resolved but please LMK if there's anything missing :)
from fm-nvim.
Related Issues (20)
- Open browser with current file selected HOT 9
- Allow directional splits HOT 1
- Ctrl-j and Ctrl-k not working when using Broot HOT 4
- enter key doesn't work as expected when using xplr HOT 6
- FEATURE:bookmark HOT 2
- LF icons not working HOT 6
- split mode does not work HOT 1
- [Feature] Change current directory HOT 2
- Close buffer along with window HOT 1
- Update buffer on file action with LF HOT 9
- [Feature Request] Allow custom border characters HOT 1
- Joshuto does not work HOT 3
- Make it possible to disable or override a mapping
- lazygit not open file in nvim HOT 3
- Xplr not open file inside already open buffer
- Can it run in the background permanently
- Joshuto does not work HOT 2
- broot just.. doesn't work?
- Add support for Yazi HOT 1
- Cannot open files that contain spaces in file/path name
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 fm-nvim.