Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions autoload/codefmt/clangformat.vim
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ function! codefmt#clangformat#GetFormatter() abort
""
" Reformat buffer with clang-format, only targeting [ranges] if given.
function l:formatter.FormatRanges(ranges) abort
if line('$') == 1 && getline(1) == ''
" If the buffer is completely empty, there's nothing to do
return
endif

let l:Style_value = s:plugin.Flag('clang_format_style')
if type(l:Style_value) is# type('')
let l:style = l:Style_value
Expand Down
7 changes: 7 additions & 0 deletions vroom/clangformat.vroom
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,10 @@ current buffer.

The -assume-filename arg passed above is also related, used by the clang-format
tool to detect any custom style rules particular to the current file.


Bug #102. When the buffer is empty, clang-format does _not_ return a cursor
position

@clear
:FormatCode clang-format