File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,11 @@ function! codefmt#clangformat#GetFormatter() abort
129
129
" "
130
130
" Reformat buffer with clang-format, only targeting [ranges] if given.
131
131
function l: formatter .FormatRanges (ranges ) abort
132
+ if line (' $' ) == 1 && getline (1 ) == ' '
133
+ " If the buffer is completely empty, there's nothing to do
134
+ return
135
+ endif
136
+
132
137
let l: Style_value = s: plugin .Flag (' clang_format_style' )
133
138
if type (l: Style_value ) is # type (' ' )
134
139
let l: style = l: Style_value
Original file line number Diff line number Diff line change @@ -181,3 +181,10 @@ current buffer.
181
181
182
182
The -assume-filename arg passed above is also related, used by the clang-format
183
183
tool to detect any custom style rules particular to the current file.
184
+
185
+
186
+ Bug #102. When the buffer is empty, clang-format does _not_ return a cursor
187
+ position
188
+
189
+ @clear
190
+ :FormatCode clang-format
You can’t perform that action at this time.
0 commit comments