Skip to content

Instantly share code, notes, and snippets.

@tannerburson
Created November 11, 2019 23:28
Show Gist options
  • Save tannerburson/814977ffd0ac78cd6e012781ee65b8e0 to your computer and use it in GitHub Desktop.
Save tannerburson/814977ffd0ac78cd6e012781ee65b8e0 to your computer and use it in GitHub Desktop.
NeoVim config
"
"Default leader sucks, space makes a lot of things cleaner
"
let mapleader = "\<Space>"
call plug#begin(stdpath('data') . '/plugged')
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'scrooloose/nerdtree'
Plug 'jiangmiao/auto-pairs'
Plug 'vim-airline/vim-airline'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
"Colors
Plug 'jacoborus/tender.vim'
Plug 'nightsense/carbonized'
Plug 'joshdick/onedark.vim'
" LSP
Plug 'dense-analysis/ale'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
"let g:coc_node_path = '/usr/local/bin/node'
" Completion
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemovePlugins' }
" Ruby/Rails specifcs
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-rails'
" Vue
Plug 'posva/vim-vue'
" Typescript
Plug 'HerringtonDarkholme/yats.vim'
Plug 'mhartington/nvim-typescript', {'do': './install.sh'}
call plug#end()
" FZF
let g:fzf_buffers_jump = 1
let g:fzf_history_dir = '~/.local/share/fzf-history'
nnoremap <silent> <leader>ff :Files<CR>
"
"Map leader-b for buffer browsing
nnoremap <silent> <leader>b :Buffers<CR>
" Vue
let g:vue_pre_processors = 'detect_on_enter'
" Colors
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
colorscheme onedark
let g:lightline = { 'colorscheme': 'onedark' }
set termguicolors
" ALE Config
let g:ale_fixers = {
\ 'ruby': ['standardrb'],
\}
let g:ale_fix_on_save = 1
let g:deoplete#enable_at_startup = 1
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Enter selects first suggestion
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>"
"
" <TAB>: completion for deoplete
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
"highlight the current cursor line
set cursorline
" hybrid line numbers
set number relativenumber
" enable mouse
set mouse=a
"Maps to make splits cleaner to move around
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-L> <C-W>l<C-W>_
map <C-H> <C-W>h<C-W>_
map <C-K> <C-W>k<C-W>_
"Set default split positions
set splitbelow
set splitright
"Open file under cursor in a new tab
nnoremap <leader>gt <C-W>gf
"
"Tab motion
nmap <C-P> :tabprev<cr>
nmap <C-N> :tabnext<cr>
"Control+D to open NERDTree
map <silent> <C-D> :NERDTreeToggle<CR>
"leader space to remove search highlighting but not clear the search
nnoremap <leader><space> :noh<cr>
"Clear the search
nnoremap <leader><C-space> :let @/=''<cr>
"
"In insert mode hit jj quickly to be the same as escape
inoremap jj <ESC>
inoremap fd <ESC>
"
"Default to spaces not tabs, 2 spaces = 1 tab
set expandtab
set ts=2
set sw=2
"Git Commands
nnoremap <leader>gs :Gstatus<cr>
" add -v so we get git diffs in our commit window
nnoremap <leader>gc :Gcommit -v<cr>
nnoremap <leader>gd :Gdiff<cr>
nnoremap <leader>gp :Git push<cr>
"Rails.vim remaps
"Open the test in a split
nnoremap <leader>rs :AV<cr>
"Open the test in a tab
nnoremap <leader>rt :AT<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment