Reformats your Lua source code.
- VS Code: https://github.com/Koihik/vscode-lua-format
- Sublime: https://github.com/Koihik/sublime-lua-format
- Vim: https://github.com/andrejlevkovitch/vim-lua-format
The easiest way to install is to use LuaRocks.
luarocks install --server=https://luarocks.org/dev luaformatter
- cmake 3.9+
- c++ 17 compiler
- luarocks 3.3.0+
git clone --recurse-submodules https://github.com/Koihik/LuaFormatter.git
cd LuaFormatter
cmake .
make
make install
./lua-format [Lua scripts...] {OPTIONS}
Reformats your Lua source code.
OPTIONS:
-h, --help Display this help menu
-v, --verbose Turn on verbose mode
-i Reformats in-place
--dump-config Dumps the default style used to stdout
-c[file], --config=[file] Style config file
Lua scripts... Lua scripts to format
"--" can be used to terminate flag options and force all following
arguments to be treated as positional options
The program will attempt to automatically use the current directory's .lua-format
file if no config file is passed in the command line.
In case there's no file, it will fallback to the default configuration.
Configuration parameters not specified fallback to their default values.
See this file
column_limit: 80
indent_width: 4
use_tab: false
tab_width: 4
continuation_indent_width: 4
spaces_before_call: 1
keep_simple_control_block_one_line: true
keep_simple_function_one_line: true
align_args: true
break_after_functioncall_lp: false
break_before_functioncall_rp: false
align_parameter: true
chop_down_parameter: false
break_after_functiondef_lp: false
break_before_functiondef_rp: false
align_table_field: true
break_after_table_lb: true
break_before_table_rb: true
chop_down_table: false
chop_down_kv_table: true
table_sep: ","
column_table_limit: column_limit
extra_sep_at_table_end: false
break_after_operator: true
double_quote_to_single_quote: false
single_quote_to_double_quote: false
- Do not work when source file contains syntax error
- Do not support 'Format selection'