kevinhwang91 / rnvimr

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

Empty files opened in ranger term rather than neovim buffers #99

Closed glyh closed 2 years ago

glyh commented 2 years ago

Features: +acl +iconv +tui

- Operating system/version:

Linux arch 5.15.12-arch1-1 #1 SMP PREEMPT Wed, 29 Dec 2021 12:04:56 +0000 x86_64 GNU/Linux

- `nvim +'checkhealth rnvimr'`: 

rnvimr: health#rnvimr#check

OS

Ranger

Python

Pynvim

Ueberzug (optional)

RPC

**Describe the bug**
Steps to reproduce the behavior:
1. use the following init.lua:
```lua
require('packer').startup({function(use)

  use 'wbthomason/packer.nvim'

  use 'kevinhwang91/rnvimr'

end})
  1. use the following rifle.conf in ~/.config/ranger. The difference between this one and the default one is that I change the line to fix the issue
    label open, has xdg-open = xdg-open -- "$@"

    to

    label open, has xdg-open = xdg-open "$@"
  2. Run xdg-mime default nvim.desktop inode/x-empty to use neovim to open empty files
  3. Start neovim, open ranger in neovim, use touch to create some empty file.
  4. Open that empty file

Expected behavior The file is opened in neovim.

Screenshots If applicable, add screenshots to help explain your problem.

image

kevinhwang91 commented 2 years ago

Make sure label editor, !mime ^text, !ext filetypes = ${VISUAL:-$EDITOR} -- "$@" label pager, !mime ^text, !ext filetypes = $PAGER -- "$@" have a higher priority than label open, has xdg-open

glyh commented 2 years ago

@kevinhwang91 This won't fix. The empty file you create should not have any suffix, for exmaple abcdefg. Thus this can only be catch up by xdg-open, but in this case I want to edit it in neovim.

kevinhwang91 commented 2 years ago

Can't understand what you mean. Rnvimr only monkey patch ${VISUAL:-$EDITOR} candidate for Ranger but keep others' order.

Press r in Ranger will show you the candidates of item you selected.

glyh commented 2 years ago

Ok, I got it, thanks for your patience.