unixwork/xnedit

Apply filter when loading and saving files with a given extension

Closed this issue · 4 comments

cblc commented

I don't know if this feature could already be added with the current macro/shell system in XNEdit. What I'd like to do is to invoke a shell command as a filter when the file being opened ends with a given extension, and also invoke another filter (symmetric but with potentially a different command name) when the file is saved with that extension.

My purpose in this moment is because I'm working with some xz-compressed files, but I foresee other possible uses (even perhaps being able to use XNEdit as a rudimentary hex-editor, although maybe that's too crazy 🤣

Interesting idea. I think it is not possible currently with macros. Also integration into the open/save file dialog would be needed.

I merged a new feature into master, that allows you to run filter commands when opening/saving files.

Filters can be configured in Preferences -> Default Settings -> Filters. There are predefined filters for gzip/bzip2.

cblc commented

Thank you very much!! I will build it this week. BTW, XNEdit has become now the only code editor I use in my Macs now. About 20 years ago, I used NEdit in SGI IRIX as my text editor, and then when my main system became OSX, I built NEdit on it, but, with the years, I moved to TextWrangler (NEdit was becoming more and more limited with the years). But now XNEdit has made it possible to go back, and it's the only editor I use. Thanks a lot!!

cblc commented

I think I'll mark this as complete, and if I have anything to add, I'll reopen it.