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

Code Style Formater #348

Open
davidsonbr opened this issue Aug 29, 2015 · 2 comments
Open

Code Style Formater #348

davidsonbr opened this issue Aug 29, 2015 · 2 comments
Assignees

Comments

@davidsonbr
Copy link

Something like LuaDoc that can go through all / some code an format it into the proper code style.

@awilliamson
Copy link
Member

This is what we developed a little while ago, me and @Xandaros both use vim. If you can decipher this and convert to gsub for Lua, then good luck.

"Spaces after [ and before ]"
Macro recorded into a:
qaa<space><esc>f]i<space><esc>q

Find all the [something] instances. [ and ] without spaces after and before.
/[[^ ]

Replace "[x" with "[ x" and confirm; omits [] from search
:%s/[\([^ ]]\)/[ \1/gc

Replace "x]" with "x ]" and confirm; omits [] from search
:%s/\([^ []\)]/\1 ]/gc

Replace "(x" with "( x" and confirm; omits () from search
:%s/(\([^ )]\)/( \1/gc

Replace "x)" with "x )" and confirm; omits () from search
:%s/\([^ (]\))/\1 )/gc

Replace:
function name(
with
function name (

:%s/function \([^ ]*\)(/function \1 (/gc

replace:
function(
with
function (
:%s/function(/function (/gc

@davidsonbr
Copy link
Author

Dealing with braces strings is hurting my brain so I am going to wait on this.

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

No branches or pull requests

2 participants