knqyf263 / pet

Simple command-line snippet manager
MIT License
4.58k stars 230 forks source link

Fix for #314 - unnecessary +0 as a cmd parameter in editFile #319

Closed jaroslawhartman closed 3 weeks ago

jaroslawhartman commented 1 month ago

Issue #, if available: #314

Description of changes:

Fix for #314 - unnecessary +0 as a cmd parameter in editFile

For details see https://github.com/knqyf263/pet/issues/314#issuecomment-2396940532

RamiAwar commented 1 month ago

I'd like to make this conditional on the editor, then we won't mess up the editing experience in some editors.

For example, for visual studio code we can add this custom argument:

-g or --goto | When used with file:line{:character}, opens a file at a specific line and optional character position. This argument is provided since some operating systems permit : in a file name.
-- | --

For vi/vim/?nano? the + provides a great user experience by putting the cursor right where the new snippet template was inserted.

This looks like a nice place to add a simple design pattern, maybe the Command pattern? wdyt @jaroslawhartman

RamiAwar commented 3 weeks ago

A good start is simply separating windows/unix here. We can iterate on this later.