Youcompleteme: Intergrate with SnipMate?

Created on 6 Feb 2013  路  23Comments  路  Source: ycm-core/YouCompleteMe

Can YCM integrate with SnipMate (https://github.com/garbas/vim-snipmate) ?

Cause the trigger key for SnipMate is also Tab... How can I configure it?

Or is there another plugin like SnipMate but can easily integrate with YCM?

duplicate

Most helpful comment

@sanguis If you use <tab> to code complete and after that you press <C-J> then snippet won't work. So I changed mapping to:

imap <C-J> <esc>a<Plug>snipMateNextOrTrigger
smap <C-J> <Plug>snipMateNextOrTrigger

I like ss insted of <C-J>

imap ss <esc>a<Plug>snipMateNextOrTrigger
smap ss <Plug>snipMateNextOrTrigger

All 23 comments

You can assign SnipMate trigger key to another one:

let g:snips_trigger_key = '<C-\>'

Though I'd love YCM to detect if SnipMate is in control and leave Tab key as it is.

How to let YCM to detect if SnipMate should be trigger or not?
i.e. I want use tab for both SnipMate and YCM

You can't use TAB for both. Pick a different key.

OK!
I found good configure in your vimrc -- <M-S> for trigger snippets!

Duplicate #36.

@rimmontrieu snippet at is depreciated if you are using the https://github.com/garbas/vim-snipmate fork of snipmate.
you will want to use:
:imap <C-J> <Plug>snipMateNextOrTrigger :smap <C-J> <Plug>snipMateNextOrTrigger

@sanguis If you use <tab> to code complete and after that you press <C-J> then snippet won't work. So I changed mapping to:

imap <C-J> <esc>a<Plug>snipMateNextOrTrigger
smap <C-J> <Plug>snipMateNextOrTrigger

I like ss insted of <C-J>

imap ss <esc>a<Plug>snipMateNextOrTrigger
smap ss <Plug>snipMateNextOrTrigger

@ArturT I was just thinking that my intail mapping was not enough. thanks

How would one unbind Tab from YouCompleteMe, I already use it for snipmate. I prefer to use C-j and C-k for autocomplete menus, as its easier to press than tab.

NVM, I found it:
let g:ycm_key_list_select_completion = []

@ArturT
Thanks a lot.. More Helpful..
.. I had use emmet + YCM + vim-snipmate together..
3Q! : )

@ArturT @DemonCloud @sanguis i tried your solution but when i use the mapping i get this <Plug>snipMateNextOrTrigger pasted instead of snipmante being triggered.....

@merongivian Currently I'm using only this in insert mode:

imap ** <esc>a<Plug>snipMateNextOrTrigger

@ArturT yea but when i tried to use it, it literally pastes <PLug>snip.... on vim instead of calling that command, don't know what im doing wrong :cry:

imap <expr> <C-J> pumvisible() ? '<esc><Plug>snipMateNextOrTrigger' : '<Plug>snipMateNextOrTrigger'

Is what I used to get it to work with the popup.

BEWARE: vim-autoclose fucks up this workflow

UltiSnip is extremely slow.

Perhaps you should report that to the UltiSnips devs?

Personally I do not find it slow.

Maybe you don't switch buffer/tabpage rapidly.

My alt+[1-9] have been bound to tabpage 1-9, and when I press alt+1-9 to swith tab there is a noticeable delay if UltiSnip has been enabled.

And I switch to snipmate, it works fine and fast but conflicts with YCM, so google leads me here.

If you have profiles to support that perhaps there is something we can do. But your original comment oabout it being slow is not productive.

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
  149   9.742292   0.142725  <SNR>147_OnBufferEnter()
  149   9.234464             UltiSnips#SnippetsInCurrentScope()
  156   1.652028   0.009707  <SNR>98_on_window_changed()
  151   1.641614   0.015714  airline#update_statusline()
  151   1.625000   0.007856  <SNR>127_invoke_funcrefs()
  151   1.416678   0.120412  253()
10466   1.133411   0.485156  airline#highlighter#get_highlight()
 2142   1.045088   0.081462  <SNR>138_exec_separator()
  755   1.025652   0.010257  <SNR>142_get_seperator()
  906   0.983512   0.036925  <SNR>142_get_transitioned_seperator()
 1812   0.946587   0.025405  airline#highlighter#add_separator()
 4672   0.871761   0.259872  airline#highlighter#exec()
  149   0.681060   0.031807  <SNR>65_updateData()
  109   0.643125   0.010170  airline#check_mode()
   55   0.620835   0.085390  airline#highlighter#highlight()
20932   0.567701             <SNR>138_get_syn()
  149   0.526273   0.047099  signature#sign#Refresh()
 4284   0.514009   0.030675  airline#themes#get_highlight()
  149   0.415597             <SNR>147_OnFileReadyToParse()
  298   0.325507   0.026431  fuf#saveDataFile()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
  149              9.234464  UltiSnips#SnippetsInCurrentScope()
20932              0.567701  <SNR>138_get_syn()
10466   1.133411   0.485156  airline#highlighter#get_highlight()
  149              0.415597  <SNR>147_OnFileReadyToParse()
  298              0.274618  l9#writeFile()
 4672   0.871761   0.259872  airline#highlighter#exec()
  298              0.214312  signature#mark#GetList()
 7748   0.238054   0.210231  signature#sign#Remove()
  298              0.165979  l9#readFile()
  149   9.742292   0.142725  <SNR>147_OnBufferEnter()
  151   1.416678   0.120412  253()
  150              0.098693  lfMru#record()
  298              0.096698  fuf#updateMruList()
 4672              0.096379  <SNR>138_CheckDefined()
   55   0.620835   0.085390  airline#highlighter#highlight()
 2142   1.045088   0.081462  <SNR>138_exec_separator()
10466              0.080554  <SNR>138_get_array()
 1057              0.067045  <SNR>142_get_accented_line()
 1510   0.066206   0.060088  <SNR>143_get_section()
 4671              0.049927  <SNR>138_hl_group_exists()

@skywind3000 Have you use neovim? In neovim, UltiSnips is very slow.

No, I am using GVim on Windows 10.

Hm... I don't know why.

Never mind, snipmate can work with ycm now, I use the keymaps above with some modification:

imap <expr> <m-h> pumvisible() ? '<esc>a<Plug>snipMateTrigger' : '<Plug>snipMateTrigger'
imap <expr> <m-j> pumvisible() ? '<esc>a<Plug>snipMateNextOrTrigger' : '<Plug>snipMateNextOrTrigger'
smap <m-j> <Plug>snipMateNextOrTrigger
imap <expr> <m-k> pumvisible() ? '<esc>a<Plug>snipMateBack' : '<Plug>snipMateBack'
smap <m-k> <Plug>snipMateBack
imap <expr> <m-l> pumvisible() ? '<esc>a<Plug>snipMateShow' : '<Plug>snipMateShow'
Was this page helpful?
0 / 5 - 0 ratings

Related issues

tgzhou98 picture tgzhou98  路  3Comments

blackode picture blackode  路  3Comments

beojan picture beojan  路  4Comments

kb100 picture kb100  路  4Comments

ioeric picture ioeric  路  4Comments