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

[Feature Request] Use tabs instead of spaces when pretty printing #38

Closed
Kiryonn opened this issue Jun 20, 2023 · 3 comments · Fixed by notepad-plus-plus/nppPluginList#633
Labels
enhancement New feature or request

Comments

@Kiryonn
Copy link

Kiryonn commented Jun 20, 2023

As in the title, adding the possibility to choose between spaces and tabs.

@molsonkiko
Copy link
Owner

molsonkiko commented Jun 20, 2023

I may consider doing this in the future. It's not a high priority because (a) adding a new special case to my pretty-printing functions would increase code bloat and impair performance, (b) all the usual reasons that people object to using tabs for indentation, and (c) if you care about saving space when printing JSON, you should just compress it.

Suppose you want to indent with tabs, and you have n spaces for indentation.
Use the find/replace form (regular expression ON). Find/replace (?:^|(?!\A)\G)\t*\K\x20{n} with \t to convert all leading sequences of n spaces to tabs.

See this guide for more info on regular expressions.

@molsonkiko molsonkiko added the enhancement New feature or request label Jun 20, 2023
@Kiryonn
Copy link
Author

Kiryonn commented Jun 20, 2023

I already replace 4 spaces with tab using Ctr+h, which isn't that hard nor a pain to deal with tbh. It's just that i'm lazy and like tabs better since you can get better space management while having a readable code.
I do agree that for using json in a code I'd rather just compress it.
I just find spaces as annoying as tall grass in minecraft. Can be pretty, but it's a sore for the brain.

molsonkiko added a commit that referenced this issue Jun 27, 2023
Also improve unit test coverage of python-style slices
@molsonkiko
Copy link
Owner

Closed by latest commit.

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

Successfully merging a pull request may close this issue.

2 participants