Allow completion in the command-line window
This commit is contained in:
parent
c25e449f4e
commit
f3ce1d12bd
14
README.md
14
README.md
@ -2073,9 +2073,9 @@ Default: `[see next line]`
|
|||||||
```viml
|
```viml
|
||||||
let g:ycm_filetype_blacklist = {
|
let g:ycm_filetype_blacklist = {
|
||||||
\ 'tagbar': 1,
|
\ 'tagbar': 1,
|
||||||
\ 'qf': 1,
|
|
||||||
\ 'notes': 1,
|
\ 'notes': 1,
|
||||||
\ 'markdown': 1,
|
\ 'markdown': 1,
|
||||||
|
\ 'netrw': 1,
|
||||||
\ 'unite': 1,
|
\ 'unite': 1,
|
||||||
\ 'text': 1,
|
\ 'text': 1,
|
||||||
\ 'vimwiki': 1,
|
\ 'vimwiki': 1,
|
||||||
@ -3346,6 +3346,18 @@ more details.
|
|||||||
This is a Vim bug fixed in version 8.1.0256. Update your Vim to this version or
|
This is a Vim bug fixed in version 8.1.0256. Update your Vim to this version or
|
||||||
later.
|
later.
|
||||||
|
|
||||||
|
### `TAB` is already mapped to trigger completion in the command-line window
|
||||||
|
|
||||||
|
Vim automatically maps the key set by the `wildchar` option, which is `TAB` by
|
||||||
|
default, to complete commands in the command-line window. If you would prefer
|
||||||
|
using this key to cycle through YCM's suggestions without changing the value of
|
||||||
|
`wildchar`, add the following to your vimrc:
|
||||||
|
|
||||||
|
```viml
|
||||||
|
autocmd CmdwinEnter * inoremap <expr><buffer> <TAB>
|
||||||
|
\ pumvisible() ? "\<C-n>" : "\<TAB>"
|
||||||
|
```
|
||||||
|
|
||||||
Contributor Code of Conduct
|
Contributor Code of Conduct
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
@ -45,6 +45,11 @@ let s:pollers = {
|
|||||||
\ 'wait_milliseconds': 100
|
\ 'wait_milliseconds': 100
|
||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
|
let s:buftype_blacklist = {
|
||||||
|
\ 'help': 1,
|
||||||
|
\ 'terminal': 1,
|
||||||
|
\ 'quickfix': 1
|
||||||
|
\ }
|
||||||
|
|
||||||
|
|
||||||
" When both versions are available, we prefer Python 3 over Python 2:
|
" When both versions are available, we prefer Python 3 over Python 2:
|
||||||
@ -132,7 +137,7 @@ function! youcompleteme#Enable()
|
|||||||
" filetype) and if so, the FileType event has triggered before and thus the
|
" filetype) and if so, the FileType event has triggered before and thus the
|
||||||
" buffer is already parsed.
|
" buffer is already parsed.
|
||||||
autocmd FileType * call s:OnFileTypeSet()
|
autocmd FileType * call s:OnFileTypeSet()
|
||||||
autocmd BufEnter * call s:OnBufferEnter()
|
autocmd BufEnter,CmdwinEnter * call s:OnBufferEnter()
|
||||||
autocmd BufUnload * call s:OnBufferUnload()
|
autocmd BufUnload * call s:OnBufferUnload()
|
||||||
autocmd InsertLeave * call s:OnInsertLeave()
|
autocmd InsertLeave * call s:OnInsertLeave()
|
||||||
autocmd VimLeave * call s:OnVimLeave()
|
autocmd VimLeave * call s:OnVimLeave()
|
||||||
@ -428,23 +433,23 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:AllowedToCompleteInBuffer( buffer )
|
function! s:AllowedToCompleteInBuffer( buffer )
|
||||||
let buffer_filetype = getbufvar( a:buffer, '&filetype' )
|
let buftype = getbufvar( a:buffer, '&buftype' )
|
||||||
|
|
||||||
if empty( buffer_filetype ) ||
|
if has_key( s:buftype_blacklist, buftype )
|
||||||
\ getbufvar( a:buffer, '&buftype' ) ==# 'nofile' ||
|
|
||||||
\ buffer_filetype ==# 'qf'
|
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:DisableOnLargeFile( a:buffer )
|
let filetype = getbufvar( a:buffer, '&filetype' )
|
||||||
|
|
||||||
|
if empty( filetype ) || s:DisableOnLargeFile( a:buffer )
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let whitelist_allows = type( g:ycm_filetype_whitelist ) != type( {} ) ||
|
let whitelist_allows = type( g:ycm_filetype_whitelist ) != type( {} ) ||
|
||||||
\ has_key( g:ycm_filetype_whitelist, '*' ) ||
|
\ has_key( g:ycm_filetype_whitelist, '*' ) ||
|
||||||
\ has_key( g:ycm_filetype_whitelist, buffer_filetype )
|
\ has_key( g:ycm_filetype_whitelist, filetype )
|
||||||
let blacklist_allows = type( g:ycm_filetype_blacklist ) != type( {} ) ||
|
let blacklist_allows = type( g:ycm_filetype_blacklist ) != type( {} ) ||
|
||||||
\ !has_key( g:ycm_filetype_blacklist, buffer_filetype )
|
\ !has_key( g:ycm_filetype_blacklist, filetype )
|
||||||
|
|
||||||
let allowed = whitelist_allows && blacklist_allows
|
let allowed = whitelist_allows && blacklist_allows
|
||||||
if allowed
|
if allowed
|
||||||
@ -528,6 +533,13 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:OnFileTypeSet()
|
function! s:OnFileTypeSet()
|
||||||
|
" The contents of the command-line window are empty when the filetype is set
|
||||||
|
" for the first time. Users should never change its filetype so we only rely
|
||||||
|
" on the CmdwinEnter event for that window.
|
||||||
|
if !empty( getcmdwintype() )
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
if !s:AllowedToCompleteInCurrentBuffer()
|
if !s:AllowedToCompleteInCurrentBuffer()
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
@ -181,6 +181,7 @@ module could not be loaded" |youcompleteme-on-windows-i-get-e887-sorry-this-comm
|
|||||||
35. YCM does not shut down when I quit Vim |youcompleteme-ycm-does-not-shut-down-when-i-quit-vim|
|
35. YCM does not shut down when I quit Vim |youcompleteme-ycm-does-not-shut-down-when-i-quit-vim|
|
||||||
36. YCM does not work with my Anaconda Python setup |youcompleteme-ycm-does-not-work-with-my-anaconda-python-setup|
|
36. YCM does not work with my Anaconda Python setup |youcompleteme-ycm-does-not-work-with-my-anaconda-python-setup|
|
||||||
37. Automatic import insertion after selecting a completion breaks undo |youcompleteme-automatic-import-insertion-after-selecting-completion-breaks-undo|
|
37. Automatic import insertion after selecting a completion breaks undo |youcompleteme-automatic-import-insertion-after-selecting-completion-breaks-undo|
|
||||||
|
38. 'TAB' is already mapped to trigger completion in the command-line window |youcompleteme-tab-is-already-mapped-to-trigger-completion-in-command-line-window|
|
||||||
14. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct|
|
14. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct|
|
||||||
15. Contact |youcompleteme-contact|
|
15. Contact |youcompleteme-contact|
|
||||||
16. License |youcompleteme-license|
|
16. License |youcompleteme-license|
|
||||||
@ -2331,9 +2332,9 @@ Default: '[see next line]'
|
|||||||
>
|
>
|
||||||
let g:ycm_filetype_blacklist = {
|
let g:ycm_filetype_blacklist = {
|
||||||
\ 'tagbar': 1,
|
\ 'tagbar': 1,
|
||||||
\ 'qf': 1,
|
|
||||||
\ 'notes': 1,
|
\ 'notes': 1,
|
||||||
\ 'markdown': 1,
|
\ 'markdown': 1,
|
||||||
|
\ 'netrw': 1,
|
||||||
\ 'unite': 1,
|
\ 'unite': 1,
|
||||||
\ 'text': 1,
|
\ 'text': 1,
|
||||||
\ 'vimwiki': 1,
|
\ 'vimwiki': 1,
|
||||||
@ -3601,6 +3602,18 @@ Automatic import insertion after selecting a completion breaks undo ~
|
|||||||
This is a Vim bug fixed in version 8.1.0256. Update your Vim to this version or
|
This is a Vim bug fixed in version 8.1.0256. Update your Vim to this version or
|
||||||
later.
|
later.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
*youcompleteme-tab-is-already-mapped-to-trigger-completion-in-command-line-window*
|
||||||
|
'TAB' is already mapped to trigger completion in the command-line window ~
|
||||||
|
|
||||||
|
Vim automatically maps the key set by the 'wildchar' option, which is 'TAB' by
|
||||||
|
default, to complete commands in the command-line window. If you would prefer
|
||||||
|
using this key to cycle through YCM's suggestions without changing the value of
|
||||||
|
'wildchar', add the following to your vimrc:
|
||||||
|
>
|
||||||
|
autocmd CmdwinEnter * inoremap <expr><buffer> <TAB>
|
||||||
|
\ pumvisible() ? "\<C-n>" : "\<TAB>"
|
||||||
|
<
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*youcompleteme-contributor-code-of-conduct*
|
*youcompleteme-contributor-code-of-conduct*
|
||||||
Contributor Code of Conduct ~
|
Contributor Code of Conduct ~
|
||||||
|
@ -91,7 +91,6 @@ let g:ycm_filetype_whitelist =
|
|||||||
let g:ycm_filetype_blacklist =
|
let g:ycm_filetype_blacklist =
|
||||||
\ get( g:, 'ycm_filetype_blacklist', {
|
\ get( g:, 'ycm_filetype_blacklist', {
|
||||||
\ 'tagbar': 1,
|
\ 'tagbar': 1,
|
||||||
\ 'qf': 1,
|
|
||||||
\ 'notes': 1,
|
\ 'notes': 1,
|
||||||
\ 'markdown': 1,
|
\ 'markdown': 1,
|
||||||
\ 'netrw': 1,
|
\ 'netrw': 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user