Skip to content

Instantly share code, notes, and snippets.

@AndyG
Last active November 19, 2018 19:02
Show Gist options
  • Save AndyG/cc50bbcc32a475f71950fd6819db4a48 to your computer and use it in GitHub Desktop.
Save AndyG/cc50bbcc32a475f71950fd6819db4a48 to your computer and use it in GitHub Desktop.
Neovim config file w/ vim-plug.
" Allow filetype-specific plugins.
filetype plugin on
" Update faster (mainly for git stuff).
set updatetime=100
" Split navigation with tab and backspace.
nnoremap <Tab> <c-w>w
nnoremap <bs> <c-w>W
" Line numbers, show relative in normal mode, absolute in insert mode.
:set number relativenumber
:augroup numbertoggle
: autocmd!
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
:augroup END
" <leader>c to clear highlighting from search.
nnoremap <leader>c :nohls<CR>
" Smarter searching case sensitivity.
set ignorecase
set smartcase
" ----- PLUGINS ----- "
call plug#begin('~/.config/nvim/plugged')
" Git integration
Plug 'airblade/vim-gitgutter'
" Local vimrc support
Plug 'embear/vim-localvimrc'
let g:localvimrc_sandbox = 0
let g:localvimrc_persistent = 1
" NERDTree (<C-n> to toggle on-off).
Plug 'scrooloose/nerdtree', {'on':'NERDTreeToggle'}
nnoremap <C-n> :NERDTreeToggle<CR>
" NERDCommenter
Plug 'scrooloose/nerdcommenter'
let NERDSpaceDelims=1
" Sneak (easier navigation to text).
Plug 'justinmk/vim-sneak'
let g:sneak#label = 1
let g:sneak#use_ic_scs = 1
" Async Lint Engine.
Plug 'w0rp/ale'
let g:ale_linters = {'javascript': ['eslint', 'flow-language-server'], 'markdown': [], 'python': ['flake8']}
" Javascript syntax highlighting and indenting.
Plug 'pangloss/vim-javascript'
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_flow = 1
" JSX syntax highlighting,
Plug 'mxw/vim-jsx'
" DeopleteY JS completion engine w/ flow support.
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'wokalski/autocomplete-flow'
""" Necessary for func argument completion.
Plug 'Shougo/neosnippet'
Plug 'Shougo/neosnippet-snippets'
let g:deoplete#enable_at_startup = 1
let g:neosnippet#enable_completed_snippet = 1
" Startup screen.
Plug 'mhinz/vim-startify'
let g:startify_change_to_vcs_root=1
""" Fuzzy file search utilities with FZF and ripgrep. See: https://medium.com/@crashybang/supercharge-vim-with-fzf-and-ripgrep-d4661fc853d2
" Fuzzy file search within directories (<c-p> to search..
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'}
Plug 'junegunn/fzf.vim'
nnoremap <c-p> :GFiles <CR>
" Regex searching in directory.
Plug 'jremmen/vim-ripgrep'
" --column: Show column number
" --line-number: Show line number
" --no-heading: Do not show file headings in results
" --fixed-strings: Search term as a literal string
" --ignore-case: Case insensitive search
" --hidden: Search hidden files and folders
" --follow: Follow symlinks
" --glob: Additional conditions for search (in this case ignore everything in the .git/ folder)
" --color: Search color options
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0)
""" End fuzzy file search stuff.
" Session tracking.
Plug 'tpope/vim-obsession'
" Auto-closing structures.
Plug 'Raimondi/delimitMate'
" Green means go.
call plug#end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment