Did you ever felt like doing daf and then p to paste a function somewhere else without having to care if the cursor is in the middle of a function or not, in the same way as doing dd followed by p to move a line somewhere? Then anywise-reg is for you.

This page summarizes the projects mentioned and recommended in the original post on /r/neovim

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • nvim-treesitter-textobjects

  • One of the most satisfying things, in my opinion, when using vim is the ease of doing xp or ddp to move a character to the right or a line down. The reason this works (using a single key p for pasting) is that vim keeps track of what was yanked. In particular vim keeps track if the yank was charwise, linewise or blockwise, in order to determine how the content of the register should be pasted. Now, wouldn't it be amazing if this notion could be generalised to more complex patterns, such as words (daw), paragraphs (dap) or functions and classes (daf, dac from e.g. nvim-treesitter-textobjects). This is exactly what anywise-reg does, namely extending the registers to not only have a notion of charwise, linewise and blockwise but any pattern. anywise-reg keeps track of what text-object was used for yanking (deleting, changing etc) the text (and into what register) in order to determine how to paste it. Before pasting, the cursor is simply moved to the end of the same text-object, currently under the cursor. In this way there is no hard-coded behaviour, rather the text-objects behaviour is reused and therefore any text-object could be used. This also means that it is all up to the text-object to do the correct thing. All the registers " and [0-9][a-z] are supported and anywise-reg updates for example the numbered registers when deleting text.

  • nvim-anywise-reg.lua

    Plugin for making registers content-aware beyond char- and linewise

  • One of the most satisfying things, in my opinion, when using vim is the ease of doing xp or ddp to move a character to the right or a line down. The reason this works (using a single key p for pasting) is that vim keeps track of what was yanked. In particular vim keeps track if the yank was charwise, linewise or blockwise, in order to determine how the content of the register should be pasted. Now, wouldn't it be amazing if this notion could be generalised to more complex patterns, such as words (daw), paragraphs (dap) or functions and classes (daf, dac from e.g. nvim-treesitter-textobjects). This is exactly what anywise-reg does, namely extending the registers to not only have a notion of charwise, linewise and blockwise but any pattern. anywise-reg keeps track of what text-object was used for yanking (deleting, changing etc) the text (and into what register) in order to determine how to paste it. Before pasting, the cursor is simply moved to the end of the same text-object, currently under the cursor. In this way there is no hard-coded behaviour, rather the text-objects behaviour is reused and therefore any text-object could be used. This also means that it is all up to the text-object to do the correct thing. All the registers " and [0-9][a-z] are supported and anywise-reg updates for example the numbered registers when deleting text.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • config

  • nvim-treesitter

    Nvim Treesitter configurations and abstraction layer

  • Theoretically, it's already supported by nvim-treesitter-textobjects module. The problem is though, nvim-treesitter-refactor which is responsible for the highlighting does not sync with the text-object part. There's an issue I opened some months ago: https://github.com/nvim-treesitter/nvim-treesitter/issues/1258. I think it should give more context, if you are interested

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Help needed with Treesitter sql injection

    1 project | /r/neovim | 7 Dec 2023
  • Problem with highlighting when attempting to create own treesitter parser

    2 projects | /r/neovim | 5 Dec 2023
  • Getting Treesitter to work for Windows 10

    1 project | /r/neovim | 19 Nov 2023
  • Just come back up out of the rabbit hole - TS unsets syntax variable by design!

    1 project | /r/neovim | 15 Aug 2023
  • nvim-treesitter erroring on Windows 11 Pro

    1 project | /r/neovim | 5 Jul 2023