Skip to content

Instantly share code, notes, and snippets.

@olivoil
Last active April 27, 2018 16:10
Show Gist options
  • Save olivoil/418137957225bb0516b5d320c3af4033 to your computer and use it in GitHub Desktop.
Save olivoil/418137957225bb0516b5d320c3af4033 to your computer and use it in GitHub Desktop.
dots
filetype plugin indent on
syntax on
let mapleader = ','
set inccommand=split
set number
set laststatus=2
set modelines=5
set vb t_vb=
set ts=2 sts=2 sw=2 expandtab
set listchars=tab:‣\ ,trail:·,precedes:«,extends:»,eol:¬
set incsearch
set nojoinspaces
set display+=lastline
set termguicolors
nmap <esc><esc> :noh<return>
" custom filetype settings
autocmd BufNewFile,BufRead apple-app-site-association set filetype=json
autocmd BufNewFile,BufRead *Dockerfile* set filetype=dockerfile
autocmd BufNewFile,BufRead .babelrc,.bowerrc,.eslintrc,.jshintrc set filetype=json
autocmd BufNewFile,BufRead *.conf set filetype=conf
autocmd BufNewFile,BufRead *.css set filetype=scss
autocmd BufNewFile,BufRead .env* set filetype=sh
autocmd Filetype Makefile setlocal ts=4 sw=4 sts=0 expandtab
" crontab editing
autocmd filetype crontab setlocal nobackup nowritebackup
" theme
set background=dark
let g:solarized_visibility = 'high'
let g:solarized_contrast = 'high'
let g:solarized_termtrans = 1
let g:solarized_termcolors = 256
" colorscheme solarized8_dark
colorscheme apprentice
" clipboard
set clipboard+=unnamedplus
let s:clip = '/mnt/c/Windows/System32/clip.exe'
if executable(s:clip)
augroup WSLYank
autocmd!
autocmd TextYankPost * call system('echo '.shellescape(join(v:event.regcontents, "\<CR>")).' | '.s:clip)
augroup END
end
" motion
if has('nvim')
tnoremap <Esc> <C-\><c-n>
tnoremap <C-h> <C-\><C-n><C-w>h
tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-k> <C-\><C-n><C-w>k
tnoremap <C-l> <C-\><C-n><C-w>l
tnoremap <expr> <C-r> '<C-\><C-N>"'.nr2char(getchar()).'pi'
nnoremap <C-h> <C-w>h
nmap <BS> <C-W>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
endif
" packages
packadd minpac
call minpac#init()
call minpac#add('lifepillar/vim-solarized8')
call minpac#add('romainl/Apprentice')
call minpac#add('tpope/vim-surround')
call minpac#add('tpope/vim-unimpaired')
call minpac#add('tpope/vim-commentary')
call minpac#add('machakann/vim-highlightedyank')
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('mhinz/vim-startify')
" Git +/- signs in gutter
call minpac#add('airblade/vim-gitgutter')
let g:gitgutter_terminal_reports_focus=0
" Autocomplete
if has('nvim')
call minpac#add('Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'})
else
call minpac#add('Shougo/deoplete.nvim')
call minpac#add('roxma/nvim-yarp')
call minpac#add('roxma/vim-hug-neovim-rpc')
endif
" Snippets
call minpac#add('Shougo/neosnippet.vim')
call minpac#add('Shougo/neosnippet-snippets')
" Project navigation
call minpac#add('junegunn/fzf', {'do': './install --all'})
call minpac#add('junegunn/fzf.vim')
nnoremap <C-p> :FZF<CR>
call minpac#add('scrooloose/nerdtree')
map <C-n> :NERDTreeToggle<CR>
" File navigation
call minpac#add('majutsushi/tagbar')
nnoremap <C-b> :Tagbar<CR>
call minpac#add('severin-lemaignan/vim-minimap')
" Linter
call minpac#add('w0rp/ale')
let g:ale_javascript_eslint_executable = 'eslint_d'
let g:ale_javascript_eslint_use_global = 1
let g:ale_linters = {
\ 'javascript': [
\ 'eslint',
\ 'flow',
\ ],
\}
let g:ale_fixers = {
\ 'javascript': [
\ 'eslint',
\ ],
\ 'typescript': [
\ 'prettier',
\ ],
\}
let g:ale_fix_on_save = 1
" Go
call minpac#add('fatih/vim-go')
call minpac#add('zchee/deoplete-go', {'do': 'make'})
" Flowtype
call minpac#add('prabirshrestha/async.vim')
call minpac#add('prabirshrestha/vim-lsp')
if executable('flow-language-server')
au User lsp_setup call lsp#register_server({
\ 'name': 'flow-language-server',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'flow-language-server --stdio']},
\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), '.flowconfig'))},
\ 'whitelist': ['javascript'],
\ })
endif
let g:flow#showquickfix = 0
nnoremap <Leader>t :LspHover<CR>
nnoremap <Leader>d :LspDefinition<CR>
nnoremap <Leader>r :LspReferences<CR>
call minpac#add('flowtype/vim-flow')
call minpac#add('wokalski/autocomplete-flow')
" Prettier
call minpac#add('prettier/vim-prettier')
let g:prettier#exec_cmd_async = 1
let g:prettier#autoformat = 1
let g:prettier#config#print_width = 80
let g:prettier#config#tab_width = 2
let g:prettier#config#use_tabs = 'false'
let g:prettier#config#semi = 'true'
let g:prettier#config#single_quote = 'false'
let g:prettier#config#bracket_spacing = 'true'
let g:prettier#config#jsx_bracket_same_line = 'false'
let g:prettier#config#arrow_parens = 'avoid'
let g:prettier#config#trailing_comma = 'none'
let g:prettier#config#parser = 'babylon'
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue PrettierAsync
command! PackUpdate packadd minpac | source $MYVIMRC | redraw | call minpac#update()
command! PackClean packadd minpac | source $MYVIMRC | call minpac#clean()
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment