/neoranger

Simple ranger wrapper for neovim.

Primary LanguageVim script

Neoranger

Introduction

Neoranger is a simple ranger wrapper script for neovim. It's inspired by Drew Neil's thoughs on project drawers. It's like vinegar or filebeagle, but with ranger as the interface.

Neoranger opens a terminal with ranger in the current window. It sets ranger's viewmode to multipane, making it easy to use in narrow windows. You can select and open multiple files.

The wrapper script ensures that split windows don't break when the terminal window is closed, by restoring the previous buffer in the current window.

Note that neoranger replaces netrw.

Usage

Neoranger provides two commands, :Ranger and :RangerCurrentFile.

:Ranger accepts an optional directory and file argument. If no arguments are provided it opens ranger in the current working directory.

:RangerCurrentFile opens ranger and selects the currently open file.

Mappings

Neoranger doesn't add any mappings by default. The following mappings makes neoranger behave like vinegar or filebeagle:

" Open ranger at current file with "-"
nnoremap <silent> - :RangerCurrentFile<CR>

" Open ranger in current working directory
nnoremap <silent> <Leader>r :Ranger<CR>

Options

Neoranger has the following options:

" for setting ranger viewmode values
let g:neoranger_viewmode='multipane' " supported values are ['multipane', 'miller']

" for setting any extra option passed to ranger params
let g:neoranger_opts='--cmd="set show_hidden true"' " this line makes ranger show hidden files by default