• Stars
    star
    151
  • Rank 246,057 (Top 5 %)
  • Language
    Lua
  • Created almost 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

cheat.sh integration for neovim in elegant way

nvim-cheat.sh

cheat.sh integration for neovim.

nvim-cheat.sh provides elegant UI and remove complexity of url handling and special symbols for users.

Screenshots

Installation

Install with your favorite plugin manager. For example with vim-plug:

Plug 'RishabhRD/popfix'
Plug 'RishabhRD/nvim-cheat.sh'

Working

The plugin exports 4 commands:

  • Cheat
  • CheatWithoutComments
  • CheatList
  • CheatListWithoutComments

Each command accepts 0 or more arguments. Arguments decide the initial prompt text.

CheatWithoutComments search the query but don't display the (optional) comments.

Example:

:Cheat
:Cheat cpp reverse number
:CheatWithoutComments
:CheatWithoutComments cpp reverse number

First and third command opens the prompt to search with and without comments respectively.

Second and fourth command opens the prompt with initial prompt text cpp reverse number to search with and without comments respectively.

CheatList and CheatListWithoutComments provides fuzzy finding from all available symbols.

Changing result layout

By default result is displayed in a floating window. However, this may be disturbing for some users. Hence, nvim-cheat.sh provides a global variable g:cheat_default_window_layout with which users can set their default layout.

Example:

vim.g.cheat_default_window_layout = 'split'

Possible values are:

  • split
  • vertical_split
  • tab
  • float

Note: If provided any wrong value, float will be used.

How to query

Plugin behavior is similar to cheat.sh behavior.

The first word should be the language for query. (e.g. cpp)

Rest of words define the query. (e.g. sum of digits)

An example query:

cpp sum of digits

Try to put the language name matching vim filetype for the corresponding language. This would also enable syntax highlighting for result. Example: using javascript for javascript language would produce syntax highlighting. However, using js for javascript would not as vim recognise javascript as filetype not js.

For having different results for the same query append \1, \2, etc to query similar to classic cheat.sh.

Example: cpp read file\1

Keymaps

Keymaps for prompt are:

In insert mode:

  • <CR> : Open result in default layout.
  • <C-x> : Open result in horizontal split.
  • <C-t> : Open result in a new tab.
  • <C-v> : Open result in a vertical split.
  • <C-y> : Open result in floating window.
  • <C-f> : Open result in floating window.
  • <C-c> : Close window without any action.
  • <C-p> : Previous in history
  • <C-n> : Next in history

In normal mode:

  • <CR> : Open result in default layout.
  • <C-x> : Open result in horizontal split.
  • <C-t> : Open result in a new tab.
  • <C-v> : Open result in a vertical split.
  • <C-y> : Open result in floating window.
  • <C-f> : Open result in floating window.
  • <C-c> : Close window without any action.
  • <Esc> : Close window without any action.
  • q : Close window without any action.
  • k : Previous in history
  • j : Next in history

More Repositories

1

nvim-lsputils

Better defaults for nvim-lsp actions
Lua
455
star
2

popfix

Neovim lua API for highly extensible popup window
Lua
83
star
3

lspactions

handlers for required lsp actions
Lua
54
star
4

mraylib

simple ray tracing library focusing on good code
C++
50
star
5

expected

P0323 & P2505 std::expected simple implementation
C++
39
star
6

archrice

Repository containing my arch ricing
Lua
33
star
7

libparse

A functional parsing library
C++
26
star
8

snake

A snake game trying to be reasonable
C++
20
star
9

nvim-finder

A highly extensible fuzzy finder neovim extension based on popfix fuzzy engine.
Lua
18
star
10

gruvy

Gruvbuddy port independent of colorbuddy
Lua
16
star
11

nvim-rdark

A dark colorscheme for neovim written in lua
Lua
14
star
12

rdconfig

all my configs at a single place
Lua
10
star
13

nvim-qf

vim-qf fork for neovim
Vim Script
4
star
14

nvim-gruvbox

gruvbox sequenced colorscheme with colorbuddy
Lua
4
star
15

SniffRay

Network Sniffer for Linux
C++
3
star
16

codeforces

my codeforces contests here
C++
3
star
17

workspace-switcher

3-finger swipe Workspace switch functionality for linux
Python
2
star
18

arpspoof

Linux arp spoof using raw sockets
C++
2
star
19

basic-cmake

A CMake starter project targeting to be easy to use with conan2 package manager
C++
2
star
20

xshare

Web-based file sharing application
C++
2
star
21

cses

My solutions to cses problem-set
C++
2
star
22

RishabhRD.github.io

Ruby
2
star
23

dwm

C
1
star
24

null-destruction

This is a software to crash your linux kernel... maybe just for learning purpose
C
1
star
25

core-library

It contains simple implementation of many core library of C.
C
1
star
26

monkey-interpreter

Simple Interpreter written in Haskell
Haskell
1
star
27

libparse-hask

Implementing libparse in haskell for comparing the implementations
Haskell
1
star
28

rssh-server

C++
1
star
29

rsa-client

C++
1
star
30

untree

create directory structure from output of main
C++
1
star
31

fast_cpp20_starter

Start any cmake based C++ project at speed of light
CMake
1
star
32

st

C
1
star
33

generator

Implementation of P2168
C++
1
star
34

execution

Implementation of P2300 std::execution
C++
1
star
35

cpptest

Modern Testing framework for C++ with no macros
C++
1
star