r220685 - clang-format: improve vim integration docs

Saleem Abdulrasool compnerd at compnerd.org
Mon Oct 27 10:13:34 PDT 2014


Author: compnerd
Date: Mon Oct 27 12:13:33 2014
New Revision: 220685

URL: http://llvm.org/viewvc/llvm-project?rev=220685&view=rev
Log:
clang-format: improve vim integration docs

Improve the documentation for vim integration of clang-format.  Prefer the use
of <c-o> to do the normal mode command execution to avoid side-effects of the
escape and re-insertion (cursor movement).  Tweak the macros to use a double
return to avoid having to manually return control to the editor from the
subprocess.

Modified:
    cfe/trunk/docs/ClangFormat.rst
    cfe/trunk/tools/clang-format/clang-format.py

Modified: cfe/trunk/docs/ClangFormat.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormat.rst?rev=220685&r1=220684&r2=220685&view=diff
==============================================================================
--- cfe/trunk/docs/ClangFormat.rst (original)
+++ cfe/trunk/docs/ClangFormat.rst Mon Oct 27 12:13:33 2014
@@ -96,8 +96,8 @@ This can be integrated by adding the fol
 
 .. code-block:: vim
 
-  map <C-K> :pyf <path-to-this-file>/clang-format.py<CR>
-  imap <C-K> <ESC>:pyf <path-to-this-file>/clang-format.py<CR>i
+  map <C-K> :pyf <path-to-this-file>/clang-format.py<cr><cr>
+  imap <C-K> <c-o>:pyf <path-to-this-file>/clang-format.py<cr><cr>
 
 The first line enables :program:`clang-format` for NORMAL and VISUAL mode, the
 second line adds support for INSERT mode. Change "C-K" to another binding if

Modified: cfe/trunk/tools/clang-format/clang-format.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.py?rev=220685&r1=220684&r2=220685&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/clang-format.py (original)
+++ cfe/trunk/tools/clang-format/clang-format.py Mon Oct 27 12:13:33 2014
@@ -2,8 +2,8 @@
 # - Change 'binary' if clang-format is not on the path (see below).
 # - Add to your .vimrc:
 #
-#   map <C-I> :pyf <path-to-this-file>/clang-format.py<CR>
-#   imap <C-I> <ESC>:pyf <path-to-this-file>/clang-format.py<CR>i
+#   map <C-I> :pyf <path-to-this-file>/clang-format.py<cr>
+#   imap <C-I> <c-o>:pyf <path-to-this-file>/clang-format.py<cr><cr>
 #
 # The first line enables clang-format for NORMAL and VISUAL mode, the second
 # line adds support for INSERT mode. Change "C-I" to another binding if you





More information about the cfe-commits mailing list