GithubHelp home page GithubHelp logo

wildfire.nvim's Introduction

🔥Wildfire.nvim: Wildfire burns treesitter🌲

A modern successor to wildfire.vim, empowered with the superpower of treesitter.

Incremental and decremental selection

Accelerate selection with count prefix

Quick selection (leverage by treehopper)

Highlights

  • ⚡ Smartly select the inner part of texts
  • count prefix
  • 🌳 Treesitter Integration

Motivation

I’ve found that treesitter’s incremental_selection is particularly handy for text selection. It often allows for selecting the desired text with fewer keystrokes compared to a well-configured wildfire.vim, all without the need to set up intricate text objects.

However, since treesitter relies solely on AST for incremental selection, it tends to be overly aggressive for surrounds. In such case, I have to revert to using text objects for selection, which is annoyed and tripped me up in practical use.

On the other hand, treesitter doesn’t support the count prefix(vim.v.count), which can make it somewhat cumbersome when dealing with longer ranges. Its implementation is also a bit buggy, as you might select an area within the same range(see below).

A picture is worth a thousand words

Usage

The useage is almost the same as wildfire.vim and incremental_selection, You can check out their introduction to get a sense of it.

  • CR Init selection and do incremental selection if you have initilized (so just keep pressing CR).
  • BS Decremental selection.
  • NUM-CR Accelerate selection with count prefix.

This plugin offers a streamlined method for text selection, freeing you from the hassle of configuring and remembering intricate text objects. Plus, initiating this plugin with CR seamlessly transitions you into visual mode. This means you can still harness the power of your preferred text objects without any extra keystrokes (like v-i-b or CR-i-b).

Beyond the basic actions such as yank(CR), delete(d), and change (c), here are a few other awesome tricks up its sleeve:

  • 📐 Partially format with: textDocument/rangeFormatting
  • 🔍 Narrow down regions using: nag.nvim
  • 🖋️ Adding surrounding pairs via: nvim-surround

Tip

This plugin embodies my endeavor to embrace the Helix-inspired select first method. The horizon is vast, and the possibilities limitless. Come, let’s explore the extent of what we can achieve together! 🚀

Installation

{
    "sustech-data/wildfire.nvim",
    event = "VeryLazy",
    dependencies = { "nvim-treesitter/nvim-treesitter" },
    config = function()
        require("wildfire").setup()
    end,
}

Configuration

This plugin is modified based on the official implementation of treesitter, so you can configure it in a very similar manner.

Currently you can only set unit width surround, refer to the default settings below.

{
    surrounds = {
        { "(", ")" },
        { "{", "}" },
        { "<", ">" },
        { "[", "]" },
    },
    keymaps = {
        init_selection = "<CR>",
        node_incremental = "<CR>",
        node_decremental = "<BS>",
    },
}

To disable a keymaps, set it to nil or false.

The quick selection havn’t support natively, but you can try it out by

:lua require'wildfire'.init_selection()<CR>:lua require('tsht').nodes()<CR>

which is powered by treehopper, flash also provide similar things

Roadmap

  • init with count prefix
  • Native quick selection support
  • Advanced surround support (Any length)
  • Handle surround in node

wildfire.nvim's People

Contributors

fecet avatar baggiponte 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.