Coder Social home page Coder Social logo

kevinhwang91 / rnvimr Goto Github PK

View Code? Open in Web Editor NEW
782.0 5.0 18.0 245 KB

Make Ranger running in a floating window to communicate with Neovim via RPC

License: BSD 3-Clause "New" or "Revised" License

Python 68.18% Vim Script 31.82%
neovim ranger nvim vim nvim-plugin python

rnvimr's Introduction

Rnvimr

Rnvimr is a NeoVim plugin that allows you to use Ranger in a floating window.

Different than other Ranger vim-plugins, Rnvimr gives you full control over Ranger. It uses RPC to communicate with Ranger.

This plugin does not support Vim.

Table of contents

Requirements

  1. Ranger (v1.9.3 or laster)
  2. Pynvim
  3. Neovim 0.5 or later
  4. Python3.6
  5. Ueberzug (optional, v18.1.6 or laster) / Ueberzugpp (optional, v2.3.0 or laster)

Features

  • Replace the built-in Netrw as a default file explorer
  • Calibrated preview images for ueberzug
  • Attach file automatically when toggling Ranger
  • Adjust floating window size automatically after resizing NeoVim
  • Adjust view automatically to adapt the size of floating window
  • Fully customizable layouts for floating window
  • Better experience for Pager view in Ranger
  • Wipe out the buffers corresponding to the files deleted by Ranger automatically
  • Enhanced border in Ranger
  • Synchronize the current working directory of Neovim and Ranger
  • Hide the files included in gitignore
  • Save Buffer information when the src files are moved from Ranger

Installation

Dependence

Example for yay in ArchLinux and pip in other *unix distributions:

# ArchLinux install all requirements is extremely convenient
yay -S ranger python-pynvim ueberzug
# ~ `ueberzug` can be replaced with `ueberzugpp` ~

# pip

# macOS users please install ranger by `pip3 ranger-fm` instead of `brew install ranger`
# There're some issues about installation, such as https://github.com/ranger/ranger/issues/1214
# Please refer to the issues of ranger for more details
pip3 install ranger-fm pynvim

# Ueberzug/Ueberzugpp is not supported in macOS because it depends on X11
pip3 install ueberzug

Ueberzug is optional

Plugin

Install Rnvimr with your favorite plugin manager! Example for Vim-plug:

Plug 'kevinhwang91/rnvimr'

CheckHealth (optional)

Run nvim +'checkhealth rnvimr' in shell. If everything is OK, it will output like these:

health#rnvimr#check
========================================================================
## OS
  - OK: Name: Linux

## Ranger
  - OK: Version: ranger-master

## Python
  - OK: Version: 3.8.3 (default, May 17 2020, 18:15:42) [GCC 10.1.0]

## Pynvim
  - OK: Version: 0.4.1

## Ueberzug (optional)
  - OK: Ueberzug is ready

## RPC
  - OK: RPC echo: Neovim send "Give me five!" and receive "Give me five!"

Usage

Using :RnvimrToggle to create a Ranger process, and if one exists, :RnvimrToggle simply shows or hides the floating window.

Using :RnvimrResize to cycle the preset layouts.

Pressing Enter to open a file in Ranger.

Rnvimr also supports ctrl-t/ctrl-x/ctrl-v key bindings that allow you to open up a file in a new tab, a new horizontal split, or in a new vertical split.

Pressing q in Ranger simply hides the floating window. Ranger will attach the file of the current buffer in the next toggle event.

Pressing yw in Ranger will emit Ranger's cwd to Neovim's, gw will jump to Neovim's cwd.

Demonstration

Hide the files included in gitignore

Save buffers information (undo) when the src files are moved from Ranger

Example configuration

Minimal configuration

Plug 'kevinhwang91/rnvimr'

tnoremap <silent> <M-i> <C-\><C-n>:RnvimrResize<CR>
nnoremap <silent> <M-o> :RnvimrToggle<CR>
tnoremap <silent> <M-o> <C-\><C-n>:RnvimrToggle<CR>

Advanced configuration

Plug 'kevinhwang91/rnvimr'

" Make Ranger replace Netrw and be the file explorer
let g:rnvimr_enable_ex = 1

" Make Ranger to be hidden after picking a file
let g:rnvimr_enable_picker = 1

" Replace `$EDITOR` candidate with this command to open the selected file
let g:rnvimr_edit_cmd = 'drop'

" Disable a border for floating window
let g:rnvimr_draw_border = 0

" Hide the files included in gitignore
let g:rnvimr_hide_gitignore = 1

" Change the border's color
let g:rnvimr_border_attr = {'fg': 14, 'bg': -1}

" Make Neovim wipe the buffers corresponding to the files deleted by Ranger
let g:rnvimr_enable_bw = 1

" Add a shadow window, value is equal to 100 will disable shadow
let g:rnvimr_shadow_winblend = 70

" Draw border with both
let g:rnvimr_ranger_cmd = ['ranger', '--cmd=set draw_borders both']

" Link CursorLine into RnvimrNormal highlight in the Floating window
highlight link RnvimrNormal CursorLine

nnoremap <silent> <M-o> :RnvimrToggle<CR>
tnoremap <silent> <M-o> <C-\><C-n>:RnvimrToggle<CR>

" Resize floating window by all preset layouts
tnoremap <silent> <M-i> <C-\><C-n>:RnvimrResize<CR>

" Resize floating window by special preset layouts
tnoremap <silent> <M-l> <C-\><C-n>:RnvimrResize 1,8,9,11,5<CR>

" Resize floating window by single preset layout
tnoremap <silent> <M-y> <C-\><C-n>:RnvimrResize 6<CR>

" Map Rnvimr action
let g:rnvimr_action = {
            \ '<C-t>': 'NvimEdit tabedit',
            \ '<C-x>': 'NvimEdit split',
            \ '<C-v>': 'NvimEdit vsplit',
            \ 'gw': 'JumpNvimCwd',
            \ 'yw': 'EmitRangerCwd'
            \ }

" Add views for Ranger to adapt the size of floating window
let g:rnvimr_ranger_views = [
            \ {'minwidth': 90, 'ratio': []},
            \ {'minwidth': 50, 'maxwidth': 89, 'ratio': [1,1]},
            \ {'maxwidth': 49, 'ratio': [1]}
            \ ]

" Customize the initial layout
let g:rnvimr_layout = {
            \ 'relative': 'editor',
            \ 'width': float2nr(round(0.7 * &columns)),
            \ 'height': float2nr(round(0.7 * &lines)),
            \ 'col': float2nr(round(0.15 * &columns)),
            \ 'row': float2nr(round(0.15 * &lines)),
            \ 'style': 'minimal'
            \ }

" Customize multiple preset layouts
" '{}' represents the initial layout
let g:rnvimr_presets = [
            \ {'width': 0.600, 'height': 0.600},
            \ {},
            \ {'width': 0.800, 'height': 0.800},
            \ {'width': 0.950, 'height': 0.950},
            \ {'width': 0.500, 'height': 0.500, 'col': 0, 'row': 0},
            \ {'width': 0.500, 'height': 0.500, 'col': 0, 'row': 0.5},
            \ {'width': 0.500, 'height': 0.500, 'col': 0.5, 'row': 0},
            \ {'width': 0.500, 'height': 0.500, 'col': 0.5, 'row': 0.5},
            \ {'width': 0.500, 'height': 1.000, 'col': 0, 'row': 0},
            \ {'width': 0.500, 'height': 1.000, 'col': 0.5, 'row': 0},
            \ {'width': 1.000, 'height': 0.500, 'col': 0, 'row': 0},
            \ {'width': 1.000, 'height': 0.500, 'col': 0, 'row': 0.5}
            \ ]

" Fullscreen for initial layout
" let g:rnvimr_layout = {
"            \ 'relative': 'editor',
"            \ 'width': &columns,
"            \ 'height': &lines - 2,
"            \ 'col': 0,
"            \ 'row': 0,
"            \ 'style': 'minimal'
"            \ }
"
" Only use initial preset layout
" let g:rnvimr_presets = [{}]

For more information, please refer to :help rnvimr, because I don't want to maintain two documents with the same contents :).

FAQ

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:
-!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
+!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php|your_file_type = ${VISUAL:-$EDITOR} -- "$@"

Q: CheckHealth says RPC timeout.

A: Install Dependence first, run ex command:echo $NVIM_LISTEN_ADDRESS to confirm that the message output is in a format like this /tmp/nvimIYj484/0 or a tcp format address:port, Rnvimr needs this environment variable.

Q: How can I go back to the previous directory in Ranger after attaching a new file?

A: Press H in Ranger, mean go back to the last history directory.

Q: How can I use Ranger default configuration (vanilla)?

A: Write let g:rnvimr_vanilla = 1 to your vim configuration.

Q: let g:rnvimr_enable_ex = 1 can't work as expected.

A: Turn off the option of other plugins (like let g:NERDTreeHijackNetrw = 0 which is used in NERDTree) or uninstall the conflicting plugins.

Q: In MacOS, I must press <ctrl-v> twice to split window vertically.

A: Please refer to #71 and use rnvimr_action variable to remap <ctrl-v> as a workaround for the issue.

License

The project is licensed under a BSD-3-clause license. See LICENSE file for details.

rnvimr's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rnvimr's Issues

Devicons and first character of the line is not visible.

Everything is working if ranger is called directly from the terminal emulator, but if called from nvim the devicons is not showing up and if the draw_borders in rc.conf is set to set draw_borders both or set draw_borders separators, then every first character of the lines in the preview is missing.

System Details:
OS: Pop Os 19.10
Terminal: Alacritty 0.4.1 and Gnome Terminal 3.34.2
Font: SF Mono Powerline light, also tested using Fira Mono for Powerline
Ranger config: everything is default except

  • default_linemode devicons
  • set vcs_aware true
  • set preview_images true
  • set preview_images_method ueberzug
  • set draw_borders both
  • Also I uncomment the video and pdf section on the scope.sh

rnvimr config:

  • let g:rnvimr_ex_enable = 1
  • let g:rnvimr_pick_enable = 1
  • let g:rnvimr_draw_border = 1
  • let g:rnvimr_bw_enable = 1
  • let g:rnvimr_presets = [ { 'width': 0.950, 'height': 0.900 } ]

Also added this to the config let g:vimtex_compiler_progname = 'nvr' for to make all green on nvim +'checkhealth rnvimr'

Expected Behavior:
Devicons should show and all text on preview should be shown, like what ranger is showing if called directly from the terminal.
Screenshot from 2020-05-15 07-13-38

Actual Behavior:
Devicons is not shown and the first character on every line is missing.
Screenshot from 2020-05-14 08-39-07

If there's any details I missed, I will be happy to provide.

Thanks

rnvimr_ex_enable not working

I wanna replace netrw with Ranger, i have set this option in my configs but whenever i open nvim into a folder the manager is the default.

I'm currently using Arch linux.

No application knows how to open x

After creating a new file with :touch in Rnvimr it is unable to be opened. This does not happen in running ranger outside of vim.

Example:
Inside Rnvimr
:touch start.vim
scroll to start.vim and press return
No application knows how to open start.vim

Inside Ranger
:touch start.vim
scroll to start.vim and press return
Opens in nvim as expected

If I add something to the file so that it is no longer empty Rnvimr opens it in a new buffer as expected.

I'm not sure what I did as I havent changed my rifle.conf and I ran :rnvimrsync after installing the plug in, but it seems that running the sync again resolved the issue.

Mac Issue

hi,

Thanks for your wonderful plugin, however, I've got some issue and wish you could help me to figure out.

I have sucessfully install it via vim-plug and health-check was fine. But floating window just won't show up and user configuration of ranger was not imported correctly.

It seems likes this plugin is using bash instead of zsh, which is one that I am currently using. For you information, I can run ranger in my Iterm2 terminal without any problem.

My configuration and screen shot are as follow:

  • Mac
  • Iterm2
  • zsh
    -neovim
    Screen Shot 2020-09-24 at 6 31 17 AM

Best regards,
Peter

Error

I was thinking in show you a video about the error I mentioned in reddit but I don't what happened I get this error my ranger works in the terminal, this error is when I run :RnvimrToggle
image

Feature: Change working directory from ranger, similar to "NERDTreeMapChdir"

Thanks for the great plugin!

One feature that would be great would be to change vim's working directory from within ranger, similar to "NERDTReeMapChdir".

I.e. when executing a certain key on a file or folder within ranger, it doesn't yanks the currently selected path (like 'yw'), but changes the current working directory of vim to that path.

Healthcheck fails RPC test

  • nvim --version: NVIM v0.4.4 (+acl +iconv +tui)
  • Operating system/version: NixOS (relevant parts of configuration.nix shown below)
environment.systemPackages = with pkgs; [
  neovim
  (python3.withPackages(ps: with ps; [ pynvim ueberzug])
  ...
]
  • nvim +'checkhealth rnvimr':
health#rnvimr#check
========================================================================
## OS
  - OK: Name: Linux

## Ranger
  - OK: Version: ranger 1.9.3

## Python
  - OK: Version: 3.8.5 (default, Jul 20 2020, 13:26:22) [GCC 9.3.0]

## Pynvim
  - OK: Version: 0.4.1

## Ueberzug (optional)
  - OK: Ueberzug is ready

## RPC
  - ERROR: RPC: timeout 3s

Describe the bug

I am told by the healthcheck that RPC is timing out.

Otherwise, I seem to be able to use the plugin just fine (even when I didn't have pynvim or ueberzug installed...).

Am I missing any additional dependencies?

Expected behavior

Unclear what the implications of this error message are, but it shouldn't be appearing.

Enhancement: variable that contains list of regex's for hidden files (directories)

I have one more enhancement to propose.

In rc.conf there is hidden_filter variable, can you add plugin variable to append it list to this hidden_filter for ranger instance that opens with rnvimr? So some directories and files like node_modules etc could be hidden by default. I don't want some directories to be hidden in my shell ranger by default, but i don't want to see them when i working on my projects.

For example let g:rnvimr_some_variable = ['^node_modules$', '\.ext$', '^some_other_dir$']

Or maybe better approach would be to respect global and local .gitignore files? But the problem is that it uses different syntax than hidden_filter regex.

Show warning if ranger isn't installed

This is probably something to put on the backburner, or ignore entirely, but it would be nice if instead of the current flow of:
:RnvimrToggle displaying a floating :terminal for a literal 0.5 seconds, then disappearing without saying anything, it would display an error output.

Modal window background color

First of all great work, love it!
Not sure if this is a problem with the plugin itself, but I don't get a distinction between the modal window itself and the background. Any idea how to fix this?

L.E: don't know if this matters - I'm SSH'ing into a Ubuntu 20.04 computer from Windows Terminal.

image

rnvimr doesn't load more than once

When first opening rnvimr, ranger opens properly and works. When I try to open it a second time within nvim, I get this error:

Error detected while processing function rnvimr#toggle[10]..rnvimr#rpc#attach_file_once[2]..rnvimr#rpc#attach_file[1].
.76_valid_setup:
line 2:
ranger has not started yet.
Error detected while processing function rnvimr#toggle[10]..rnvimr#rpc#attach_file_once[2]..rnvimr#rpc#attach_file:
line 3:
E475: Invalid argument: Channel id must be a positive integer

This is the output when I check health:

Ranger

  • OK: Version: ranger 1.9.3

OS: macOS Catalina

Opening a file opens in external editor

Thanks for the plugin, I much prefer it to the alternatives.

I have an issue where the plugin will open certain filetypes in an external editor.

I don't have a full list of file extensions that it happens with, but it definitely happens when I try to open a .ts file.

rnvimr不能使用正确的python版本

  • nvim --version:
NVIM v0.5.0-dev+82100a6bd
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20201214-72269-xbo28y/build/config -I/tmp/neovim-20201214-72269-xbo28y/src -I/usr/local/include -I/tmp/neovim-20201214-72269-xbo28y/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20201214-72269-xbo28y/build/src/nvim/auto -I/tmp/neovim-20201214-72269-xbo28y/build/include
编译者 [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

     系统 vimrc 文件: "$VIM/sysinit.vim"
         $VIM 预设值: "/usr/local/Cellar/neovim/HEAD-82100a6/share/nvim"
  • Operating system/version:
    Darwin promote.cache-dns.local 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64 x86_64
  • nvim +'checkhealth rnvimr':
 health#rnvimr#check
========================================================================
## OS
  - OK: Name: Mac

 ## Ranger
   - OK: Version: ranger 1.9.3

 ## Python
   - ERROR: Version: 2.7.16 (default, Oct 30 2020, 02:15:49) [GCC Apple LLVM       12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri
     - ADVICE:
       - Python version inside Ranger must be greater than 3
       - Please install Ranger properly

 ## Pynvim
   - OK: Version: 0.4.2

 ## Ueberzug (optional)
   - INFO: Ueberzug is not support for Mac

 ## RPC
   - ERROR: RPC: timeout 3s

Describe the bug
系统默认的python为python2.7,已经ln -s homebrew 安装的python3到/usr/local/bin/下,在zsh里也可以默认使用,但是rnvimr不能正常识别

❯ where python
/usr/local/bin/python
/usr/bin/python
❯ python --version
Python 3.9.1

To Reproduce using nvim -u mini.vim

cat mini.vim

" use your plugin manager, here is `vim-plug`
call plug#begin('~/.config/nvim/plugged')
Plug 'kevinhwang91/rnvimr'
let g:rnvimr_vanilla = 1
tnoremap <silent> <M-i> <C-\><C-n>:RnvimrResize<CR>
nnoremap <silent> <M-o> :RnvimrToggle<CR>
tnoremap <silent> <M-o> <C-\><C-n>:RnvimrToggle<CR>
call plug#end()

Steps to reproduce the behavior:
1.checkhealth
2.

health#rnvimr#check
========================================================================
## OS
  - OK: Name: Mac

## Ranger
  - OK: Version: ranger 1.9.3

## Python
  - ERROR: Version: 2.7.16 (default, Oct 30 2020, 02:15:49) [GCC Apple LLVM 12.   0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri
    - ADVICE:
      - Python version inside Ranger must be greater than 3
      - Please install Ranger properly

## Pynvim
  - OK: Version: 0.4.2

## Ueberzug (optional)
  - INFO: Ueberzug is not support for Mac

## RPC
  - ERROR: RPC: timeout 3s

Expected behavior
正确识别python路径,或提供变量自己修改路径

Screenshots
截屏2020-12-15 上午8 45 40

提示RPC timeout

怎么解决rpc timeout的问题呢
在运行echo $NVIM_LISTEN_ADDRESS之后他给出的是/var/folders/dx/vv7mhzx505qfd2xgwk3jhd1c0000gn/T/nvimlcykMx/0这个目录
截屏2020-08-29 15 22 04
文件夹中有这些内容

checkhealh: Error invoking 'echo' on channel XX

The plugin worked fine before but today I ran into some trouble, from the error message there is something going worng in rpc related function.

  1. Minimum Init.vim
call plug#begin('~/.config/nvim/autoload/plugged')

Plug 'kevinhwang91/rnvimr', {'do': 'make sync'}

call plug#end()
  1. nvim --version
NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.3/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
  1. Reproduce and behaviour.

    1. Startup neovim with nvim -u minimum.vim
    2. Run :RnvimrToggle, rnvimr pops up fine.
    3. Cannot use q, <C-t>, or <CR> to communicate with rnvimr (Browsing between dirs was fine).
  2. checkhealth output:

health#rnvimr#check
========================================================================
  - ERROR: Failed to run healthcheck for "rnvimr" plugin. Exception:
    function health#check[21]..health#rnvimr#check[5]..<SNR>36_check_rpc, line 25
    Vim(let):Error invoking 'echo' on channel 73:
    Invalid channel: 73

I'm pretty sure it may not be relevant with the plugin itself since it worked fine a few days ago.
I may mess up something by myself, however, I don't have much experience with rpc and would appreciate any hint on how to fix this issue.

E117: Unknown function: stdpath in macOS

Error detected while processing function <SNR>13_LoadRemotePlugins[1]..<SNR>13_GetManifest[1]..<SNR>13_GetManifestPath:7:
E117: Unknown function: stdpath
E15: Invalid expression: stdpath('data')
Press ENTER or type command to continue

It happens when I try to open a file from floating windows by l or Enter.

Btw, C-T works well.

Change default branch from master to main

https://github.com/github/renaming
vim-plug support updating repo from the default branch for now.

How to update rnvimr from main branch?

  1. Run :PlugUpgrade to upgrade vim-plug;
  2. Delete old rnvimr repo;
  3. Run :PlugInstall to install rnivmr again;

Install rnvimr by Plug 'kevinhwang91/rnvimr', {'do': 'make sync'} Plug 'kevinhwang91/rnvimr'.

support tcp nvim_listen_address

Is your feature request related to a problem? Please describe.
I use localhost:12345 as my NVIM_LISTEN_ADDRESS. This causes rnvimr to crash messily when invoked.

Describe the solution you'd like
Include logic that supports this pynvim attach option:
nvim = attach('tcp', address=

, port=)

Describe alternatives you've considered
I modified the code to handle tcp connection and pynvim doesn't crash, but it doesn't work, either.

Additional context
Add any other context or screenshots about the feature request here.

Return old file

If I have opened a new file by Ranger, how to return the old file?

Opening a file, it stays inside the small window?

Hi!

I've tried your plugin ranger and neovim is nice, but the problem is that it doesnt open the file into the buffer instead it opens up inside the floating window.

Any way to open it in nvim instead of staiying inside the floating window?

Rendered picture is still on the screen after exiting rnvimr

  • nvim --version:v0.4.4
  • Operating system/version: 5.8.18-1-MANJARO
  • nvim +'checkhealth rnvimr':
## OS
  - OK: Name: Linux

## Ranger
  - OK: Version: ranger-master 

## Python
  - OK: Version: 3.8.6 (default, Sep 30 2020, 04:00:38) [GCC 10.2.0]

## Pynvim
  - OK: Version: 0.4.2

## Ueberzug (optional)
  - OK: Ueberzug is ready

## RPC
  - OK: RPC echo: Neovim send "Give me five!" and receive "Give me five!"


Describe the bug
A clear and concise description of what the bug is.

Ranger rendered picture still on the screen after exiting rnvimr

Steps to reproduce the behavior:

  1. open nvim using nvim
  2. toggle rnvimr
  3. using ranger browsing and previewing your images
  4. toggle rnvimr

Expected behavior
The rendered image should also be closed after toggle rnvimr

Screenshots
image

< C-T > and < C-X > and < C-V > is not effected on both macos and archlinux

  • nvim --version: v0.4.4
  • Operating system/version: MacOS and Arch Linux
  • nvim +'checkhealth rnvimr':
## OS
  - OK: Name: Mac

## Ranger
  - OK: Version: ranger 1.9.3

## Python
  - OK: Version: 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34) [Clang 6.0 (clang-600.0.57)]

## Pynvim
  - OK: Version: 0.4.2

## Ueberzug (optional)
  - INFO: Ueberzug is not support for Mac

## RPC
  - OK: RPC echo: Neovim send "Give me five!" and receive "Give me five!"

Describe the bug
Like issues #15

I'm using neovim, and I've also installed Ranger. After installing your plug-in, I can open the file with the Enter key, but it is invalid to use < C-T > and < C-X > and < C-V >. These three keys have no binding function.

FYI, I have checked out that action.py, hacks.py, host.py, service.py are not in ~/.config/nvim/plugged/rnvimr/ranger/plugins.

Expected behavior
Expecting to get < C-T > and < C-X > and < C-V > to work.

Looking forward to your reply. Thanks in advance

Best regards,
Peter

UnboundLocalError: local variable 'module_base' referenced before assignment

Hi there,

I start getting this error after update last version (after removal of RnvimrSync), I could not open rnvimr without vanilla mode.

ranger version: ranger 1.9.3
~                Python version: 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]
~                Locale: en_US.UTF-8

~                  File "...../.config/nvim/plugged/rnvimr/ranger/plugins/urc.py", line 46, in _load_plugins
~                    if module_base:
~                UnboundLocalError: local variable 'module_base' referenced before assignment
~
~                ranger crashed. Please report this traceback at:
~                https://github.com/ranger/ranger/issues
~
~                [Process exited 1]

I just instantiated the undefined module_base variable before its check, and seems to have solved the problem.

            module_base = None
            module_path = os.path.join(plug_dir, plugin)

            if plugin.endswith('.py'):

< C-T > and < C-X > and < C-V > is not effected

I'm using neovim, and I've also installed Ranger. After installing your plug-in, I can open the file with the Enter key, but it is invalid to use < C-T > and < C-X > and < C-V >. These three keys have no binding function.

A file which has been touched within rnvimr does not open in nvim and opens in the browser instead

  • nvim --version: NVIM v0.4.4
  • Operating system/version: Linux 5.8.5-arch1-1
  • nvim +'checkhealth rnvimr': All OK

Describe the bug
When within rnvimr, if you touch a file and then try to open it (with enter or l), it is opened outside nvim. In my case, rnvimr attempts to open the file in Chromium.

Steps to reproduce the behavior:

  1. Open nvim and rnvimr.
  2. Send the command "touch test" to rnvimr.
  3. Open the newly created "test" file from rnvimr using enter or l.

Expected behavior
The file should open within nvim, as all other files do.

Screenshots
Not really valuable, but do let me know if you need them.

Custom Filetype for ranger buffer

Is your feature request related to a problem? Please describe.
I have jk and kj bound to escape into normal mode for terminal mode and insert mode. As Ranger works in terminal mode this adds a delay when I am browsing files.

Describe the solution you'd like
If the terminal buffer in which ranger is working will have a custom filetype or some indentification it will be easy to make custom and conditional key bindings for ranger in nvim.

Use PlugUpdate cause error msg: 'Post-update hook for rnvimr ... Exit status: 2'

v0.3.0 have removed the Makefile, so use Plug 'kevinhwang91/rnvimr' instead of Plug 'kevinhwang91/rnvimr', {'do': 'make sync'}

Please delete the installed Rnvimr and then reinstall it, because the previously synchronized cache was already in the plugin, Rnvimr will always use cached configuration rather than user configuration.

Update example:

  1. Wrtie Plug 'kevinhwang91/rnvimr' to nvim configuration and exit
  2. rm -rf ~/.config/nvim/plugged/rnvimr
  3. Execute :PlugInstall in nvim

Get more detail please refer to the CHANGES file.

rnvimr/CHANGES

Lines 1 to 25 in 248405f

CHANGES FROM 0.2.0 TO 0.3.0
* dynamic import user configuration by default, remove everything about synchronizing configuration
* remove :RnvimrSync and :RnvimrInstall ex command
* delete Makefile, so `make install` and `make sync` are unnecessary
* g:rnvimr_sync_path was desperated, use g:rnvimr_urc_path instead
* g:rnvimr_ex_enable was desperated, use g:rnvimr_enable_ex instead
* g:rnvimr_picker_enable was desperated, use g:rnvimr_enable_picker instead
* g:rnvimr_bw_enable was desperated, use g:rnvimr_enable_bw instead
* add g:rnvimr_vanilla to disable Rnvimr to import user configuration
* add g:rnvimr_hide_gitignore to hide the files included in gitignore
* add `JumpNvimCwd` and `EmitRangerCwd` actions
* support border for floating window by default
* save Buffer information when the src files are moved from Ranger

cwd enhancement

Hello. It's me again.
Have tested your plugin a little.
For sure ranger is more powerful than some other vim fm(tree) plugins like NerdTree, but one thing that bothers me that it's hard to say (after you have changed few directories) which directory is cwd in neovim.
Can it be improved somehow? Like receiving string from getcwd() and

  • restrict jumping only inside cwd (something like changing behavior of h key) and goes beyond it only with H?
  • gh jumps not to ~ dir but to cwd in neovim or add some hotkey for this jump?
  • or at least show it somewhere or maybe add some icon(another color) for that directory?

using rnvimr with virtualenv

Hi, I have a problem with virtualenv.
Ranger works fine with the host environment, but I use Python virtualenvs most of the time.
When I am in a virtualenv where pynvim is not installed, ranger fails with the following error message from ~/.config/nvim/plugged/rnvimr/bin/editor.py

No module named "pynvim"

What I've tried is to create another virtualenv for neovim3 in which I installed all the required modules and add the interpreter path to it as below.

let g:python3_host_prog = '/Users/jihonoh/.pyenv/neovim3/bin/python'

Still, it's not working. Any ideas?

Exception when toggling rnvimr in neovim

I can't use rnvimr on my MacOS with neovim, here's the stacktrace I'm getting in the window ranger is suppose to be displayed

Error while loading plugin 'host'
Error while loading plugin 'service'
ranger version: ranger 1.9.3
Python version: 2.7.16 (default, Feb 29 2020, 01:55:37) [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103
.0.29.20) (-macos10.15-objc-
Locale: None.None

Traceback (most recent call last):
  File "/usr/local/Cellar/ranger/1.9.3/libexec/ranger/core/main.py", line 172, in main
    ranger.api.hook_init(fm)
  File "/Users/maciek/.config/nvim/autoload/plugged/rnvimr/ranger/plugins/hacks.py", line 377, in <lambda>
    ranger.api.hook_init = lambda fm: Hacks(fm, OLD_HOOK_INIT).hook_init()
  File "/Users/maciek/.config/nvim/autoload/plugged/rnvimr/ranger/plugins/hacks.py", line 44, in hook_init
    self.draw_border()
  File "/Users/maciek/.config/nvim/autoload/plugged/rnvimr/ranger/plugins/hacks.py", line 354, in draw_bord
er
    attr_dict = client.nvim.vars['rnvimr_border_attr']
  File "/Users/maciek/Library/Python/2.7/lib/python/site-packages/pynvim/api/common.py", line 88, in __geti
tem__
    return self._get(key)
  File "/Users/maciek/Library/Python/2.7/lib/python/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/Users/maciek/Library/Python/2.7/lib/python/site-packages/pynvim/msgpack_rpc/session.py", line 102,
 in request
    raise self.error_wrapper(err)
NvimError: Key not found: rnvimr_border_attr

ranger crashed. Please report this traceback at:
https://github.com/ranger/ranger/issues

[Process exited 1]

Healthcheck info:
health#rnvimr#check

  - ERROR: Failed to run healthcheck for "rnvimr" plugin. Exception:
    function health#check[21]..health#rnvimr#check[5]..<SNR>137_check_rpc, line 34
    Vim(call):E900: Invalid channel id

image

Selecting file with ranger doesn't remove [No Name] buffer from buffers list

How to reproduce:

  • open neovim with nvim command. And get scratch [No Name] buffer.
  • open ranger with rnvimr :RnvimrToggle
  • open file with l and close rnvimr with q
    type:ls` and see that scratch [No Name] buffer still exists.

Expected behavior:
[No Name] buffer should be removed from buffers list, the same way as it removed if you start editing file with :e filename.txt or with selecting file with Netrw (or other fm plugins).

Duplicate tag "g:rnvimr_draw_border" in file /home/kino/.cache/dein/.cache/init.vim/.dein/doc/rnvimr.txt

After I updated the all plugins with dein,
mentioned the following messages,
I don't know waht it means.

Update started: (2020/07/13 21:59:06)
Error generating helptags:
Vim(helptags):E154: Duplicate tag "g:rnvimr_draw_border" in file /home/kino/.cache/dein/.cache/init.vim/.dein/doc/rnvimr.txt
function 3[1]..dein#install#_polling[7]..113_install_async[9]..113_done[9]..dein#install#_recache_runtimepath[19]..
113_helptags, line 12
Done: (2020/07/13 21:59:45)

open file inside rnvimr popup

So, i was editing some files and decided do add another one, i used :vsplit, opened rnvimr, and selected a file, but instead of opening in nvim, it opened in the popup. It worked normaly a few weeks ago without changing configs. Is there a way to fix this?

关于对此插件的改进建议

你好!首先感谢你编写的rnvimr插件。我很喜欢你利用nvim特性配合ranger达成的用户体验。我之前使用的是ranger.vim,我认为rnvimr会比ranger.vim优秀很多,但rnvimr目前存在一些我认为需要得到解决的问题。

1. 在ranger模式下,对与ESC键的处理

使用:RnvimrToggle打开ranger后,键入g(或其他用户定义的组合键),ranger会在底部弹出提示框来显示可能的组合键(如gg)。正常情况下,用户可以通过ESC键来取消组合键(同时关闭提示框)。但在rnvimr中,ESC会直接关闭ranger。这会导致很大的不便。(ranger.vim则没有这个问题)

2. 自动更新ranger配置文件

拿我个人的ranger使用习惯来说,我经常会打开ranger配置文件,添加或修改一些cd特定目录的快捷键。这很大程度上提高了我的工作效率,因为我可以随时跳转到我常用的文件夹。当我的ranger配置文件更新后,ranger.vim也会使用最新的配置文件来打开ranger(因为ranger.vim只不过是打开了一个终端并运行ranger —choosefiles而已)。而对于rnvimr,我则需要手动:RnvimrSync。这很不符合用户逻辑,因为对于用户来说,我们打开的应该是同一个ranger。

一个次优解决方案是在每次更新ranger配置后在插件目录下运行make sync,(可以用类似ENTR这种程序来检查文件更新),但最好还是有一个比较优雅的解决方案。

3. 当nvim的cwd改变的时候,rnvimr应该显示新的路径

我的init.vim让我的nvim自动把当前的buffer的目录(如果存在)设为当前的cwd(Current Working Directory)。所以我在打开ranger.vim的时候,ranger.vim会自动把目录设置成我当前buffer所在的目录。

每次ranger.vim都会重新启动ranger,速度很慢。rnvimr只需要启动ranger一次。但是,:RnvimrToggle不会根据nvim的cwd来改变ranger浏览的目录。我认为这是一个比较大的问题。

4. 更简单易懂的文档

目前rnvimr的文档还是略过复杂,我们可以进一步讨论对于README的改进方法。

结语

再一次感谢你编写的插件。这个插件会提升包括我在内很多人的工作效率。我很愿意和你进一步的讨论。

— 陈为

Opening within the nested window

I'm unable to open the file on a new buffer in my nvim session, like it shows in the gif. Pressing 'l' or opens another nvim session within the floating window.

screenshot_026

Just a big thanks for this plugin !

Thank you for your work in this plugin.
It does work wonderfully and seems very polished.
Neovim's floating window capabilities are in fact surprisingly usefull.

At first I was a bit sceptic, because I"m not a big fan of vim "explorer" type plugins like nerd tree and similar. I already used dirvish ore netranger for quick and simple things. And I dont like to install extra stuff to complicate.

I'm a big fan of ranger, and keep using it after all these years, although there are now "faster" alternatives in C, Go, Rust etc, but nothing beats ranger extensibility.

Since I can now use my ranger knowledge and customizations "inside" neovim, I can use two things I already know and compound it's value. No need to learn new things. It's a winner !
The C-t C-x C-v mappings are very well thought. You should "advertise" them better.

No more needs for hackish solutions with tmux windows and panes.

No module named greenlet

Great work!
I have a similar problem as #19, however I use conda instead of virtualenv.

When I used rnvimr in some project environment (which doesn't have pynvim and greenlet), the rnvimr complain No module named greenletwhen I pressed <Enter> or l, however I have pynvim installed in my system python3 and let g:python3_host_prog = '/usr/bin/python3, and I can still use <C-t> <C-x> and <C-v> to open files in tab, split and vsplit.

Besides, the newly added checkhealth feature also complains that pynvim is not found, but neovim provider says it's found.
rnvimr1
rnvimr2

After I installed pynvim in conda environment, all problems are gone.

Is it a must to have pynvim installed in every conda environment?

Opening a file, it stays inside the small window? Part II

Same issue as the other gentleman was having: #23. Everything is working fine, except that any file I open (for example .py) opens inside the pop up window.

  1. Running :checkhealth rnvimr

health#rnvimr#check

========================================================================
## OS
  - OK: Name: Linux

## Ranger
  - OK: Version: ranger 1.9.3

## Python
  - OK: Version: 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]

## Pynvim
  - OK: Version: 0.4.1

## Ueberzug (optional)
  - OK: Ueberzug is ready

## RPC
  - OK: RPC echo: Neovim send "Give me five!" and receive "Give me five!"
  1. Running a minimal configuration like this will also cause the error:
call plug#begin('~/.config/nvim/plugged')
Plug 'kevinhwang91/rnvimr'
tnoremap <silent> <M-i> <C-\><C-n>:RnvimrResize<CR>
nnoremap <silent> <M-o> :RnvimrToggle<CR>
tnoremap <silent> <M-o> <C-\><C-n>:RnvimrToggle<CR>
call plug#end()

uberzug can't work

  • Ranger-devicons works well when using ranger in terminal. However, I cannot use it in rnvimr.
  • Similarly, I cannot preview images well using rnvimr. Pictures are very big. They are not in correct position and even part of them are out of the screen.

I am using Archlinux + dwm now. How can I fix these problems?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.