Skip to content

arsham/indent-tools.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Indent Tools

GitHub tag (latest by date) License

This Neovim plugin provides mappings and textobj for indentations capable of repeating jumps with ; and ,;

  1. Demo
  2. Requirements
  3. Installation
  4. License

Demo

Jumping along the indents ([i, ]i):

jumping

Text object (dii, cai, yii, vai, etc.):

textobj

Requirements

This library supports Neovim v0.7.0 or newer.

This plugin depends are the following libraries. Please make sure to add them as dependencies in your package manager:

The nvim-treesitter-textobjects is only used for repeatable jumps.

Installation

Use your favourite package manager to install this library.

Lazy

{
  "arsham/indent-tools.nvim",
  dependencies = {
    "arsham/arshlib.nvim",
    "nvim-treesitter/nvim-treesitter-textobjects",
  },
  config = true,
  -- or to provide configuration
  -- config = { normal = {..}, textobj = {..}},
}

Packer

use({
  "arsham/indent-tools.nvim",
  requires = {
    "arsham/arshlib.nvim",
    "nvim-treesitter/nvim-treesitter-textobjects",
  },
  config = function()
    require("indent-tools").config({})
  end,
})

Config

By default this pluging adds all necessary mappings. However you can change or disable them to your liking.

To disable set them to false. For example:

require("indent-tools").config({
  textobj = false,
})

Here is the default settings:

{
  normal = {
    up   = "[i",
    down = "]i",
    repeatable = true, -- requires nvim-treesitter-textobjects
  },
  textobj = {
    ii = "ii",
    ai = "ai",
  },
}

If repeatable is set to true and nvim-treesitter-textobjects plugin is installed, you can repeat the jumps back and forth with ; and ,.

Lazy Loading

You can let your package manager to load this plugin when a key-mapping event is fired.

Packer Lazy Loading

use({
  "arsham/indent-tools.nvim",
  requires = { "arsham/arshlib.nvim" },
  config = function()
    require("indent-tools").config({})
  end,
  keys = { "]i", "[i", { "v", "ii" }, { "o", "ii" } },
})

Lazy Lazy Loading

{
  "arsham/indent-tools.nvim",
  dependencies = {
    "arsham/arshlib.nvim",
    "nvim-treesitter/nvim-treesitter-textobjects",
  },
  config = true,
  keys = { "]i", "[i", { "v", "ii" }, { "o", "ii" } },
}

License

Licensed under the MIT License. Check the LICENSE file for details.