maralla / completor.vim

Async completion framework made ease.
MIT License
1.27k stars 63 forks source link

`\<C-r>=completor#do('complete')\<CR>"` not firing with *.js files #266

Closed Blake-LeBlanc closed 5 years ago

Blake-LeBlanc commented 5 years ago

Using the Tab_or_Complete() method, I've noticed it does work with .rb and .html.erb files, but whenever I'm editing a *.js file, the command will display below the status line and nothing will actually happen. Almost as if the command is not being submitted with a carriage return or something...

https://imgur.com/a/pcXezF7 NOTE: The image shows the vim-mode as being "NORMAL", but I am using it while in INSERT mode. For some reason vim is toggling to NORMAL mode immediately before the screenshot is saved.

Here is the function within my .vimrc:

function! Tab_or_Complete() abort
  if pumvisible()
    return "\<C-n>"
  elseif col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
    return "\<C-r>=completor#do('complete')\<CR>"
  else
    return "\<Tab>"
  endif
endfunction

" Tab and Shift-Tab cycle through results
inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

let g:completor_auto_trigger = 0 " default 1
inoremap <expr> <Tab> Tab_or_Complete()

Thank you in advance for any help or insights offered!

maralla commented 5 years ago

Thanks for reporting. Have you ever run the command make js at the root path of completor?

Blake-LeBlanc commented 5 years ago

Thank you maralla, that did the trick! I appreciate your quick turn around!

Could the readme be updated to include "at the root path of completor"? That's what clarified it for me :)

All the best, Blake