Giter Site home page Giter Site logo

3erz / rnvimr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theniceboy/rnvimr

0.0 0.0 0.0 15 KB

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

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

Vim Script 47.13% Python 49.28% Makefile 3.60%

rnvimr's Introduction

rnvimr

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

Compared with other Ranger just running Ranger as a file picker, this plugin uses hacking tech to do whatever you want to Ranger, such as running rpc inside Ranger to communicate with neovim.

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

Since rnvimr requires RPC, this plugin does not support vim for now

vimade was used to fade interactive windows.

Requirements

  1. Ranger
  2. pynvim
  3. neovim
  4. ueberzug (optional, requires at least b58954)

Features

  • Replaces the built-in Netrw as a default file explorer
  • Calibrated preview images for ueberzug
  • Attach file automatically when toggling Ranger
  • Runs RPC inside Ranger to communicate with NeoVim
  • Automatically adjusts floating window after resizing NeoVim
  • Fully customizable layouts for floating window

Installation

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

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

If you want rnvimr to use the default (vanilla) Ranger configuration, please using make install instead of make sync.

Usage

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

Use :RnvimrResize to cycle the preset layouts.

:RnvimrSync will synchronize your personal Ranger configuration and plugins with rnvimr this time.

Note: if your Ranger config changes, you will have to run :RnvimrSync in order to use your updated Ranger configuration with rnvimr

Enter to open a file in Ranger. Rnvimr also supports CTRL-T/CTRL-X/CTRL-V key bindings that allow you to open up 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.

Example configuration

Minimal configuration

" Synchronize all Ranger's configuration and plugins with rnvimr
Plug 'kevinhwang91/rnvimr', {'do': 'make sync'}

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

" Synchronize all Ranger's configuration and plugins with rnvimr
Plug 'kevinhwang91/rnvimr', {'do': 'make sync'}

" Make Ranger replace netrw and be the file explorer
let g:rnvimr_ex_enable = 1

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,13,11,5<CR>

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

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

" Customize multiple preset layouts
" '{}' represents the initial layout
let g:rnvimr_presets = [
            \ {'width': 0.250, 'height': 0.250},
            \ {'width': 0.333, 'height': 0.333},
            \ {},
            \ {'width': 0.666, 'height': 0.666},
            \ {'width': 0.750, 'height': 0.750},
            \ {'width': 0.900, 'height': 0.900},
            \ {'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}]

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

License

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

rnvimr's People

Contributors

kevinhwang91 avatar

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.