kevinhwang91 / rnvimr

Make Ranger running in a floating window to communicate with Neovim via RPC
BSD 3-Clause "New" or "Revised" License
800 stars 17 forks source link

Cannot open an empty file #143

Closed brunobmello25 closed 1 year ago

brunobmello25 commented 1 year ago

Run :checkhealth for more info


- Operating system/version: Pop!_OS 22.04 LTS

- `nvim +'checkhealth rnvimr'`: 

rnvimr: health#rnvimr#check

OS ~

Ranger ~

Python ~

Pynvim ~

Ueberzug (optional) ~

RPC ~

Describe the bug When trying to open an empty file with rnvimr_enable_picker enabled, ranger fails to open it and remains opened in the current directory

To Reproduce using nvim -u mini.lua

Example: cat mini.lua

vim.g.mapleader = " "

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"

if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end

vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
  {
    'kevinhwang91/rnvimr',
    config = function()
      vim.keymap.set('n', '<leader>e', '<cmd>RnvimrToggle<cr>')
    end,
    init = function()
      vim.g.rnvimr_enable_picker = 1
    end
  }
})

Steps to reproduce the behavior:

  1. clone the example repository: git clone https://github.com/brunobmello25/rnvimr-example-bug-repo
  2. open the directory with nvim -u mini.lua . (will open in netrw)
  3. open ranger with <space>e
  4. try to open the file not-empty and see that it opens normally
  5. open ranger again with <space>e
  6. try to open the file empty and see that it fails to open

Additional context Ranger version: 1.9.3 Python version: 3.10.6 Locale: en_US.UTF-8

kevinhwang91 commented 1 year ago

can't reproduce

brunobmello25 commented 1 year ago

Here is a video reproducing the issue. Do you know if there is a way for me to check rnvimr logs? I can paste them here if there are any

kevinhwang91 commented 1 year ago

https://github.com/kevinhwang91/rnvimr#faq

Do you know if there is a way for me to check rnvimr logs?

Not supported for now.

brunobmello25 commented 1 year ago

I don't think this solves the problem. This issue is also happening on files that are already present on that mime configuration line, for example python files.

kevinhwang91 commented 1 year ago

Read FAQ and press r

brunobmello25 commented 1 year ago

this becomes a problem when the file doesn't have an extension and is empty

kevinhwang91 commented 1 year ago

That's the issue for ranger, but not for rnvimr. Change your rifle.conf or make PR to ranger.