Auto merge of #2635 - micbou:update-autocommand-examples, r=micbou

[READY] Update autocommands examples in documentation

I am not aware of a Vim option to not switch to the location list (or quickfix) window when calling `lopen` (respectively `copen`) so I think it's a good idea to give an example in the docs on how to achieve this using the `YcmLocationOpened` and `YcmQuickFixOpened` autocommands.

Also, the `execute` calls are not needed.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2635)
<!-- Reviewable:end -->
This commit is contained in:
Homu 2017-05-06 07:16:42 +09:00
commit 5a806dcb30
2 changed files with 12 additions and 8 deletions

View File

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

View File

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