Skip to content

Commit

Permalink
Add back completor, test new awesome FZF compete
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Apr 5, 2017
1 parent 0011eba commit 7a3e4ab
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@
[submodule "zsh/.zsh/bundle/alias-tips"]
path = zsh/.zsh/bundle/alias-tips
url = https://github.com/djui/alias-tips
[submodule "vim/.vim/bundle/supertab"]
path = vim/.vim/bundle/supertab
url = https://github.com/ervandew/supertab
[submodule "vim/.vim/bundle/completor.vim"]
path = vim/.vim/bundle/completor.vim
url = https://github.com/maralla/completor.vim
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ To add your own Vim, Tmux or Zsh plugin you can just clone it to proper
:notebook_with_decorative_cover: The interactive scratchpad for hackers.
* [comittia.vim](https://github.com/rhysd/committia.vim): A Vim plugin for more
pleasant editing on commit messages
* [completor.vim](https://github.com/maralla/completor.vim): Async completion
framework made ease
* [editorconfig-vim](https://github.com/editorconfig/editorconfig-vim):
EditorConfig plugin for Vim
* [fzf.vim](https://github.com/junegunn/fzf.vim): fzf :heart: vim
* [supertab](https://github.com/ervandew/supertab/): Perform all your vim
insert mode completions with Tab
* [syntastic](https://github.com/scrooloose/syntastic): Syntax checking hacks
for vim
* [tsuquyomi](https://github.com/Quramy/tsuquyomi): A Vim plugin for TypeScript
Expand Down
1 change: 1 addition & 0 deletions vim/.vim/bundle/completor.vim
Submodule completor.vim added at 7bffb6
1 change: 0 additions & 1 deletion vim/.vim/bundle/supertab
Submodule supertab deleted from cdaa5c
59 changes: 42 additions & 17 deletions vim/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,13 @@ function! Session()
endfunction
command! -bar Session :call Session()

" Ultisnips
let g:UltiSnipsExpandTrigger = '<s-tab>'

" Completor
let g:completor_auto_trigger = 0
let g:completor_min_chars = 1

" VimWiki
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
let g:vimwiki_global_ext=0
Expand All @@ -363,13 +370,6 @@ let g:vimwiki_table_mappings = 0
let g:EditorConfig_core_mode = 'external_command' " Speed up editorconfig plugin
let g:EditorConfig_exclude_patterns = ['fugitive://.*'] " Fix EditorConfig for fugitive

" Supertab
let g:SuperTabDefaultCompletionType='context'
let g:SuperTabContextDefaultCompletionType='<c-n>'
let g:SuperTabLongestEnhanced=1
let g:SuperTabLongestHighlight=1
let g:SuperTabCrMapping=1

" Fugitive
autocmd VimRc BufReadPost fugitive://* set bufhidden=delete
nnoremap <silent> <leader>gs :Gstatus<CR>
Expand Down Expand Up @@ -397,19 +397,44 @@ nmap <silent> <leader>mtt :TestNearest<CR>

" Fuzzy completion
function! FzfCompletionPop(findstart, base)
if !a:findstart
" let b:SuperTabChain = ( &omnifunc, &tmuxcomplete#complete, "<c-p>" )
" let res = SuperTabCodeComplete(a:findstart, a:base)
let l:res = function(&omnifunc)(a:findstart, a:base)
call fzf#complete(l:res)
let l:res = completor#completefunc(a:findstart, a:base)

if a:findstart
return l:res
endif

return ''
let l:words = []

for word in l:res.words
call add(l:words, word['word'] . ' ' . word['menu'])
endfor

let l:result = fzf#run({ 'source': l:words, 'down': '~40%', 'options': printf('--query "%s" +s', a:base) })

if empty(l:result)
return [ a:base ]
endif

return [ split(l:result[0])[0] ]
endfunction

function! FzfCompletionTrigger()
setlocal completefunc=FzfCompletionPop
setlocal completeopt=menu
call feedkeys("\<c-x>\<c-u>", 'n')
endfunction
imap <c-x><c-j> <c-o>:call FzfCompletionTrigger()<cr>
" Awesome TAB fuzzy completion
function! Smart_TabComplete()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
call feedkeys("\<tab>", 'n')
return
endif
call feedkeys("\<c-x>\<c-j>")
endfunction
set completefunc=FzfCompletionPop
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-l> <plug>(fzf-complete-line)
inoremap <silent> <tab> <c-o>:call Smart_TabComplete()<cr>
" rg command suffix, [options]
function! VRg_raw(command_suffix, ...)
Expand Down

0 comments on commit 7a3e4ab

Please sign in to comment.