• Home
  • Raw
  • Download

Lines Matching +full:clang +full:- +full:format

1 # This file is a minimal clang-format vim-integration. To install:
2 # - Change 'binary' if clang-format is not on the path (see below).
3 # - Add to your .vimrc:
5 # map <C-I> :pyf <path-to-this-file>/clang-format.py<cr>
6 # imap <C-I> <c-o>:pyf <path-to-this-file>/clang-format.py<cr>
8 # The first line enables clang-format for NORMAL and VISUAL mode, the second
9 # line adds support for INSERT mode. Change "C-I" to another binding if you
10 # need clang-format on a different key (C-I stands for Ctrl+i).
12 # With this integration you can press the bound key and clang-format will
13 # format the current line in NORMAL and INSERT mode or the selected region in
19 # "all" to format the full file. So, to format the full file, write a function
23 # : pyf <path-to-this-file>/clang-format.py
35 # set g:clang_format_path to the path to clang-format if it is not on the path
36 # Change this to the full path if clang-format is not on the path.
37 binary = 'clang-format'
41 # Change this to format according to other formatting styles. See the output of
42 # 'clang-format --help' for a list of supported styles. The default looks for
43 # a '.clang-format' or '_clang-format' file to indicate the style that should be
55 # Determine range to format.
62 cursor = int(vim.eval('line2byte(line("."))+col(".")')) - 2
67 # Avoid flashing an ugly, ugly cmd prompt on Windows when invoking clang-format.
75 command = [binary, '-style', style, '-cursor', str(cursor)]
77 command.extend(['-lines', lines])
79 command.extend(['-fallback-style', fallback_style])
81 command.extend(['-assume-filename', vim.current.buffer.name])
92 print ('No output from clang-format (crashed?).\n' +
103 print 'clang-format: incomplete (syntax errors)'