Avi Drissman | dfd88085 | 2022-09-15 20:11:09 | [diff] [blame] | 1 | " Copyright 2014 The Chromium Authors |
[email protected] | 502efd81 | 2014-01-16 19:45:44 | [diff] [blame] | 2 | " Use of this source code is governed by a BSD-style license that can be |
3 | " found in the LICENSE file. | ||||
4 | |||||
Lei Zhang | 8fe4541 | 2020-10-28 01:36:56 | [diff] [blame] | 5 | " Binds cmd-shift-i (on Mac) or ctrl-i (elsewhere) to invoke clang-format.py. |
[email protected] | 502efd81 | 2014-01-16 19:45:44 | [diff] [blame] | 6 | " It will format the current selection (and if there's no selection, the |
7 | " current line.) | ||||
8 | |||||
9 | let s:script = expand('<sfile>:p:h') . | ||||
[email protected] | 394980a2 | 2014-07-02 13:12:13 | [diff] [blame] | 10 | \'/../../buildtools/clang_format/script/clang-format.py' |
Sidney San Martín | fe5c01de | 2019-02-15 20:47:32 | [diff] [blame] | 11 | let s:shortcut = has('mac') ? "<D-I>" : "<C-I>" |
12 | let s:pyf = has("python3") ? ":py3f" : ":pyf" | ||||
[email protected] | 502efd81 | 2014-01-16 19:45:44 | [diff] [blame] | 13 | |
Sidney San Martín | fe5c01de | 2019-02-15 20:47:32 | [diff] [blame] | 14 | execute "map" s:shortcut s:pyf s:script . "<CR>" |
Wojciech Dzierżanowski | dabad23 | 2019-03-29 17:19:55 | [diff] [blame] | 15 | execute "imap" s:shortcut "<ESC>" s:pyf s:script . "<CR>i" |