From 530b38de342a21cce330a32af0c1b66671d335c2 Mon Sep 17 00:00:00 2001 From: "D. Ben Knoble" Date: Fri, 23 Jul 2021 08:59:31 -0400 Subject: Vim popup (#3817) * implement vim popups for preview Details on implementation ------------------------- - we make use of the |popupwin| api - we split implementations (Nvim* vs. Vim* prefix) and call the right one based on has('nvim') - we follow a similar structure in each function, using the relevant API - popup_list, win_execute, popup_settext in VimShow - popup_create in VimCreate - popup_close in VimClose Some differences ---------------- - we DON'T have VimPrepareWindowContent because we use arguments to popup_create for borders, padding, etc., and it also takes care of buffer creation. - we follow the protocol of setting and using w:preview for information, but we only need the ID - InsertEnter is the only autocommand required, because of popup_create's moved argument. Any cursor movement with 'any' will close the popup. This in turns means VimClose is only called from InsertMode, so no mode-restoration necessary - we don't tweak too much in the buffer because vim's popup buffers already have most relevant settings and aren't editable without calling popup functions. - I enabled scrollbars, close buttons, dragging, and resizing - vim popups get as big as they need to by default, so no worrying about truncating/hiding/size Note: we might want to consider changing w:preview to w:ale_preview to avoid clashes if someone else tries to use the same variable * floating window: document that vim supports it * lint: fix indent/cont. lines --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index e0934694..697f2d87 100644 --- a/README.md +++ b/README.md @@ -930,6 +930,13 @@ make it look nicer. let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰'] ``` +Since vim's default uses nice unicode characters when possible, you can trick +ale into using that default with + +```vim +let g:ale_floating_window_border = repeat([''], 6) +``` + ### 5.xxii. How can I use ALE and vim-lsp together? -- cgit v1.2.3