NeoVim vimrc config

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
set nocompatible

syntax enable
set mouse=a
set number
set foldenable

" MacOS
set clipboard=unnamed


" Support 24 Bit colors
if (has("termguicolors"))
  set termguicolors
endif

" Iterm2 / OSX recommended color patch
set t_8b=^[[48;2;%lu;%lu;%lum
set t_8f=^[[38;2;%lu;%lu;%lum

" MINPAC
packadd minpac
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})

" AIRLINE
call minpac#add('vim-airline/vim-airline')
call minpac#add('vim-airline/vim-airline-themes')
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline_detect_paste=1

" FILE MANAGER
call minpac#add('junegunn/fzf')
call minpac#add('junegunn/fzf.vim')

call minpac#add('scrooloose/nerdtree')
let NERDTreeIgnore=['.gitattributes', '.DS_Store', '\.pyc$', '\~$'] "ignore files in NERDTree
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let NERDTreeAutoDeleteBuffer = 1
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let NERDTreeShowHidden=1

" GIT
call minpac#add('tpope/vim-fugitive')
call minpac#add('Xuyuanp/nerdtree-git-plugin')

" THEMES
call minpac#add('arcticicestudio/nord-vim')
call minpac#add('mhartington/oceanic-next')

" JAVASCRIPT SYNTAX
call minpac#add('othree/javascript-libraries-syntax.vim')
let g:used_javascript_libs = 'underscore,backbone,react,chai,jquery,d3'
call minpac#add('pangloss/vim-javascript')
call minpac#add('mxw/vim-jsx')
let g:javascript_plugin_flow = 1
let g:jsx_ext_required = 0

" FLOW JS
call minpac#add('steelsojka/deoplete-flow')
function! StrTrim(txt)
  return substitute(a:txt, '^\n*\s*\(.\{-}\)\n*\s*$', '\1', '')
endfunction

let g:flow_path = StrTrim(system('PATH=$(npm bin):$PATH && which flow'))

if g:flow_path != 'flow not found'
  let g:deoplete#sources#flow#flow_bin = g:flow_path
endif

" GRAPHQL
call minpac#add('jparise/vim-graphql')

" RUBY
call minpac#add('vim-ruby/vim-ruby')

" HTML5
call minpac#add('othree/html5.vim')

" MARKDOWN
call minpac#add('tpope/vim-markdown')

" LINTERS
call minpac#add('w0rp/ale')

" ADDONE
call minpac#add('severin-lemaignan/vim-minimap')

" VISUAL
call minpac#add('ryanoasis/vim-devicons')
call minpac#add('terryma/vim-multiple-cursors')

" TAGBAR
call minpac#add('majutsushi/tagbar')

" GIT
call minpac#add('airblade/vim-gitgutter')

" AUTOCOMPLETE
call minpac#add('Shougo/deoplete.nvim')
call minpac#add('roxma/nvim-yarp')
call minpac#add('roxma/vim-hug-neovim-rpc')
let g:deoplete#enable_at_startup = 1

" AUTOCLOSE
call minpac#add('jiangmiao/auto-pairs')
call minpac#add('alvan/vim-closetag')
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.php,*.jsx,*.js"

" COMMANDS
command! PackUpdate call minpac#update()
command! PackClean call minpac#clean()

" KEY MAPPING
nnoremap <C-p> :<C-u>FZF<CR>
map <C-o> :NERDTreeToggle<CR>

" COLOR SCHEME
let g:oceanic_next_terminal_bold = 1
"let g:oceanic_next_terminal_italic = 1
set background=dark
colorscheme OceanicNext


" ALE
let g:ale_linters = {
            \'javascript': ['flow', 'eslint'],
            \'python': ['flake8', 'pylint'],
            \'json': ['fixjson'],
            \'vim': ['vint']}
"highlight clear ALEErrorSign " otherwise uses error bg color (typically red)
"highlight clear ALEWarningSign " otherwise uses error bg color (typically red)
let g:ale_sign_error = '◉' " could use emoji
let g:ale_sign_warning = '◉' " could use emoji
let g:ale_statusline_format = ['X %d', '? %d', '']
" %linter% is the name of the linter that provided the message
" %s is the error or warning message
let g:ale_echo_msg_format = '%linter% says %s'
" Map keys to navigate between lines with errors and warnings.
nnoremap <leader>an :ALENextWrap<cr>
nnoremap <leader>ap :ALEPreviousWrap<cr>
let g:ale_completion_enabled = 1
let g:airline#extensions#ale#enabled = 1
let g:ale_list_window_size = 5
let g:ale_linters_explicit = 1


set wildignore+=*.o,*.obj,.git,node_modules,_site,*.class,*.zip,*.aux

" Remove trailing whitespace.
autocmd BufWritePre * :%s/\s\+$//e

" invisible
set listchars=tab:▸\ ,trail:·
set list

" Set Proper Tabs
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab