dotfiles

My configuration files
git clone git://git.finwo.net/misc/dotfiles
Log | Files | Refs

commit 4c20084c5ad45171c0a18bb5739595bdbc833db9
parent fac003adc4c20c40038a985bce20427062fcc61f
Author: finwo <finwo@pm.me>
Date:   Mon, 20 May 2019 10:48:55 +0200

Added js autocompletion in neovim

Diffstat:
Mneovim/home/.vimrc | 106+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+), 0 deletions(-)

diff --git a/neovim/home/.vimrc b/neovim/home/.vimrc @@ -7,6 +7,7 @@ call plug#begin('~/.vim/plugged') Plug 'airblade/vim-gitgutter' Plug 'alvan/vim-closetag' +Plug 'carlitux/deoplete-ternjs' Plug 'editorconfig/editorconfig-vim' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' @@ -14,6 +15,7 @@ Plug 'morhetz/gruvbox' Plug 'qpkorr/vim-bufkill' Plug 'scrooloose/nerdtree' Plug 'sheerun/vim-polyglot' +Plug 'ternjs/tern_for_vim' Plug 'tpope/vim-commentary' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-eunuch' @@ -21,6 +23,14 @@ Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'w0rp/ale' +if has('nvim') + Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +else + Plug 'Shougo/deoplete.nvim' + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' +endif + " Initialize plugin system call plug#end() @@ -158,3 +168,99 @@ let g:ale_lint_on_text_changed = 'never' let g:ale_lint_on_enter = 0 " }}} +" Deoplete {{{ + +" Basics +let g:deoplete#enable_at_startup = 1 +let g:deoplete#auto_complete_delay = 0 +let g:echodoc_enable_at_startup = 1 +set splitbelow +set completeopt+=menuone,noinsert,noselect +autocmd CompleteDone * pclose + +" Define basic sources +function! Multiple_cursors_before() + let b:deoplete_disable_auto_complete=2 +endfunction +function! Multiple_cursors_after() + let b:deoplete_disable_auto_complete=0 +endfunction +let g:deoplete#file#enable_buffer_path=1 +call deoplete#custom#source('buffer', 'mark', 'ℬ') +call deoplete#custom#source('tern', 'mark', '') +call deoplete#custom#source('omni', 'mark', '⌾') +call deoplete#custom#source('file', 'mark', '') +" call deoplete#custom#source('jedi', 'mark', '') +call deoplete#custom#source('neosnippet', 'mark', '') +call deoplete#custom#source('LanguageClient', 'mark', '') +call deoplete#custom#source('typescript', 'rank', 630) +" call deoplete#custom#source('_', 'matchers', ['matcher_cpsm']) +" call deoplete#custom#source('_', 'sorters', []) +let g:deoplete#omni_patterns = { + \ 'html': '', + \ 'css': '', + \ 'scss': '' + \} +function! Preview_func() + if &pvw + setlocal nonumber norelativenumber + endif +endfunction +autocmd WinEnter * call Preview_func() +let g:deoplete#ignore_sources = {'_': ['around', 'buffer' ]} + +" Whether to include the types of the completions in the result data. Default: 0 +let g:deoplete#sources#ternjs#types = 1 + +" Whether to include the distance (in scopes for variables, in prototypes for +" properties) between the completions and the origin position in the result +" data. Default: 0 +let g:deoplete#sources#ternjs#depths = 1 + +" Whether to include documentation strings (if found) in the result data. +" Default: 0 +let g:deoplete#sources#ternjs#docs = 1 + +" When on, only completions that match the current word at the given point will +" be returned. Turn this off to get all results, so that you can filter on the +" client side. Default: 1 +let g:deoplete#sources#ternjs#filter = 0 + +" Whether to use a case-insensitive compare between the current word and +" potential completions. Default 0 +let g:deoplete#sources#ternjs#case_insensitive = 1 + +" When completing a property and no completions are found, Tern will use some +" heuristics to try and return some properties anyway. Set this to 0 to +" turn that off. Default: 1 +let g:deoplete#sources#ternjs#guess = 0 + +" Determines whether the result set will be sorted. Default: 1 +let g:deoplete#sources#ternjs#sort = 1 + +" When disabled, only the text before the given position is considered part of +" the word. When enabled (the default), the whole variable name that the cursor +" is on will be included. Default: 1 +let g:deoplete#sources#ternjs#expand_word_forward = 0 + +" Whether to ignore the properties of Object.prototype unless they have been +" spelled out by at least two characters. Default: 1 +let g:deoplete#sources#ternjs#omit_object_prototype = 0 + +" Whether to include JavaScript keywords when completing something that is not +" a property. Default: 0 +let g:deoplete#sources#ternjs#include_keywords = 1 + +" If completions should be returned when inside a literal. Default: 1 +let g:deoplete#sources#ternjs#in_literal = 0 + + +"Add extra filetypes +let g:deoplete#sources#ternjs#filetypes = [ + \ 'jsx', + \ 'javascript.jsx', + \ 'vue', + \ '...' + \ ] + +" }}}