Closed wsdjeg closed 8 years ago
You should use neosnippet feature. Closing.
the '(' comes from completion ,not typed by myself,does neosnippet support this?
thanks,it works,
some thing must be wrong, _
is cursor
this. type tab --> this.wait( type Enter --> this.wait( ) type tab this.wait(wait)<0
>) here an )
is extra
@Shougo
I have found why we get the error,if I use deoplete neopairs.vim and neosnippet.vim together,something will be error.
after competion,if the words end with a (
,neopairs will add an )
and put the cursor between them ,then if you type tab, neosnippet.vim will expand the first (
to (${1})${0} but do not delete the second )
so there will be an extra )
@wsdjeg Please provide the minimal init.vim and reproduce ways from Vim starting. I will check it.
NeoBundle 'Shougo/deoplete.nvim'
let s:hooks = neobundle#get_hooks("deoplete.nvim")
function! s:hooks.on_source(bundle)
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_ignore_case = 1
let g:deoplete#enable_smart_case = 1
let g:deoplete#enable_fuzzy_completion = 1
let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{})
let g:deoplete#omni#input_patterns.java = [
\'[^. \t0-9]\.\w*',
\'[^. \t0-9]\->\w*',
\'[^. \t0-9]\::\w*',
\'\s[A-Z][a-z]',
\'^\s*@[A-Z][a-z]'
\]
let g:deoplete#omni#input_patterns.jsp = ['[^. \t0-9]\.\w*']
inoremap <expr><C-h> deolete#mappings#smart_close_popup()."\<C-h>"
inoremap <expr><BS> deoplete#mappings#smart_close_popup()."\<C-h>"
endf
NeoBundle 'Shougo/neco-syntax'
NeoBundle 'Shougo/context_filetype.vim'
NeoBundle 'Shougo/neoinclude.vim'
NeoBundle 'Shougo/neopairs.vim'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'Shougo/neosnippet.vim' "{{{
let g:neosnippet#snippets_directory='~/DotFiles/snippets'
let g:neosnippet#enable_snipmate_compatibility=1
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : (pumvisible() ? "\<C-n>" : "\<TAB>")
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
inoremap <silent> <CR> <C-r>=MyEnterfunc()<Cr>
NeoBundle 'wsdjeg/vim-javacomplete2'
let g:JavaComplete_UseFQN = 1
let g:JavaComplete_ServerAutoShutdownTime = 300
let g:JavaComplete_MavenRepositoryDisable = 0
function MyEnterfunc()
if pumvisible()
if s:settings.autocomplete_method == 'neocomplete'||s:settings.autocomplete_method == 'deoplete'
return "\<C-y>"
else
return "\<esc>a"
endif
elseif getline('.')[col('.') - 2]=="{"&&getline('.')[col('.')-1]=="}"
return "\<Enter>\<esc>ko"
else
return "\<Enter>"
endif
endf
class Foo{
this_//cursor
}
then type dot,will show all the methon,if i chooce any one which is end with (
,the neopairs will aotu add )
after cursor,then if i type tab ,neosnippet.vim will expand the first ( to (${1})${0} but do not delete the second ) so there will be an extra )
OK. I fixed the conflict. But you should not enable neopairs if you want to jump out of pairs by neosnippet.
what is the significance of neopairs,i think neosnippet need start manully,and only can be start after a left pair,if after complete a method,i have typed some chars,then type tab will not start neosnippet. i think the best solution is : when finish completion,and the output word ends with a pair,neopairs aoto complete the right pair,and efine a variable x = 1,if i complete anothe method between the pairs ,the x++, the we can use this fun if x > 0 jump to the right of the first right pair,and x--, until x == 0 we can not jump
i find you just pushed a commit , i will have a try
ahaha, that means we should not use neopairs and neosnippet togther with deoplete?
Yes... It is wired behaviour though.
ok let me put neopairs into neocomplete gloups,and try with this latest version of neosnippet.vim
somithing error, after completion ,if i type tab,the cursor will jump out of pairs instead of in it.
@wsdjeg Your description is always too short. Please more described information.
ok, sorry,the position checking maybe error,
after completion,if I type tab the cursor will move to next position of pairs,like this()_
, then type tab again ,the cursor just move one step,like this()\s\ _
,but then type tab again the cursor will move four step which is set by me,like this()\s\s\s\s\s\ _
,
Cannot understand.
Please create minimal .vimrc. And your previous described .vimrc is too long. It must be less than 20 lines.
sorry i it is not due to vimrc,but if you want ,i will reduce it
NeoBundle 'Shougo/deoplete.nvim'
let g:deoplete#enable_at_startup = 1
let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{})
let g:deoplete#omni#input_patterns.java = ['[^. \t0-9]\.\w*']
NeoBundle 'Shougo/neosnippet.vim' "{{{
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : (pumvisible() ? "\<C-n>" : "\<TAB>")
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
inoremap <silent> <CR> pumvisible()? "\<c-y>" : "\<cr>"
NeoBundle 'wsdjeg/vim-javacomplete2'
let g:JavaComplete_UseFQN = 1
let g:JavaComplete_ServerAutoShutdownTime = 300
let g:JavaComplete_MavenRepositoryDisable = 0
as you wantted, after complete a omnifunc, the text should be this,wait(
then you type tab,will star snippet's autopairs,after this,the cursor should stay between pairs,then type tab jump out.but now after this.wait(
if I type tab will get this.wait()_
the cursor is out of pairs
the next time i type tab the cursor move one step to right ,next time move four step to right,as i have set tabstop = 4
maybe i have misunderstand you ,after testting many times i found maybe you just do not want to let the cursor stay between the pairs,but jump directory out of the pairs,and star to input another chars
@wsdjeg I don't want to test javacomplete2. Please create another example without javacomplete2. Recommend is neco-vim.
sorry i have test neco-vim ,it works different from java omni,and it works well
I have improved neosnippet behavior.
You must set let g:neosnippet#enable_complete_done = 1
option to expand it.
@Shougo @artur-shaik
hi man ,I think i have kown why it does not work,neosnippet's auto jump between args and out of pairs based on the completion word,
for example if the completion word is test(args1,args2)
,after finish completion,we can use tab jump form args1 to args2,then we also can use tab jump out of pairs.but in javacomplete2,the method's complete word is only test(
,the args and return type show in the pop menu,not in complete word.
it is diff feature between jc2 and neosnippet,is my understanding wrong??
these three above pic we just need to type tab three times
@artur-shaik @Shougo you see in Javacomplete2 all method has no args,show we add args into complete words?
if i set let g:neosnippet#enable_complete_done = 1, can not use tab select item, when i do not close the pumvisible i type tab once will get type tab again type tab again
you see in Javacomplete2 all method has no args,show we add args into complete words?
Fixed the problem.
haha thanks very much,and it works perfectly. and @artur-shaik should know it,let me show you some pic;
e
tab
Entrer
tab
( here before type tab you also can input some other chars,after inputting chars use tab jump out of pairs)it is really perfect,if no args,after type Enter,the pairs auto complete ,the cursor auto jump out,it works very well,
@mattn
i remamber you open a same issue in javacomplete2,in that issue ,you want complete )
,when has no args, i think ,you can have a try with shougo's plugin
i think it is better supprt this feature,and also it is not hard to implement. for example complete a methodmap to jump out of pairs
i can map my type
test(
after type any char or space will gettest(_)
_ is cursor then i think sould provid a