Skip to content

Instantly share code, notes, and snippets.

@estevaoam
Last active September 16, 2019 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save estevaoam/0e8b833196805baa20ccf71f59097b12 to your computer and use it in GitHub Desktop.
Save estevaoam/0e8b833196805baa20ccf71f59097b12 to your computer and use it in GitHub Desktop.
My init.vim file
" Set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible
" Install plugins with vim-plug https://github.com/junegunn/vim-plug
" Reload and runs :PlugInstall to install plugins
call plug#begin('~/.local/share/nvim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tomtom/tcomment_vim'
Plug 'mileszs/ack.vim'
Plug 'lifepillar/vim-solarized8'
Plug 'whatyouhide/vim-gotham'
Plug 'slim-template/vim-slim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'tpope/vim-fugitive'
Plug 'ervandew/supertab'
Plug 'tpope/vim-rails'
Plug 'janko/vim-test'
Plug 'vim-airline/vim-airline'
Plug 'Rigellute/shades-of-purple.vim'
call plug#end()
" Use The Silver Searcher if available
" https://github.com/ggreer/the_silver_searcher
if executable('ag')
let g:ackprg = 'ag --vimgrep'
cnoreabbrev ag Ack
cnoreabbrev aG Ack
cnoreabbrev Ag Ack
cnoreabbrev AG Ack
endif
" -- Configurations --
" Enable syntax highlighting
syntax on
" Don't wrap long lines
set nowrap
" Use 2 spaces for tabs
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smarttab
set mouse=a
set clipboard+=unnamedplus
set termguicolors
" Automatically remove all trailing whitespace
autocmd BufWritePre * %s/\s\+$//e
" Set default colorscheme to solarized
set background=dark
silent! colorscheme shades_of_purple
let g:shades_of_purple_airline = 1
let g:airline_theme='shades_of_purple'
" Enable line numbers and don't make them any wider than necessary
set number numberwidth=2
" -- Mappings --
" Toggle NERDTreeToggle
nmap <C-Space> :NERDTreeToggle<CR>
" Switch between panes
nmap <C-J> <C-W>j
nmap <C-K> <C-W>k
nmap <C-H> <C-W>h
nmap <C-L> <C-W>l
" these "Ctrl mappings" work well when Caps Lock is mapped to Ctrl
nmap <silent> <Leader>n :TestNearest<CR>
nmap <silent> <Leader>f :TestFile<CR>
nmap <silent> <Leader>s :TestSuite<CR>
nmap <silent> t<C-l> :TestLast<CR>
nmap <silent> t<C-g> :TestVisit<CR>
" Mapping CtrlP command
nnoremap <C-b> :<C-U>CtrlPBuffer<CR>
nnoremap <Leader>t :<C-U>CtrlP<CR>
" Custom ignore folders for CtrlP
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git\|dist\|node_modules$'
\ }
" Custom configure rspec
let test#ruby#rspec#executable = 'bundle exec rspec'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment