Git Product home page Git Product logo

iswap.nvim's Introduction

iswap.nvim

Interactively select and swap: function arguments, list elements, function parameters, and more. Powered by tree-sitter.

iswap demo

installation

For vim-plug:

Plug 'mizlan/iswap.nvim'

usage

Run the command :ISwap when your cursor is in a location that is suitable for swapping around things. These include lists/arrays, function arguments, and parameters in function definitions. Then, hit two keys corresponding to the items you wish to be swapped. After both keys are hit, the text should immediately swap in the buffer. See the gif above for example usage.

Use :ISwapWith if you want to have the element your cursor is over automatically as one of the elements. This way, you only need one keypress to make a swap.

configuration

In your init.lua:

require('iswap').setup{
  -- The keys that will be used as a selection, in order
  -- ('asdfghjklqwertyuiopzxcvbnm' by default)
  keys = 'qwertyuiop',

  -- Grey out the rest of the text when making a selection
  -- (enabled by default)
  grey = 'disable',

  -- Highlight group for the sniping value (asdf etc.)
  -- default 'Search'
  hl_snipe = 'ErrorMsg',

  -- Highlight group for the visual selection of terms
  -- default 'Visual'
  hl_selection = 'WarningMsg',

  -- Highlight group for the greyed background
  -- default 'Comment'
  hl_grey = 'LineNr',

  -- Automatically swap with only two arguments
  -- default nil
  autoswap = true

  -- Other default options you probably should not change:
  debug = nil,
  hl_grey_priority = '1000',
}

inspired by hop.nvim and nvim-treesitter-textobjects

iswap.nvim's People

Contributors

akinsho avatar bowmanmike avatar kevinhwang91 avatar mizlan avatar oliver-leete avatar p00f avatar schmidma avatar she3o avatar whythat 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.