-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enter key doesn't work as expected when using xplr #18
Comments
Try this out... local function chg_cwd()
local file = vim.fn.readfile("/tmp/fm-nvim")[1]
if vim.fn.isdirectory(file) == 1 then
vim.cmd("cd " .. file)
os.remove("/tmp/fm-nvim")
end
end
require('fm-nvim').setup {
on_close = {
chg_cwd,
}
} Note that including You can still open files normally but when a directory is chosen, nvim will cd to that directory. |
Hmm, that didn't work for me, pressing enter on a dir still opens it instead of changing the working directory. Here's the installation of fm-nvim by packer local cfg = function(name)
return string.format('require("cfg.%s")', name)
end
return require('packer').startup(function(use)
use {
'is0n/fm-nvim',
config = cfg('fm'),
}
end) and here's the config file local ok, fm = pcall(require, 'fm-nvim')
if not ok then
vim.notify('unable to find fm-nvim')
return
end
local function chg_cwd()
local file = vim.fn.readfile('/tmp/fm-nvim')[1]
if vim.fn.isdirectory(file) == 1 then
vim.cmd('cd ' .. file)
os.remove('/tmp/fm-nvim')
end
end
fm.setup {
ui = {
default = 'split',
split = {
size = 50,
},
},
on_close = {
chg_cwd,
},
} I wasn't sure about the |
Are you on the latest version of |
Yeah. I updated fm-nvim to add the latest commit, f75cdf4, but that doesn't help either. |
This is me using the Untitled.mp4Here's the my config in case you might help: local function chg_cwd()
local file = vim.fn.readfile("/tmp/fm-nvim")[1]
if vim.fn.isdirectory(file) == 1 then
vim.cmd("cd " .. file)
os.remove("/tmp/fm-nvim")
end
end
require('fm-nvim').setup{
ui = {
default = "float",
float = {
border = "single",
border_hl = "NONE",
},
},
cmds = {
fzf_cmd = "fzf --preview 'fzf-preview {}' -1 -m",
},
on_close = {
chg_cwd,
}
} This is the output of
From what I can tell, the problem isn't with the |
@is0n while what you are doing is definitely changing the directory, I believe the intended behavior @ayushnix wanted is to change the directory in xplr, not vim. This solution results in a flicker local function chg_cwd()
local file = vim.fn.readfile("/tmp/fm-nvim")[1]
if vim.fn.isdirectory(file) == 1 then
vim.cmd.Xplr(file)
os.remove("/tmp/fm-nvim")
end
end
require('fm-nvim').setup {
on_close = {
chg_cwd,
},
} |
If I run xplr on my terminal with
xplr --print-pwd-with-results
and press enter on a directory, xplr exits and prints the parent dir and exits. This is also mentioned on the xplr docs.However, when using xplr with fm-nvim, when I press the enter key on a dir, the dir gets opened in a buffer window and the working directory isn't changed. I have this code in the fm-nvim config
Is there an issue with this config?
The text was updated successfully, but these errors were encountered: