~gpanders/dotfiles

832628ea10c8240ab854952b84c2712dd2ee420a — Gregory Anders 2 months ago 1f6dceb
nvim: lazy load nvim-compe
3 files changed, 23 insertions(+), 14 deletions(-)

D .config/nvim/after/plugin/compe.vim
M .config/nvim/lua/plugins.lua
A .config/nvim/plugin/compe.vim
D .config/nvim/after/plugin/compe.vim => .config/nvim/after/plugin/compe.vim +0 -13
@@ 1,13 0,0 @@
if !get(g:, 'loaded_compe')
    finish
endif

set completeopt=menuone,noselect
set shortmess+=c

inoremap <silent> <expr> <CR> compe#confirm('<CR>')
inoremap <silent> <expr> <C-E> compe#close('<C-E>')

autocmd InsertEnter * ++once
            \ call compe#setup({'source': {'path': 1, 'nvim_lsp': 1, 'nvim_lua': 1}}) |
            \ doautocmd <nomodeline> compe InsertEnter

M .config/nvim/lua/plugins.lua => .config/nvim/lua/plugins.lua +1 -1
@@ 45,7 45,7 @@ return require('packer').startup(function(use)

    use { 'neovim/nvim-lspconfig', opt = true }

    use 'hrsh7th/nvim-compe'
    use { 'hrsh7th/nvim-compe', opt = true }

    use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }


A .config/nvim/plugin/compe.vim => .config/nvim/plugin/compe.vim +22 -0
@@ 0,0 1,22 @@
function! s:load()
    packadd nvim-compe
    if !exists('g:loaded_compe')
        finish
    endif

    runtime! after/plugin/compe.vim

    call compe#setup({'source': {'path': 1, 'nvim_lsp': 1, 'nvim_lua': 1}})

    set completeopt=menuone,noselect
    set shortmess+=c

    inoremap <silent> <expr> <CR> compe#confirm('<CR>')
    inoremap <silent> <expr> <C-E> compe#close('<C-E>')

    doautocmd <nomodeline> InsertEnter
endfunction

augroup my_compe
    autocmd! InsertEnter * ++once call s:load()
augroup END