Code Monkey home page Code Monkey logo

nvim-insx's Introduction

nvim-insx

Flexible key mapping manager.

2023-06-01.3.07.56.mov

Warning

  • The basic recipes supports dot-repeat
    • However, advanced recipes don't support dot-repeat.
  • This plugin is usually works as expected.
    • Does not aim to support to always work as expected because this plugin uses RegExp ๐Ÿ˜…
  • It is more convenient when used with vim-matchup.
    • The demo image uses with vim-matchup. ๐Ÿ‘
  • This plugin provides basic cmdline-mode pairwise features.
    • The advanced recipes aren't support cmdline-mode.

Usage

This plugin does not provide any default mappings. You should define mapping by yourself like this.

Use preset

require('insx.preset.standard').setup()

Use recipe

local insx = require('insx')

insx.add(
  "'",
  insx.with(require('insx.recipe.auto_pair')({
    open = "'",
    close = "'"
  }), {
    insx.with.in_string(false),
    insx.with.in_comment(false),
    insx.with.nomatch([[\\\%#]]),
    insx.with.nomatch([[\a\%#]])
  })
)

Create your own recipe

-- Simple pair deletion recipe.
local function your_recipe(option)
  return {
    action = function(ctx)
      if option.allow_space then
        ctx.remove([[\s*\%#\s*]])
      end
      ctx.send('<BS><Right><BS>')
    end,
    enabled = function(ctx)
      if option.allow_space then
        return ctx.match([[(\s*\%#\s*)]])
      end
      return ctx.match([[(\%#)]])
    end
  }
end

The standard preset enables some of the advanced features.

Status

The API is stable except helper related APIs.

bug report & feature request are welcome.

nvim-insx's People

Contributors

hrsh7th avatar avimitin avatar yuki-yano 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.