blob: ae2d64a3d6400cdf282052fa5bccab7cdeb0c297 [file] [log] [blame]
" Copyright 2014 The Chromium Authors
" Use of this source code is governed by a BSD-style license that can be
" found in the LICENSE file.
" Binds cmd-shift-i (on Mac) or ctrl-i (elsewhere) to invoke clang-format.py.
" It will format the current selection (and if there's no selection, the
" current line.)
let s:script = expand('<sfile>:p:h') .
\'/../../third_party/clang-format/script/clang-format.py'
let s:shortcut = has('mac') ? "<D-I>" : "<C-I>"
let s:pyf = has("python3") ? ":py3f" : ":pyf"
execute "map" s:shortcut s:pyf s:script . "<CR>"
execute "imap" s:shortcut "<ESC>" s:pyf s:script . "<CR>i"