Skip to content

Commit 1b76987

Browse files
authored
Allow commands to be followed by a |. (#209)
This is useful for allowing conditional formatting of buffers, e.g., ```vim autocmd FileType * if condition | AutoFormatBuffer | endif ```
1 parent 64ffe07 commit 1b76987

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugin/commands.vim

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,25 @@ endfunction
4343
""
4444
" Format the current line or range using [formatter].
4545
" @default formatter=the default formatter associated with the current buffer
46-
command -nargs=? -range -complete=custom,codefmt#GetSupportedFormatters
46+
command -nargs=? -bar -range -complete=custom,codefmt#GetSupportedFormatters
4747
\ FormatLines call s:FormatLinesAndSetRepeat(<line1>, <line2>, <f-args>)
4848

4949
""
5050
" Format the whole buffer using [formatter].
5151
" See @section(formatters) for list of valid formatters.
5252
" @default formatter=the default formatter associated with the current buffer
53-
command -nargs=? -complete=custom,codefmt#GetSupportedFormatters
53+
command -nargs=? -bar -complete=custom,codefmt#GetSupportedFormatters
5454
\ FormatCode call s:FormatBufferAndSetRepeat(<f-args>)
5555

5656
""
5757
" Enables format on save for this buffer using [formatter]. Also configures
5858
" [formatter] as the default formatter for this buffer via the
5959
" @setting(b:codefmt_formatter) variable.
6060
" @default formatter=the default formatter associated with the current buffer
61-
command -nargs=? -complete=custom,codefmt#GetSupportedFormatters
61+
command -nargs=? -bar -complete=custom,codefmt#GetSupportedFormatters
6262
\ AutoFormatBuffer call s:AutoFormatBuffer(<f-args>)
6363

6464
""
6565
" Disables format on save for this buffer.
66-
command -nargs=0 NoAutoFormatBuffer let b:codefmt_auto_format_buffer = 0
66+
command -nargs=0 -bar NoAutoFormatBuffer let b:codefmt_auto_format_buffer = 0
6767

0 commit comments

Comments
 (0)