Skip to content

Instantly share code, notes, and snippets.

@fosterdill
Last active November 11, 2017 21:45
Show Gist options
  • Save fosterdill/bdf5bc1cfc5242ac569cfcdf11757b77 to your computer and use it in GitHub Desktop.
Save fosterdill/bdf5bc1cfc5242ac569cfcdf11757b77 to your computer and use it in GitHub Desktop.
nvim init file
" plugins
call plug#begin()
Plug 'jremmen/vim-ripgrep'
Plug 'epilande/vim-es2015-snippets'
Plug 'epilande/vim-react-snippets'
Plug 'SirVer/ultisnips'
Plug 'neomake/neomake'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'NLKNguyen/papercolor-theme'
Plug 'ntpeters/vim-better-whitespace'
Plug 'ruanyl/vim-fixmyjs'
Plug 'easymotion/vim-easymotion'
Plug 'wakatime/vim-wakatime'
call plug#end()
" neomake options
let g:neomake_open_list = 2
" let g:neomake_javascript_eslint_exe = $PWD . '/node_modules/.bin/eslint'
let g:neomake_javascript_enabled_makers = ['eslint']
let g:neomake_javascript_eslint_maker = {
\ 'exe': $PWD . '/node_modules/.bin/eslint',
\ 'args': ['-f', 'compact', '-c', '/Users/dylan/.eslintrc.js'],
\ 'errorformat': '%E%f: line %l\, col %c\, Error - %m,%W%f: line %l\, col %c\, Warning - %m,%-G,%-G%*\d problems%#'
\ }
call neomake#configure#automake('rw', 100)
" ultisnips options
let g:UltiSnipsExpandTrigger="<C-l>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" fixmyjsx options
let g:fixmyjs_rc_filename = ['.eslintrc.js']
let g:fixmyjs_use_local = 1
" fzf options
let g:fzf_history_dir = '~/.local/share/fzf-history'
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
" Rg options
let g:rg_highlight = 1
" autocmds
autocmd BufEnter * EnableStripWhitespaceOnSave
" custom commands and functions
function RenameInCurrentDir(new_name)
execute "!mv % $(dirname %)/" . a:new_name
execute "e %:p:h/" . a:new_name
endfunction
command -nargs=* RenameInCurrentDir call RenameInCurrentDir(<f-args>)
function NewInCurrentDir(name)
execute "e %:p:h/" . a:name
endfunction
command -nargs=* NewInCurrentDir call NewInCurrentDir(<f-args>)
function OpenVimRc()
e ~/.config/nvim/init.vim
endfunction
command OpenVimRc call OpenVimRc()
function LastFile()
e ~/.config/nvim/init.vim
endfunction
command LastFile call LastFile()
" maps
nnoremap <tab>n :cn<CR>
nnoremap <tab>p :cp<CR>
nnoremap <tab>o :e<space>%:p:h/
nnoremap <leader><leader><leader>f :Fixmyjs<CR>
nnoremap <leader>r :RenameInCurrentDir<space>
nnoremap <leader>e :NewInCurrentDir<space>
nnoremap <leader>x :OpenVimRc<CR>
nnoremap <leader>g :GFiles<CR>
nnoremap <leader>c :ccl<CR>
nnoremap <leader>v :copen<CR>
nnoremap <leader>f :Files<CR>
nnoremap <leader>a :Rg<space>-i<space>
nnoremap <leader>b :Buffers<CR>
inoremap kj <Esc>
vnoremap // y/<C-R>"<CR>
" vim options
set relativenumber
set shiftwidth=2
set expandtab
set hidden
set ignorecase
set smartcase
let &softtabstop = &shiftwidth
colorscheme PaperColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment