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

macOS: RnvimrToggle: workaround for ranger "falling asleep" after a long time #83

Open MagicDuck opened 3 years ago

MagicDuck commented 3 years ago

Hi, thank you very much for this great plugin that I use every day. I love how well integrated with vim it is, wiping buffers associated with deleted files, renaming, etc. All in all a joy to use :heart: This is just about a workaround I found for a macOS specific annoyance that am wondering if you'd be ok with adding to the Q&A section.

Basically, the issue is like this:

  1. open nvim
  2. execute :RnvimrToggle and close the popup window (I have let g:rnvimr_enable_picker = 1)
  3. If I do :RnvimrToggle again at this point it shows up instantly.
  4. Close popup and wait a while, leaving nvim open (potentially doing work inside but not re-opening ranger). I am not sure how long it is exactly, maybe 20-30min
  5. invoke :RnvimrToggle again. It takes like 5s to load.

In my case, I found that the ranger process spawned by rnvimr` has a nice level of 32. Changing this setting so that it has nice level 0 (lower is better) seems to fix it for me:

let g:rnvimr_ranger_cmd = 'nice -n 0 ranger'

This is probably only an issue on macOS. I am not sure if other operating systems have this kind of aggressive "putting to sleep" of unused processes ... but maybe worth a note in the Q&A as it's something that can break your flow.

kevinhwang91 commented 3 years ago

Thanks for your feedback. It is seemly renice by your OS. Unfortunately, I can't reproduce it and don't have any idea why your nice of ranger will be greater than 20. I leave this issue as information for those who encounter this similar situation.