Is there anything like vim-ultisnips that i can use in the terminal (zsh)

Chris@lemmy.world to Linux@lemmy.ml – 1 points –

like the title says, i've been trying to replicate the snippet functionality of vim ultisnips, so i can expand "fn" into find ./ '*$1* , and then at $1 i can type "or" to expand to find ./ \( -name '*$1*' -o -name '*$2*' $3 \) $4. if i need to add a third pattern to that i can add onm at $4 to expand into -o -name '*$1*' $2 where i can add yet another onm at $2, or "! or" to add a bunch of patterns i can exclude. i have a bunch of these set up in neovim, for a bunch of commands, and they save me so much time, but when it comes to writing them in the terminal it feels like i'm typing in porridge.

i know i can open the current line in $EDITOR, and this is super useful, but it still breaks my flow more than i'd like, and unless the command is particularly long and awkward it's easier just to bash it out like a caveman.

there's also a tool called "pet", but despite going over the github page a few times, i can't work out whether it will offer the ability to nest snippets like this. it seems like it's just a glorified version of the functions i can set in my zshrc, where i'd need to write all the various combinations of the find command (for eg), rather than the flexibility of ultisnips. if you use pet and can confirm that it does this, then consider the thread closed ha.

sorry for the long post. i'm not really a codey scripty person, i'm just somebody who installed linux mint a few years back and realised that the command line is sort of really cognitively ergonomic (most of the time).

0

No comments yet. You could be first!