Skip to content

Instantly share code, notes, and snippets.

@szg251
Last active February 17, 2021 09:36
Show Gist options
  • Save szg251/7e0d711a7813b2686d1f189e54e0bc82 to your computer and use it in GitHub Desktop.
Save szg251/7e0d711a7813b2686d1f189e54e0bc82 to your computer and use it in GitHub Desktop.
Neovim config
set nocompatible
set number relativenumber
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
set ai!
set foldmethod=syntax
setglobal foldlevelstart=99
set updatetime=300
set ignorecase
" coc
set hidden
set nobackup
set nowritebackup
set shortmess+=c
set signcolumn=yes
set cmdheight=2
set mouse=a
set clipboard=unnamed
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
syntax on
filetype plugin indent on
call plug#begin()
" General
Plug 'tmhedberg/matchit'
Plug 'thinca/vim-localrc'
Plug 'Raimondi/delimitMate'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-surround'
Plug 'godlygeek/tabular'
Plug 'tpope/vim-unimpaired'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'dyng/ctrlsf.vim'
Plug 'vim-scripts/ReplaceWithRegister'
Plug 'airblade/vim-gitgutter'
" Looks
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
Plug 'junegunn/rainbow_parentheses.vim'
" Language support
Plug 'pangloss/vim-javascript'
Plug 'HerringtonDarkholme/yats.vim' " TS Syntax
Plug 'tpope/vim-commentary'
Plug 'stephenway/postcss.vim'
Plug 'mxw/vim-jsx'
Plug 'purescript-contrib/purescript-vim'
Plug 'elixir-editors/vim-elixir'
Plug 'ElmCast/elm-vim'
Plug 'neovimhaskell/haskell-vim'
Plug 'sdiehl/vim-ormolu'
" Plug 'dag/vim2hs'
Plug 'reasonml-editor/vim-reason-plus'
Plug 'LnL7/vim-nix'
" Autocompletion
Plug 'neomake/neomake'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
call plug#end()
" Theme settings
colorscheme gruvbox
let g:gruvbox_dark_contrast = 'hard'
set background=dark
set colorcolumn=100
" Python path settings (configured for MacPorts
let g:python_host_prog = '$HOME/.nix-profile/bin/python'
let g:python3_host_prog = '$HOME/.nix-profile/bin/python3'
" Neomake
let g:neomake_javascript_enabled_makers = ['eslint']
autocmd! BufWritePost,BufEnter * Neomake
" JS settings
let javaScript_fold=1
" Haskell settings
let g:haskell_conceal_wide = 1
let g:haskell_indent_if = 4
let g:haskell_indent_case = 4
let g:haskell_indent_let = 4
let g:haskell_indent_where = 6
let g:haskell_indent_before_where = 2
let g:haskell_indent_after_bare_where = 2
let g:haskell_indent_do = 3
let g:haskell_indent_in = 1
let g:haskell_indent_guard = 2
let g:haskell_indent_case_alternative = 1
let g:cabal_indent_section = 2
" NERDTree settings
let g:NERDSpaceDelims = 1
let g:NERDDefaultAlign = 'left'
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
let g:NERDTreeQuitOnOpen = 1
let g:NERDTreeShowHidden = 1
" Ctrl P settings
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|elm-stuff'
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
" CtrlSF settings
nmap <leader>a :CtrlSF -R ""<Left>
nmap <leader>A <Plug>CtrlSFCwordPath -W<CR>
nmap <leader>c :CtrlSFFocus<CR>
nmap <leader>C :CtrlSFToggle<CR>
let g:ctrlsf_winsize = '33%'
let g:ctrlsf_auto_preview = 1
let g:ctrlsf_auto_close = 0
let g:ctrlsf_confirm_save = 0
let g:ctrlsf_auto_focus = {
\ 'at': 'start',
\ }
let g:ctrlsf_mapping = {
\ "next": "n",
\ "prev": "N",
\ }
" Substitute the word under the cursor.
nmap <leader>s :%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>
" Coc Settings
command! -nargs=0 Prettier :CocCommand prettier.formatFile
"
" Keyboard Shortcuts
"
"
nnoremap <silent>C-H :TmuxNavigateLeft<cr>
nnoremap <silent>C-J :TmuxNavigateDown<cr>
nnoremap <silent>C-K :TmuxNavigateUp<cr>
nnoremap <silent>C-L :TmuxNavigateRight<cr>
nnoremap <silent>C-\ :TmuxNavigatePrevious<cr>
" CoC
nnoremap <silent> K :call <SID>show_documentation()<CR>
" NERDTree
nnoremap <C-n> :NERDTreeToggle<CR>
nnoremap <Leader>f :NERDTreeFind<CR>
" Grepper
nnoremap <Leader>g :Grepper -tool ag<cr>
" FZF
nnoremap <silent>c-p :FZF<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment