k-takata / minpac

A minimal package manager for Vim 8+ (and Neovim)
835 stars 30 forks source link

How to setup denite ? #127

Closed Farkal closed 3 years ago

Farkal commented 3 years ago

I am trying to define denite settings but i get: Unknow function denite#custom#var This issue https://github.com/Shougo/denite.nvim/issues/441 say that it's because the plugin is not installed but i can use denite if i don't define this vars so it's installed. Have you any idea about this ? (i am also new to vim/neovim perhaps i missed something, it's hard to find good doc about denite 😢 )

" Inspirated by https://github.com/Vintharas/BarbaricNeoVim/blob/master/init.vim
" Package manager minpac
packadd minpac
call minpac#init()

" have minpac manage minpac :D
" use opt so that we can load the plugin via packadd before
" any other plugin
call minpac#add('k-takata/minpac', {'type': 'opt'})

"""""""" Add other plugins here:
" Colorschemes and aesthetics
call minpac#add('lifepillar/vim-gruvbox8')
call minpac#add('KeitaNakamura/neodark.vim')
call minpac#add('ryanoasis/vim-devicons')

" Denite - all purpose list search and actions
call minpac#add('shougo/denite.nvim')
call minpac#add('neoclide/denite-git')    " git
call minpac#add('chemzqm/denite-extra')   " extra sources (session, project, commands, location, quickfix, history)

" Support for other tools
call minpac#add('tpope/vim-fugitive')     " git wrapper
call minpac#add('airblade/vim-gitgutter') " git diff display
call minpac#add('janko-m/vim-test')       " testing helpers

" Moving around or Motions
call minpac#add('justinmk/vim-sneak')      " vim sneak. faster movement within Vim
call minpac#add('easymotion/vim-easymotion') " vim easymotion

" Code completion
call minpac#add('neoclide/coc.nvim', {'do': { -> coc#util#install()}})

let mapleader = ","

" Define colorsheme
colo gruvbox8

set relativenumber
" Remap terminal normal mode

:tnoremap <C-W><C-n> <C-\><C-n>

" Shortcut to edit THIS configuration file: (e)dit (c)onfiguration
nnoremap <silent> <leader>ec :e $MYVIMRC<CR>

" Shortcut to source (reload) THIS configuration file after editing it: (s)ource (c)onfiguraiton
nnoremap <silent> <leader>sc :source $MYVIMRC<CR>

" use ,, for escape
inoremap ,, <Esc>

" Denite
call denite#custom#var('file/rec', 'command', ['rg', '--files', '--glob', '!.git'])

" Use ripgrep in place of "grep"
call denite#custom#var('grep', 'command', ['rg'])

call denite#custom#var('grep', 'default_opts', ['--hidden', '--vimgrep', '--heading', '-S'])

" Recommended defaults for ripgrep via Denite docs
call denite#custom#var('grep', 'recursive_opts', [])
call denite#custom#var('grep', 'pattern_opt', ['--regexp'])
call denite#custom#var('grep', 'separator', ['--'])
call denite#custom#var('grep', 'final_opts', [])

let s:denite_options = {'default' : {
    \ 'split': 'floating',
    \ 'start_filter': 1,
    \ 'auto_resize': 1,
    \ 'source_names': 'short',
    \ 'prompt': 'λ:',
    \ 'direction': 'rightbelow',
    \ 'winminheight': '10',
    \ 'highlight_matched_char': 'QuickFixLine',
    \ 'highlight_matched_range': 'Visual',
    \ 'highlight_window_background': 'Visual',
    \ 'highlight_filter_background': 'DiffAdd',
    \ 'winrow': 1,
    \ 'vertical_preview': 1
    \ }}

nmap , :Denite buffer -split=floating -winrow=1<CR>
nmap <leader>t :Denite file/rec -split=floating -winrow=1<CR>
nnoremap <leader>g :<C-u>Denite grep:. -no-empty -mode=normal<CR>
nnoremap <leader>j :<C-u>DeniteCursorWord grep:. -mode=normal<CR>

"""" minpac - simpler commands
command! PlugUpdate source $MYVIMRC | call minpac#update()
command! PlugClean source $MYVIMRC | call minpac#clean()
command! PlugStatus source $MYVIMRC | call minpac#status()
k-takata commented 3 years ago

Try adding packadd! denite.nvim before calling the denite functions.

Farkal commented 3 years ago

Thx it worked !