Giter Site home page Giter Site logo

inline-fold.nvim's Introduction

inline-fold.nvim

inline-fold.nvim is a Neovim plugin inspired by the vscode plugin inline-fold. It provides a convenient way to define patterns in files that get concealed inline. This can be used for many things for example for CSS classes in HTML files especially with TailwindCSS

Note: It doesn't work for multiline patterns.

Features โœจ

  • Toggle folding of the content
  • Replace the folded content with a placeholder for improved readability.
  • Placeholder can be defined by the user per pattern
  • pattern can be easily added

Installation ๐Ÿ’ป

Use your preferred plugin manager to install inline-fold.nvim.

Plug

{
  "malbertzard/inline-fold.nvim",

  opts = {
    defaultPlaceholder = "โ€ฆ",
    queries = {

      -- Some examples you can use
      html = {
        { pattern = 'class="([^"]*)"', placeholder = "@" }, -- classes in html
        { pattern = 'href="(.-)"' }, -- hrefs in html
        { pattern = 'src="(.-)"' }, -- HTML img src attribute
      }
    },
  }
}

Usage

Once installed, the plugin provides the following functionality:

Commands

  • InlineFoldToggle: Toggles the folding of the content within CSS class attributes.

Call InlineFoldToggle via autocmd

Add the following snippet to your configurations to call InlineFoldToggle automatically based on filename patterns.

vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
  pattern = { '*.html', '*.tsx' },
  callback = function(_)
    if not require('inline-fold.module').isHidden then
      vim.cmd('InlineFoldToggle')
    end
  end,
})

Todo List ๐Ÿ“

  • Check if moving to Treesitter is viable
  • Create some sub commands for updating and removing conceals
  • Record showcase

License

This project is licensed under the MIT License.

inline-fold.nvim's People

Contributors

malbertzard avatar 3719e04 avatar eucaue 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.