Skip to content

Instantly share code, notes, and snippets.

@dylanirlbeck
Created February 20, 2020 21:25
Show Gist options
  • Save dylanirlbeck/5e1f550b22deec3ceb2fbe6509fd38de to your computer and use it in GitHub Desktop.
Save dylanirlbeck/5e1f550b22deec3ceb2fbe6509fd38de to your computer and use it in GitHub Desktop.
My condensed init.vim
" *********************************
" VimPlug
" *********************************
call plug#begin('~/.config/nvim/bundle')
" A BUNCH OF PLUGINS --- IMPORTANT ONES LISTED
" CoC https://github.com/neoclide/coc.nvim --- only used for a tailwind completion plugin
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" autocomplete stuff
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
let g:deoplete#enable_at_startup = 1
autocmd BufWritePre * call LanguageClient#textDocument_formatting_sync()
" *************************
" Language Server Related
" *************************
" I HAVE MORE STUFF BUT ONLY INCLUDED REASON
autocmd BufRead *.re set filetype=reason
autocmd BufRead *.rei set filetype=reason
" *************************
" LanguageClient
" *************************
"
" Language Client https://github.com/autozimu/LanguageClient-neovim#quick-start
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
let g:LanguageClient_serverCommands = {}
" https://github.com/jaredly/reason-language-server#vim
" https://github.com/jaredly/reason-language-server/releases/latest/download/bin.exe
if executable('reason-language-server')
let g:LanguageClient_serverCommands.reason = ['reason-language-server']
endif
" Automatically start language servers.
let g:LanguageClient_autoStart = 1
" gd Show type info (and short doc) of identifier under cursor.
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<cr>
" gf Formats code in normal mode
nnoremap <silent> gf :call LanguageClient_textDocument_formatting()<cr>
" Show type info (and short doc) of identifier under cursor.
nnoremap <silent> <cr> :call LanguageClient_textDocument_hover()<cr>
" Show detailed error under cursor
nnoremap <silent> ge :call LanguageClient_explainErrorAtPoint()<cr>
" Async linting ALE
Plug 'dense-analysis/ale'
" be explicit about whats running
let g:ale_set_balloons = 1
" be explicit about whats running
let g:ale_linters_explicit = 1
" keep side gutter open https://github.com/dense-analysis/ale#5ii-how-can-i-keep-the-sign-gutter-open
let g:ale_sign_column_always = 1
" run the linter only on these
let g:ale_linters = {
\ 'html': ['eslint'],
\ 'css': ['eslint'],
\ 'json': ['eslint'],
\ 'javascript': ['eslint'],
\ 'typescript': ['eslint'],
\}
let g:ale_fixers = {
\ 'javascript': ['prettier', 'eslint'],
\ 'typescript': ['prettier', 'eslint'],
\ 'json': ['prettier', 'eslint'],
\ 'css': ['prettier'],
\}
" enable fix on save (prettier,refmt)
"let g:ale_fix_on_save = 1
highlight ALEWarning ctermbg=DarkMagenta
" **************************
" Language-Related
" **************************
" ReasonML
Plug 'reasonml-editor/vim-reason-plus'
call plug#end()
"
" https://github.com/Shougo/deoplete.nvim/blob/378feff8772d0e9f9ef2c94284947f3666576500/doc/deoplete.txt
call deoplete#custom#option({
\ 'prev_completion_mode': "mirror",
\ })
" https://github.com/tbodt/deoplete-tabnine
" [tabnine]
call deoplete#custom#var('tabnine', {
\ 'line_limit': 800,
\ 'max_num_results': 5,
\ })
" basics
filetype plugin indent on
syntax on
syntax enable
set autoindent
set autoread " reload files when changed on disk, i.e. via `git checkout`
set textwidth=80
set backspace=indent,eol,start " make backspace behave in a sane manner
set clipboard=unnamed
set directory-=. " don't store swapfiles in the current directory
set expandtab " expand tabs to spaces
set encoding=utf-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment