Code Monkey home page Code Monkey logo

specs.nvim's Introduction

specs.nvim ๐Ÿ‘“

Show where your cursor moves when jumping large distances (e.g between windows). Fast and lightweight, written completely in Lua.

demo

showcase8 showcase7 showcase6 showcase5 showcase4 showcase3 showcase2 showcase1

Install

Using packer.nvim:

use {'edluffy/specs.nvim'}

Using vim-plug:

Plug 'edluffy/specs.nvim'

Usage

If you are using init.vim instead of init.lua, remember to wrap block below with lua << EOF and EOF

require('specs').setup{ 
    show_jumps  = true,
    min_jump = 30,
    popup = {
        delay_ms = 0, -- delay before popup displays
        inc_ms = 10, -- time increments used for fade/resize effects 
        blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
        width = 10,
        winhl = "PMenu",
        fader = require('specs').linear_fader,
        resizer = require('specs').shrink_resizer
    },
    ignore_filetypes = {},
    ignore_buftypes = {
        nofile = true,
    },
}
  • :lua require('specs').toggle()
    • Toggle Specs on/off

Faders:

  • sinus_fader โŒฃ/โŒข\โŒฃ/โŒข\โŒฃ/โŒข\โŒฃ/โŒข

  • linear_fader โ–โ–‚โ–‚โ–ƒโ–ƒโ–„โ–„โ–…โ–…โ–†โ–†โ–‡โ–‡โ–ˆโ–ˆ

  • exp_fader โ–โ–โ–โ–โ–‚โ–‚โ–‚โ–ƒโ–ƒโ–ƒโ–„โ–„โ–…โ–†โ–‡

  • pulse_fader โ–โ–‚โ–ƒโ–„โ–…โ–†โ–‡โ–ˆโ–‡โ–†โ–…โ–„โ–ƒโ–‚โ–

  • empty_fader โ–โ–โ–โ–โ–โ–โ–โ–โ–โ–โ–โ–โ–โ–โ–

Resizers:

  • shrink_resizer โ–‘โ–‘โ–’โ–’โ–“โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–“โ–’โ–’โ–‘โ–‘

  • slide_resizer โ–ˆโ–ˆโ–ˆโ–ˆโ–“โ–“โ–“โ–’โ–’โ–’โ–’โ–‘โ–‘โ–‘โ–‘

  • empty_resizer โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ

You can implement your own custom fader/resizer functions for some pretty cool effects:

require('specs').setup{ 
    popup = {
	-- Simple constant blend effect
        fader = function(blend, cnt)
            if cnt > 100 then
                return 80
            else return nil end
        end,
	-- Growing effect from left to right
        resizer = function(width, ccol, cnt)
            if width-cnt > 0 then
                return {width+cnt, ccol}
            else return nil end
        end,
    }
}

Keybinds

You can invoke specs from anywhere by using :lua require('specs').show_specs()
Add a keybind for this to make it easy to find your cursor at any time.

-- Press <C-b> to call specs!
vim.api.nvim_set_keymap('n', '<C-b>', ':lua require("specs").show_specs()', { noremap = true, silent = true })

-- You can even bind it to search jumping and more, example:
vim.api.nvim_set_keymap('n', 'n', 'n:lua require("specs").show_specs()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'N', 'N:lua require("specs").show_specs()<CR>', { noremap = true, silent = true })

-- Or maybe you do a lot of screen-casts and want to call attention to a specific line of code:
vim.api.nvim_set_keymap('n', '<leader>v', ':lua require("specs").show_specs({width = 97, winhl = "Search", delay_ms = 610, inc_ms = 21})<CR>', { noremap = true, silent = true })

Planned Features

  • More builtin faders + resizers
  • Colorizers
  • Optional highlight on text yank

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.