This repository has been archived by the owner on Jul 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test vimrc ```vim set nocompatible syntax on filetype plugin indent on set encoding=utf-8 fileencodings=ucs-bom,utf-8,gbk,gb18030,latin1 termencoding=utf-8 execute 'source ' . $WORKSPACE_DIR . '/plug.vim' call plug#begin($WORKSPACE_DIR) Plug 'ncm2/ncm2' Plug 'roxma/nvim-yarp' autocmd BufEnter * call ncm2#enable_for_buffer() set completeopt=noinsert,menuone,noselect set shortmess+=c inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" " snippet support Plug 'ncm2/ncm2-snipmate' Plug 'tomtom/tlib_vim' Plug 'marcweber/vim-addon-mw-utils' Plug 'garbas/vim-snipmate' inoremap <silent> <expr> <CR> ncm2_snipmate#expand_or("\<CR>", 'n') inoremap <expr> <c-u> ncm2_snipmate#expand_or("\<Plug>snipMateTrigger", "m") let g:snips_no_mappings = 1 vmap <c-j> <Plug>snipMateNextOrTrigger vmap <c-k> <Plug>snipMateBack imap <expr> <c-k> pumvisible() ? "\<c-y>\<Plug>snipMateBack" : "\<Plug>snipMateBack" imap <expr> <c-j> pumvisible() ? "\<c-y>\<Plug>snipMateNextOrTrigger" : "\<Plug>snipMateNextOrTrigger" " phpactor support Plug 'roxma/ncm2-phpactor' Plug 'phpactor/phpactor' Plug 'ncm2/ncm2-bufword' call plug#end() ```
- Loading branch information
Showing
4 changed files
with
82 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
[phpactor](https://github.com/phpactor/phpactor) integration for | ||
[nvim-completion-manager](https://github.com/roxma/nvim-completion-manager) | ||
|
||
![phpactor](https://user-images.githubusercontent.com/4538941/30627852-67643a22-9e05-11e7-90d1-aa75c2d0654c.gif) | ||
[ncm2](https://github.com/ncm2/ncm2) | ||
|
||
|
||
## Installation | ||
|
||
Assuming you're using [vim-plug](https://github.com/junegunn/vim-plug) | ||
|
||
```vim | ||
" requires nvim-completion-manager | ||
Plug 'roxma/nvim-completion-manager' | ||
" requires phpactor | ||
Plug 'phpactor/phpactor' , {'do': 'composer install'} | ||
Plug 'roxma/ncm-phpactor' | ||
Plug 'roxma/ncm2-phpactor', {} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
if get(s:, 'loaded', 0) | ||
finish | ||
endif | ||
let s:loaded = 1 | ||
|
||
let g:ncm2_phpactor#proc = yarp#py3({ | ||
\ 'module': 'ncm2_phpactor', | ||
\ 'on_load': { -> ncm2#set_ready(g:ncm2_phpactor#source)} | ||
\ }) | ||
|
||
let g:ncm2_phpactor#source = extend(get(g:, 'ncm2_phpactor#source', {}), { | ||
\ 'name': 'phpactor', | ||
\ 'ready': 0, | ||
\ 'priority': 9, | ||
\ 'mark': 'b', | ||
\ 'word_pattern': '[\w]+', | ||
\ 'complete_pattern': ['$', '-\>', '::'], | ||
\ 'subscope_enable': 1, | ||
\ 'on_complete': 'ncm2_phpactor#on_complete', | ||
\ 'on_warmup': 'ncm2_phpactor#on_warmup', | ||
\ }, 'keep') | ||
|
||
func! ncm2_phpactor#init() | ||
call ncm2#register_source(g:ncm2_phpactor#source) | ||
endfunc | ||
|
||
func! ncm2_phpactor#on_warmup(ctx) | ||
call g:ncm2_phpactor#proc.jobstart() | ||
endfunc | ||
|
||
func! ncm2_phpactor#on_complete(ctx) | ||
" g:phpactorPhpBin and g:phpactorbinpath, g:phpactorInitialCwd is defined in | ||
" phpactor plugin | ||
call g:ncm2_phpactor#proc.try_notify('on_complete', | ||
\ a:ctx, | ||
\ getline(1, '$'), | ||
\ getcwd(), | ||
\ [g:phpactorPhpBin, | ||
\ g:phpactorbinpath, | ||
\ 'complete', '-d', g:phpactorInitialCwd, | ||
\ '--format=json', '--', 'stdin' | ||
\ ]) | ||
endfunc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
call ncm2_phpactor#init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters