hstr icon indicating copy to clipboard operation
hstr copied to clipboard

template?

Open zvezdochiot opened this issue 4 years ago • 3 comments

On the basis of favorites, build a model of templates - almost the same as favorites, but adapted to quickly insert values? That is, one value can be inserted at once in several places of template. See https://github.com/knqyf263/pet

zvezdochiot avatar Oct 28 '19 20:10 zvezdochiot

@zvezdochiot it sounds like really nice idea! Can you please elaborate it more?

  • Can you please give an example for templates entry?
  • How would user add new template entry? From HSTR or by editing a file like ~/.hstr-templates?
  • How exactly would use of templates look like?
    • I change view to templates.
    • I choose a template (row).
    • HSTR asks me to fill in a value.
    • Given value is substitued in template and command is executed?

Please correct me if I didn't get it.

dvorka avatar Dec 07 '19 15:12 dvorka

Can you please an example for templates entry?

%%mkdir dskw; for tpng in *.png; do convert -verbose -deskew 50% "$tpng" "dskw/$tpng"; done %%dskw %%png

The first character (and the number of repetitions) defines the delimiter of the pattern and parameters. Use:

%%mkdir dskw; for tpng in *.png; do convert -verbose -deskew 50% "$tpng" "dskw/$tpng"; done %%dskw %%png
dk jpg
=>
mkdir dk; for tjpg in *.jpg; do convert -verbose -deskew 50% "$tjpg" "dk/$tjpg"; done

In this case, I use the usual replacement (the simplest). Works on the principle of sed. It is possible in another way. But here it is necessary to experiment.

zvezdochiot avatar Dec 07 '19 22:12 zvezdochiot

Got it :+1: Thanks @zvezdochiot!

dvorka avatar Dec 08 '19 08:12 dvorka