Skip to content

Commit

Permalink
Auto merge of #2635 - micbou:update-autocommand-examples, r=micbou
Browse files Browse the repository at this point in the history
[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 -->
  • Loading branch information
homu committed May 5, 2017
2 parents ba779af + f7db6a1 commit 5a806dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
10 changes: 6 additions & 4 deletions doc/youcompleteme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 5a806dc

Please sign in to comment.