@@ -170,24 +170,50 @@ g:lsp_preview_float *g:lsp_preview_float*
170
170
are shown in a floating window as | preview-window | at the cursor position.
171
171
The | preview-window | is closed automatically on cursor moves, unless it is
172
172
focused. While focused it may be closed with <esc> .
173
- After opening an autocmd User event lsp_float_opened is issued, as well as
174
- and lsp_float_closed upon closing. This can be used to alter the preview
175
- window (using lsp#ui#vim#output#getpreviewwinid() to get the window id), or
176
- setup custom bindings while a preview is open.
173
+
177
174
This feature requires neovim 0.4.0 (current master) or
178
175
Vim8.1 with has('patch-8.1.1517').
179
176
180
177
Example:
178
+ >
181
179
" Opens preview windows as floating
182
180
let g:lsp_preview_float = 1
183
181
184
182
" Opens preview windows as normal windows
185
183
let g:lsp_preview_float = 0
184
+ <
186
185
186
+ After opening an autocmd User event lsp_float_opened is issued, as well as
187
+ and lsp_float_closed upon closing. This can be used to alter the preview
188
+ window (using lsp#ui#vim#output#getpreviewwinid() to get the window id),
189
+ setup custom bindings while a preview is open, or change the highlighting
190
+ of the window.
191
+
192
+ Example of custom keybindings:
193
+ >
187
194
" Close preview window with <esc>
188
195
autocmd User lsp_float_opened nmap <buffer> <silent> <esc>
189
196
\ <Plug>(lsp-preview-close)
190
197
autocmd User lsp_float_closed nunmap <buffer> <esc>
198
+ <
199
+
200
+ Example of customising the highlighting:
201
+ >
202
+ highlight PopupWindow ctermbg=lightblue guibg=lightblue
203
+
204
+ augroup lsp_float_colours
205
+ autocmd!
206
+ if !has('nvim')
207
+ autocmd User lsp_float_opened
208
+ \ call win_execute(lsp#ui#vim#output#getpreviewwinid(),
209
+ \ 'setlocal wincolor=PopupWindow')
210
+ else
211
+ autocmd User lsp_float_opened
212
+ \ call nvim_win_set_option(lsp#ui#vim#output#getpreviewwinid(),
213
+ \ 'winhighlight', 'Normal:PopupWindow')
214
+ endif
215
+ augroup end
216
+ <
191
217
192
218
g:lsp_preview_autoclose *g:lsp_preview_autoclose*
193
219
Type: | Number |
@@ -750,7 +776,7 @@ Closes an opened preview window
750
776
Transfers focus to an opened preview window or back to the previous window if
751
777
focus is already on the preview window.
752
778
753
-
779
+
754
780
===============================================================================
755
781
Autocomplete *vim-lsp-autocomplete*
756
782
0 commit comments