Some default mappings can be set to empty strings

This allows the user to not have a mapping. Also, showing a detailed diagnostic
is now possible through a new command.

Fixes #64.
This commit is contained in:
Strahinja Val Markovic 2013-02-06 18:32:47 -08:00
parent 012102300d
commit 7cf179e2b8
2 changed files with 22 additions and 6 deletions

View File

@ -415,6 +415,11 @@ A better option would be to use Syntastic which will keep your `locationlist`
up to date automatically and will also show error/warning notifications in Vim's up to date automatically and will also show error/warning notifications in Vim's
gutter. gutter.
### The `YcmShowDetailedDiagnostic` command
This command shows the full diagnostic text when the user's cursor is on the
line with the diagnostic.
### The `YcmDebugInfo` command ### The `YcmDebugInfo` command
This will print out various debug information for the current file. Useful to This will print out various debug information for the current file. Useful to
@ -579,6 +584,8 @@ default mapping will probably only work in GUI Vim (Gvim or MacVim) and not in
plain console Vim because the terminal usually does not forward modifier key plain console Vim because the terminal usually does not forward modifier key
combinations to Vim. combinations to Vim.
Setting this option to an empty string will make sure no mapping is created.
Default: `<C-Space>` Default: `<C-Space>`
let g:ycm_key_invoke_completion = '<C-Space>' let g:ycm_key_invoke_completion = '<C-Space>'
@ -586,7 +593,10 @@ Default: `<C-Space>`
### The `g:ycm_key_detailed_diagnostics` option ### The `g:ycm_key_detailed_diagnostics` option
This option controls the key mapping used to show the full diagnostic text when This option controls the key mapping used to show the full diagnostic text when
the user's cursor is on the line with the diagnostic. the user's cursor is on the line with the diagnostic. It basically calls
`:YcmShowDetailedDiagnostic`.
Setting this option to an empty string will make sure no mapping is created.
Default: `<leader>d` Default: `<leader>d`

View File

@ -74,12 +74,16 @@ function! youcompleteme#Enable()
exe 'inoremap <expr>' . g:ycm_key_previous_completion . exe 'inoremap <expr>' . g:ycm_key_previous_completion .
\ ' pumvisible() ? "\<C-p>" : "\' . g:ycm_key_previous_completion .'"' \ ' pumvisible() ? "\<C-p>" : "\' . g:ycm_key_previous_completion .'"'
" <c-x><c-o> trigger omni completion, <c-p> deselects the first completion if strlen(g:ycm_key_invoke_completion)
" candidate that vim selects by default " <c-x><c-o> trigger omni completion, <c-p> deselects the first completion
exe 'inoremap <unique> ' . g:ycm_key_invoke_completion . ' <C-X><C-O><C-P>' " candidate that vim selects by default
exe 'inoremap <unique> ' . g:ycm_key_invoke_completion . ' <C-X><C-O><C-P>'
endif
exe 'nnoremap <unique> ' . g:ycm_key_detailed_diagnostics . if strlen(g:ycm_key_detailed_diagnostics)
\ ' :call <sid>ShowDetailedDiagnostic()<cr>' exe 'nnoremap <unique> ' . g:ycm_key_detailed_diagnostics .
\ ' :YcmShowDetailedDiagnostic<cr>'
endif
py import sys py import sys
py import vim py import vim
@ -404,6 +408,8 @@ function! s:ShowDetailedDiagnostic()
py ycm_state.ShowDetailedDiagnostic() py ycm_state.ShowDetailedDiagnostic()
endfunction endfunction
command! YcmShowDetailedDiagnostic call s:ShowDetailedDiagnostic()
" This is what Syntastic calls indirectly when it decides an auto-check is " This is what Syntastic calls indirectly when it decides an auto-check is
" required (currently that's on buffer save) OR when the SyntasticCheck command " required (currently that's on buffer save) OR when the SyntasticCheck command