is0n / fm-nvim Goto Github PK
View Code? Open in Web Editor NEW๐ Neovim plugin that lets you use your favorite terminal file managers (and fuzzy finders) from within Neovim.
License: GNU General Public License v3.0
๐ Neovim plugin that lets you use your favorite terminal file managers (and fuzzy finders) from within Neovim.
License: GNU General Public License v3.0
The following error message raises when using split
ui mode:
stack traceback:
[C]: in function 'nvim_buf_set_option'
...hare/nvim/site/pack/packer/start/fm-nvim/lua/fm-nvim.lua:85: in function 'postCreation'
...hare/nvim/site/pack/packer/start/fm-nvim/lua/fm-nvim.lua:150: in function 'createSplit'
...hare/nvim/site/pack/packer/start/fm-nvim/lua/fm-nvim.lua:225: in function 'Vifm'
[string ":lua"]:1: in main chunk
The problem is - if I understand correctly - that vim.cmd("topleft 24vnew")
command in fn-nvim.lua line 148 (in function createSplit
) does not return with a buffer number. Adding a line to get buffer number solved the issue on my side:
index 69daf52..842f961 100644
--- a/lua/fm-nvim.lua
+++ b/lua/fm-nvim.lua
@@ -146,6 +146,7 @@ end
local function createSplit(cmd, suffix)
M.buf = vim.cmd(config.ui.split.direction .. " " .. config.ui.split.size .. "vnew")
+ M.buf = vim.call("bufnr", "%")
postCreation(suffix)
vim.fn.termopen(cmd, {on_exit = on_exit})
vim.api.nvim_command("startinsert")
nvim version information:
NVIM v0.7.0-dev+1269-g746a29c58
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused
-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=alw
ays -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/ho
me/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/
neovim/neovim/build/include
Compiled by runner@fv-az87-703
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"
I am using vifm with image previews with the help of two scripts vifmimg (used for preview) and vifmrun (used to run vifm). They are documented here cirala/vifmimg. But I am not able to get previews while using fm-nvim. But floaterm does show a preview.
I have shown the problem in this gif
window flashes after running the command, and thats it.
using the stock config, yes both broot
and br
are in my $PATH
https://github.com/Canop/broot
Would it be possible to add support for broot in this plugin?
Is it possible to change current directory using this plugin? It would be much more convenient using file managers to do this intead of using :cd
command.
i've setted nushell
to be my default shell
And after that :Xplr
-command just flashing float window and that's it. without any error.
If i override xplr_cmd
with zsh -c xplr
- it works, but it won't be opening files in neovim.
Is there a way to debug and figure out what's problem with it?
Thank you!
Good day to you!
Is it possible for float-window set position ( [x,y] coordinates of top-left-cornet) or direction (North, NorthEast, East, ...) ?
Thank you!
Hi, this is a great plugin. At this moment i'm using xplr as my regular file manager and I would like to useit inside nvim. But i have same problem that layzigit. The plugin is open the file inside the floating window and not inside already open buffer.
Thanks for help in advance.
The cool new kid on the block! https://yazi-rs.github.io/
I tried to override the vertical split mapping so that it would open the file in a vertical split right away rather than waiting for the user to manually close vifm.
I achieved this with some hacky config:
local function mappings()
-- make ctrl-v close the file manager and open the file in a split pane. The default behaviour is to only
-- open the split pane once the flie manager has been closed manually by the user.
vim.api.nvim_buf_set_keymap(
0,
"t",
"<c-v>",
'<C-\\><C-n>:lua require("fm-nvim").setMethod("vsplit | edit")<CR>il<cr>',
{ silent = true }
)
end
fm_nvim.setup({
on_open = {
mappings,
},
mappings = {
-- something that I'm unlikely to press so that it is effectively disabled (these mappings are set after on_open
-- so it would override the <c-v> defined in mappings if we didn't set it)
vert_split = "sirerofpuwyq-;ufwyq-;pufyqw-;pufyqw-;",
},
})
This works, but it's a bit messy. Providing an empty string to, or omitting, the vert_spilt
mappings
map entry causes it to error or default to <c-v>
and because the default mappings are set up after on_open
it would override my override.
Adding an override was my use case, but it would also be nice to disable mappings that users have no intention to use as they may conflict with other mappings, and generally create unnecessary noise.
Is there a way to update the buffer when a file action is performed with LF? For example, if I delete or rename a file with LF and then return to the buffer, the old file exists - which will lead to errors if I then try to edit it. Thanks in advance, love this plugin!
Hi,
I'm trying to use Broot, but when I click for example Ctrl-j it's does not go one line below, I tried the same with Skim but it's working with Skim, any idea why that is?
Being able to specify custom border characters would be nice. Then I could just set a border on the top, or have a rounded border for example.
Good day to you!
Is it possible to launch fm
in vert or hor split?
Thank you!
Hi, great plugin, looking forward to using it.
One feature I would like is to be able to navigate to a folder and exit, with the CWD updated to that folder. Example usage would be navigate to a project root, exit and have CWD in that folder.
Hello, the plugin is great. It seems that lazygit is reloaded every time it is opened (a bit slow). Can it run in the background permanently?
๐๐ผ,
Cheers for a great plugin.
Like the title says: it's currently not possible to select multiple files in vifm
and open them with fm-nvim
.
Steps to reproduce:
:Vifm
.V
and select multiple files.CR
.I am getting this message when I close vifm
...hare/nvim/site/pack/packer/start/fm-nvim/lua/fm-nvim.lua:43: attempt to concatenate a nil value
stack traceback:
^I...hare/nvim/site/pack/packer/start/fm-nvim/lua/fm-nvim.lua:43: in function <...hare/nvim/site/pack/packer/start/fm-nvim/lua/fm-nvim.l
ua:39>
Can be seen here
Also, I cannot close with <Esc>
as it sends q
which is not my close command.
Can we have an option to define <Esc>
? Like if I want to send qa
or Q
instead ?
Lf cannot open to a file or folder that contains a space in the filename or anywhere in its path
this doesn't work:
:Lf /path/folder one/file one.txt
(space in path and file name)
:Lf /path/folder-one/file one.txt
(space in filename)
this does:
Lf /path/folder-one/file-one.txt
(no spaces)
escaping the spaces doesn't work either
vim.cmd("Lf " .. string.gsub(vim.api.nvim_buf_get_name(0), ' ', '\\ '))
I opened another issue with a link to a big vim function in my old vim config. Right above that is this block, unrelated to the other issue:
" Seamless splits
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-k': 'leftabove split',
\ 'ctrl-j': 'rightbelow split',
\ 'ctrl-h': 'leftabove vsplit',
\ 'ctrl-l': 'rightbelow vsplit',
\ }
This let me open selected file(s) in fzf in a certain direction. So <ctrl>+hjkl
would open the file(s) in the expected cardinal direction when inside fzf. I loved this workflow because I don't always know where I want to open files until I'm about to choose them from a finder.
Despite the above confusingly being about fzf which you also support, my question is actually about the file browsers part of the plugin. If I could achieve this with Ranger+vim I believe it would push me into a state of nerd nirvana. I was never quite able to get it working, though I also didn't try incredibly hard at the time. Do you think this is currently possible to implement in user-land? If not, I believe it could become possible if you opened up some of the mappings or internal API functions like postCreation
.
The first time a command is used, the selected file works. This, for whatever reason, doesn't work on the second time a command is used.
Only guess that I have is that the on_exit
function isn't being called upon terminal exit as file paths are still being written.
Hi, big fan of your plugin here.
I found that Joshuto is not working properly.
Seems like the --choosefiles subcommand it's been deprecated and substituted.
Thanks for such a useful plugin.
First of all I love your plugin on the other hand I work a lot with splits and tabs and I really miss being able to open the files this way
Press e
at some lazygit file, neovim will be opened inside lazygit instead open it in original neovim like ranger
This is an awesome plugin! I used to have a really big function I wrote that would open ranger, and you have implemented it even better.
I'm not sure how relevant this would be to other file managers, but one thing I had before (as can be seen in the link above, myselectFile
argument) is opening ranger to the folder of the current file, with the current file selected.
Is this something possible to do with your plugin? I'm not necessarily requesting a feature as this may only prove to be possible or easy with a subset of your supported browsers (I know it is on vifm as well, as I used to use that one and do the same thing). But I would like some help making this work. Perhaps I can write something to do this in an on_open
function?
I was playing around with the lua API and I will definitely be able to at least open the file browser in the current directory, and that will certainly be good enough as a fallback until/unless we can figure out how to also select the current file.
Thank you for your time.
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
local chg_cwd = function()
local cwd = io.open('/tmp/fm-nvim', 'r')
io.input(cwd)
local pwd = io.read()
vim.api.nvim_command('cd ' .. pwd)
os.remove(cwd)
end
require('fm-nvim').setup {
cmds = {
xplr_cmd = 'xplr --print-pwd-as-result',
},
on_close = {
chg_cwd,
},
}
Is there an issue with this config?
Recently my LF icons stopped working with this plugin. They still work outside of vim. Do I need to add any specific configuration to get them working again? Thanks!
As per the title, it would be nice if we could just close the window with .
Hi, I'm using this plugin in my neovim on the macos platform. I can open it in using Ranger, but when I run :Joshuto
, it doesn't work. The pop-up flashed and then nothing happened.
These are informations of my enviorment:
os: macos 13.4.1
neovim: v0.9.1
isOn/fm-nvim: commit 8e6a770
joshuto: 0.9.5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.