Browse Source

Update autocommands examples

micbou 8 years ago
parent
commit
f7db6a1f36
2 changed files with 12 additions and 8 deletions
  1. 6 4
      README.md
  2. 6 4
      doc/youcompleteme.txt

+ 6 - 4
README.md

@@ -1652,9 +1652,11 @@ For instance:
 ```viml
 function! s:CustomizeYcmLocationWindow()
   " Move the window to the top of the screen.
-  execute "wincmd K"
+  wincmd K
   " Set the window height to 5.
-  execute "5wincmd _"
+  5wincmd _
+  " Switch back to working window.
+  wincmd p
 endfunction
 
 autocmd User YcmLocationOpened call s:CustomizeYcmLocationWindow()
@@ -1671,9 +1673,9 @@ instance:
 ```viml
 function! s:CustomizeYcmQuickFixWindow()
   " Move the window to the top of the screen.
-  execute "wincmd K"
+  wincmd K
   " Set the window height to 5.
-  execute "5wincmd _"
+  5wincmd _
 endfunction
 
 autocmd User YcmQuickFixOpened call s:CustomizeYcmQuickFixWindow()

+ 6 - 4
doc/youcompleteme.txt

@@ -1946,9 +1946,11 @@ For instance:
 >
   function! s:CustomizeYcmLocationWindow()
     " Move the window to the top of the screen.
-    execute "wincmd K"
+    wincmd K
     " Set the window height to 5.
-    execute "5wincmd _"
+    5wincmd _
+    " Switch back to working window.
+    wincmd p
   endfunction
   
   autocmd User YcmLocationOpened call s:CustomizeYcmLocationWindow()
@@ -1965,9 +1967,9 @@ quickfix window. For instance:
 >
   function! s:CustomizeYcmQuickFixWindow()
     " Move the window to the top of the screen.
-    execute "wincmd K"
+    wincmd K
     " Set the window height to 5.
-    execute "5wincmd _"
+    5wincmd _
   endfunction
   
   autocmd User YcmQuickFixOpened call s:CustomizeYcmQuickFixWindow()