Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: tools/vim/clang-format.vim

Issue 140513005: Add a simple script to simplify using clang-format from vim. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/vim/clang-format.vim
diff --git a/tools/vim/clang-format.vim b/tools/vim/clang-format.vim
new file mode 100644
index 0000000000000000000000000000000000000000..ab91f133b558555f1301cdcd7b050cb393416af3
--- /dev/null
+++ b/tools/vim/clang-format.vim
@@ -0,0 +1,21 @@
+" Copyright (c) 2013 The Chromium Authors. All rights reserved.
scottmg 2014/01/16 19:42:12 LIVE IN THE NOW
Nico 2014/01/16 19:44:12 but i was younger back then
+" 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-shift-i (elsewhere) to invoking
+" 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/scripts/clang-format.py'
+echo s:script
+
+if has('mac')
+ execute "map <D-I> :pyf " . s:script . "<CR>"
+ execute "imap <D-I> <ESC>:pyf " . s:script . "<CR>i"
+else
+ execute "map <C-I> :pyf " . s:script . "<CR>"
+ execute "imap <C-I> <ESC>:pyf " . s:script . "<CR>i"
+endif
+
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698