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

Question: How can I open ranger files in a new buffer instead of in the floating window? #148

Closed Zeioth closed 1 year ago

Zeioth commented 1 year ago

screenshot_2023-05-16_22-08-15_965671644

kevinhwang91 commented 1 year ago

It looks like your RPC doesn't setup correctly.

Zeioth commented 1 year ago

I'm not sure how to debug it. It says health ok. I wil keep looking into the code.

kevinhwang91 commented 1 year ago

The parent directory of pynvim should be installed in the same path as ranger. You can run eval import pynvim in ranger to check out.

Zeioth commented 1 year ago

Sorry for delay in answering: I did run ":eval import pynvim" inside RnvimrmToggle, and it runs with no errors. Also the health test show all OK. But the problem remain.

screenshot_2023-05-22_17-26-35_569718868

kevinhwang91 commented 1 year ago

I guess your open candidate is nvim.

Q: Couldn't open some special types of files by using Enter or l in Ranger.

A: Please follow the below steps to solve this issue:

  1. The behavior of opening the file in Ranger depends on rifle.conf. Press r to make sure that the ${VISUAL:-$EDITOR} -- "$@" is the best candidate in Ranger.
  2. If the case 1 is false, change the code in rifle.conf like that:
Zeioth commented 1 year ago
# Tried launching like this
VISUAL=nvim EDITOR=nvim nvim

# With this on rifle.conf
mime ^text,  label editor         = nvim -- "$@"

rnvimr opens nvim, the problem is it does it in a floating anidated window instead of nvim itself. The plugin https://github.com/rafaqz/ranger.vim works as expected. The issue is not of ranger but of this plugin.

Please could you tell me what ranger/pynvim/nvim versions are you running?

kevinhwang91 commented 1 year ago

RTFM.

Zeioth commented 1 year ago

I found several other issues with the same problem. Solved with:

let g:rnvimr_vanilla = 1

That helped me to isolate the issue: Just by deleting ~/ranger/rifle.conf solved the issue, even running rnvimr with my settings.

EDIT: In the end this line from the FAQ solved it (if not, try deleting all other lines to debug)

#-------------------------------------------
# At the top of rifle.conf
#-------------------------------------------
# This will catch most files
mime ^text,  label editor         = ${VISUAL:-$EDITOR} -- "$@"
mime ^text,  label pager          = "$PAGER" -- "$@"
name ^[mM]akefile$                = ${VISUAL:-$EDITOR} -- "$@"
name ^[mD]ockerfile$              = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager,  ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"

# We ensure any of these file formats open with nivm
mime ^text,  label editor, ext htm|html|css|scss|less|lisp|csv|tex|py|pl|rb|js|ts|tsx|dart|vue|jinja|jade|pug|java|sql|lua|sh|php|md|notes|c|cpp|css|go|rs|conf|pem|key|lock|deleteme|json|xml|vim|your_file_type = ${VISUAL:-$EDITOR} -- "$@"

#-------------------------------------------
# Any other mimetype go here
#-------------------------------------------
# video audio pdf and stuff

#-------------------------------------------
# Generic file openers (at the botton of rifle.conf)
#-------------------------------------------
label open, has xdg-open = xdg-open -- "$@"
label open, has open     = open -- "$@"

# If we still didn't catch it, open with nvim
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php  = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php  = ${VISUAL:-$EDITOR} -- "$@"
label pager,  !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php  = "$PAGER" -- "$@"

Thank you so much for your patience, and for making the plugin, and apologies for the inconvenience.