Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove added spaces (on save) #10

Open
deanishe opened this issue Feb 3, 2014 · 3 comments
Open

Remove added spaces (on save) #10

deanishe opened this issue Feb 3, 2014 · 3 comments

Comments

@deanishe
Copy link

deanishe commented Feb 3, 2014

I write a lot of vocab lists and the TSV format with ElasticTabstops makes that very pleasant. The auto-alignment is very helpful for editing. But I'd like to be able to save the files without the extra spaces, so the saved files are valid.

I wrote a simple plugin to do this myself, but newer versions of ElasticTabstops fire immediately after my plugin runs, putting all the spaces back in :(

Would it be possible for ElasticTabstops to have a remove_spaces_on_save option, so correct TSV files are saved, and the spaces are only added to help with editing?

@adzenith
Copy link
Member

adzenith commented Feb 4, 2014

Would you be up for merging your plugin into ElasticTabstops and sending a pull request?
Thanks!

@deanishe
Copy link
Author

deanishe commented Feb 7, 2014

My plugin is not good enough to be merged into ElasticTabstops. It is basically broken for anything beyond my very simple needs—it just naively mashes the text through csv.reader and csv.writer.

I'm honestly not sure how I would go about doing it properly (i.e. not deleting spaces inside quotes etc.)

@adzenith
Copy link
Member

adzenith commented Feb 7, 2014

If I were writing it, I wouldn't make it tsv-aware (i.e., ignoring quotes and so forth), I would simply search for something like the following regex:
 +\t
and replace it with a tab character. I would do it this way because the formatting isn't tsv-aware (i.e. it also breaks if you put a tab inside of quotes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants