Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouCompleteMe Support #172

Open
perrin4869 opened this issue May 5, 2014 · 4 comments
Open

YouCompleteMe Support #172

perrin4869 opened this issue May 5, 2014 · 4 comments

Comments

@perrin4869
Copy link

First of all I must say that LaTeX-Box OmniCompletion works almost perfect with YouCompleteMe out of the box. The only complaint that I have is when it comes to command completion. I have set YouCompleteMe to pop up autocompletion whenever '{' and '' are pressed. The former, as mentioned before, works as you'd expect - it brings up a menu with the available environments. The latter, however, brings up a list of commands, only when one is selected, it gets added with an additional backslash '' in front of it. For example, if I press '' and then select '\begin', I end up getting '\begin{'. Of course, the expected output is '\begin{'. I should also mention that ref completion works exactly as expected out of the box as well.
Thanks!

@felixjung
Copy link

I am interested in your setup, can you post the YCM config bit?

@perrin4869
Copy link
Author

Sure!
In my .vimrc I have:

"youcompleteme options
let g:ycm_global_ycm_extra_conf='~/.vim/youcompleteme/.ycm_extra_conf.py'
" let g:ycm_path_to_python_interpreter='/usr/bin/python/'

"use omnicomplete whenever there's no completion engine in youcompleteme (for
"example, in the case of PHP)
set omnifunc=syntaxcomplete#Complete

" let g:ycm_key_invoke_completion = '<C-s>' " Ctrl-suggest - doesn't work
" because C-s freezes the command line
let g:ycm_key_invoke_completion = '<C-h>'
" let g:ycm_key_list_select_completion = ['<C-j>']
" let g:ycm_key_list_previous_completion = ['<C-k>']
let g:ycm_key_list_select_completion = ['<Tab>']
let g:ycm_key_list_previous_completion = ['<S-Tab>']

" Ultisnips
" let g:UltiSnipsExpandTrigger="<Tab>"
" let g:UltiSnipsJumpForwardTrigger="<Tab>"
" let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"

I also have the following in vim/ftplugin/tex.vim

" Add triggers to ycm for LaTeX-Box autocompletion
let g:ycm_semantic_triggers = {
\  'tex'  : ['{'],
\ }

@qiemem
Copy link

qiemem commented Jan 29, 2015

I'm having this problem as well. I have a pretty minimal ycm setup. It pretty much just sets up the semantic trigger on { and \. I've noticed that when I type something starting with \ and the completions appear, if I hit the shortcut for semantic completion (C- by default I believe), I can then select a completion without ending up with \\ at the beginning of the word.

@Karel-van-de-Plassche
Copy link

Karel-van-de-Plassche commented Apr 26, 2017

This issue still exists. It's because the LatexBox_completion_commands include a preceding backslash. You can work around this by changing in ~/.vim/bundle/LaTeX-Box/ftplugin/latex-box/complete.vim

if !exists('g:LatexBox_completion_commands')
	let g:LatexBox_completion_commands = [
		\ {'word': '\begin{' },
		\ {'word': '\end{' },
		\ {'word': '\item' },
		\ {'word': '\label{' },
		\ {'word': '\ref{' },
		\ {'word': '\eqref{eq:' },
		\ {'word': '\cite{' },
		\ {'word': '\chapter{' },
		\ {'word': '\section{' },
		\ {'word': '\subsection{' },
		\ {'word': '\subsubsection{' },
		\ {'word': '\paragraph{' },
		\ {'word': '\nonumber' },
		\ {'word': '\bibliography' },
		\ {'word': '\bibliographystyle' },
\ ]

to

if !exists('g:LatexBox_completion_commands')
	let g:LatexBox_completion_commands = [
		\ {'word': 'begin{' },
		\ {'word': 'end{' },
		\ {'word': 'item' },
		\ {'word': 'label{' },
		\ {'word': 'ref{' },
		\ {'word': 'eqref{eq:' },
		\ {'word': 'cite{' },
		\ {'word': 'chapter{' },
		\ {'word': 'section{' },
		\ {'word': 'subsection{' },
		\ {'word': 'subsubsection{' },
		\ {'word': 'paragraph{' },
		\ {'word': 'nonumber' },
		\ {'word': 'bibliography' },
		\ {'word': 'bibliographystyle' },
\ ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants