Giter VIP home page Giter VIP logo

nvimpager's Introduction

Nvimpager

Using neovim as a pager to view man pages, git diffs, whatnot with neovim's syntax highlighting and mouse support.

About

The nvimpager script calls neovim in a fashion that turns it into something like a pager. The idea is not new, this is actually rewrite of vimpager but with less (but stricter) dependencies and specifically for neovim.

Some typical use cases:

# view a file in nvimpager
nvimpager file
# pipe text to nvimpager
echo some text | nvimpager
# use it as your default $PAGER
export PAGER=nvimpager
man bash
git diff

The script also has a "cat mode" which will not start up the neovim interface but instead print a highlighted version of the file to the terminal. Like cat with neovim syntax highlighting! If the input has less lines than the terminal cat mode is activated automatically so nvimpager behaves similar to less -F. Pager mode and cat mode can be enforced with the options -p and -c respectively.

Nvimpager comes with a small set of command line options but you can also use all of neovim's command line options. Use nvimpager -h to see the help text. The configuration is separated from the users config for neovim. The main config file is ~/.config/nvimpager/init.vim (or .lua). See the manpage for further explanation.

Installation

Packaging status

Nvimpager is already packaged for some distributions. If not for yours, you can install it manually, read on.

Dependencies

Installation instructions

Use the makefile to configure and install the script. It supports the usual PREFIX (defaults to /usr/local) and DESTDIR (defaults to empty) variables:

make PREFIX=$HOME/.local install

Additionally the variable BUSTED can be used to specify the executable for the test suite.

Development

Nvimpager is developed on GitHub where you are very much invited to post bug reports, feature or pull requests! The test can be run with make test. They are also run on GitHub: Build Status

Limitations

  • if reading from stdin, nvimpager (like nvim) waits for EOF until it starts up
  • large files are slowing down neovim on startup (less does a better, i.e. faster and more memory efficient job at paging large files)

Ideas

  • see how neovim#7428 and neovim#18375 are resolved and maybe move more code (logic) from bash to lua (bash's [[ -t ... ]] can be replaced by has('ttyin'), has('ttyout'))
  • proper lazy pipe reading while paging (like less) to improve startup time and also memory usage for large input on pipes (maybe stdioopen() can be used?)

License

The project is licensed under a BSD-2-clause license. See the LICENSE file.

nvimpager's People

Contributors

lucc avatar env25 avatar openjck avatar 3v1n0 avatar ardnew avatar name-snrl avatar ericonr avatar

Watchers

 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.