wadetb / Sublime-Text-Advanced-CSV

Efficiently format, edit, arrange, and evaluate cells in CSV files
169 stars 14 forks source link

Allow to change the delimiter temporarily for a view #10

Closed aziz closed 9 years ago

aziz commented 9 years ago

I opened a csv that happened to be | separated and realized your package can format it. I don't want to change the delimiter globally but it would be nice to have a command that changes the delimiter for this view temporarily.

wadetb commented 9 years ago

Any suggestions about the best way to implement this cleanly?

The original "csv" package has this feature but does so by saving a dict of filenames in the global configuration file, which seemed bad to me.

One possibility would be to store a mapping of filename regex -> delimiter in the plugin settings file. Not being in the mapping would disable the CSV tools per your other ticket. Being in the mapping would set the delimiter (and other settings).

Would that be sufficient or do you really think a "change it for just this file" feature is needed? (I suppose that would be just a shortcut to editing the user prefs)

aziz commented 9 years ago

I think it's better to keep things simple, just make it non persistent. set CSV delimiter for this view only. open an input panel at the bottom read the delimiter and save it on view.settings() I'll send a pull request as soon as I got some time.

wadetb commented 9 years ago

I have had one other request to change the delimiter temporarily, so that is definitely going in.

I may still do the filename -> delimiter setting as well, with builtin support for "tsv" files.

One open question is how to communicate the delimiter to the syntax highlighting; the regular expressions driving syntax highlighting aren't (I believe) affected by the plugin code.

cxbig commented 9 years ago

I need to deal with 3 types separator: tab, comma, pipe. It's not convenient to switch separator. And it's hard to open this extension config file. To have a shortcut will be better.

wadetb commented 9 years ago

Shortcut has been added; it's saved for the view in the project file.