Use an LLM to select text. In neovim there’s a way to set up treesitter such that let’s say my cursor is indicated by |
in this text and [
represents highlight start and ]
represents highlight end
function doSomething(){
const a = {
name: "jon|",
}
return a
}
You can utilize tree-sitter to select the treesitter node outside of the one you have highlighted and for example pressing ctrl + space sequentially would do this
1 press
function doSomething(){
const a = {
name: ["jon|"],
}
return a
}
2 presses
function doSomething(){
const a = {
[name: "jon|",]
}
return a
}
3 presses
function doSomething(){
const a = [{
name: "jon|",
}]
return a
}
4 presses
function doSomething(){
[const a = {
name: "jon|",
}]
return a
}
5 presses
[function doSomething(){
const a = {
name: "jon|",
}
return a
}]
My “Super Highlight” command would be, use an LLM or treesitter depending on file type to do the same thing.
For example, let’s say you’re editing markdown, and you may want to highlight a sentence, just spam your super highlight shortcut until you get what you want. Then cut that text, copy it, or do whatever you want with it after.
The value proposition here is that I think it’s another extension to how AI is used to make things that we commonly did before more intuitive. For example let’s say that I wanted to highlight a url in a block of text.
If you want to hang out with me then come to [PenguinChat](penguinchat.com)
Well if my cursor is anywhere on that line, I can just spam my Magic Highlight Command button until it highlights the thing I want then I can just copy it or cut it or whatever. Now even if it takes 5-10 tries, I think that’s actually a pretty improved workflow to what most people would do there.
In contrast, in vim to do the same thing I would do this: f(va(
, which granted is only 5 keystrokes but…
- it requires brainpower if you know vim
- if you don’t know vim well, or if you don’t have vim, it’s going to take a lot more keystrokes
- Not all urls are wrapped in parenthesis and are easy to select
- Not all text patterns in general match a good vim keystroke combo
Anyways just a fun idea that I could imagine actually working out pretty well if done right