diff options
| author | itchyny <itchyny@cybozu.co.jp> | 2024-02-20 20:57:13 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-20 03:57:13 -0800 |
| commit | ddda5e0a488bce19c86e04fa823069b755fac779 (patch) | |
| tree | 31857e5b8b9bc6b8b14151d5e61d236e2301d97f /runtime/ftplugin | |
| parent | a0790558c3097f2813c56e404af30c3e2d8b8983 (diff) | |
| download | rneovim-ddda5e0a488bce19c86e04fa823069b755fac779.tar.gz rneovim-ddda5e0a488bce19c86e04fa823069b755fac779.tar.bz2 rneovim-ddda5e0a488bce19c86e04fa823069b755fac779.zip | |
feat(help): hide filename of "gO" outline using conceal #27547
Help outlines, invoked by `gO`, displays the help section titles in the
location list window. This feature is implemented by setting the buffer
lines after opening the window, but this implementation breaks the
assumption that the quickfix window texts are consistently constructed
by the quickfix list items. I think we can use the conceal feature here.
Using conceal here improves interoperability between quickfix plugins,
and also simplifies the outline implementation.
Originally reported at https://github.com/itchyny/vim-qfedit/issues/12
Diffstat (limited to 'runtime/ftplugin')
| -rw-r--r-- | runtime/ftplugin/help.vim | 4 | ||||
| -rw-r--r-- | runtime/ftplugin/qf.vim | 23 |
2 files changed, 2 insertions, 25 deletions
diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim index a6a6652b2f..a188e45cb4 100644 --- a/runtime/ftplugin/help.vim +++ b/runtime/ftplugin/help.vim @@ -71,7 +71,7 @@ if !exists('g:no_plugin_maps') if indent(lnum) <= indent(l) let level = has_section + has_sub_section - let add_text = matchstr(text, '\S.*') + let add_text = matchstr(text, '\S.\{-}\ze\s\=\~$') endif endif @@ -79,7 +79,7 @@ if !exists('g:no_plugin_maps') if !empty(add_text) && last_added != lnum let last_added = lnum call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum, - \ 'text': repeat(' ', level) . add_text}) + \ 'text': repeat("\u00a0\u00a0", level) . add_text}) endif let lnum = nextnonblank(lnum + 1) endwhile diff --git a/runtime/ftplugin/qf.vim b/runtime/ftplugin/qf.vim index a3dfce0e76..85fb9f6125 100644 --- a/runtime/ftplugin/qf.vim +++ b/runtime/ftplugin/qf.vim @@ -16,26 +16,3 @@ if !get(g:, 'qf_disable_statusline') " Display the command that produced the list in the quickfix window: setlocal stl=%t%{exists('w:quickfix_title')?\ '\ '.w:quickfix_title\ :\ ''}\ %=%-15(%l,%c%V%)\ %P endif - -function! s:setup_toc() abort - if get(w:, 'quickfix_title') !~# '\<TOC$' || &syntax != 'qf' - return - endif - - let list = getloclist(0) - if empty(list) - return - endif - - let bufnr = list[0].bufnr - setlocal modifiable - silent %delete _ - call setline(1, map(list, 'v:val.text')) - setlocal nomodifiable nomodified - let &syntax = getbufvar(bufnr, '&syntax') -endfunction - -augroup qf_toc - autocmd! - autocmd Syntax <buffer> call s:setup_toc() -augroup END |