Skip to content

Instantly share code, notes, and snippets.


JeffreyWay/.vimrc Secret

Created Feb 16, 2016
What would you like to do?
Laracasts Vim Series
set nocompatible "We want the latest Vim settings/options.
so ~/.vim/plugins.vim
syntax enable
set backspace=indent,eol,start "Make backspace behave like every other editor.
let mapleader = ',' "The default is \, but a comma is much better.
set nonumber "Let's activate line numbers.
set noerrorbells visualbell t_vb= "No damn bells!
colorscheme atom-dark
set t_CO=256 "Use 256 colors. This is useful for Terminal Vim.
set guifont=Fira_Code:h17 "Set the default font family and size.
set macligatures "We want pretty symbols, when available.
set guioptions-=e "We don't want Gui tabs.
set linespace=15 "Macvim-specific line-height.
set guioptions-=l "Disable Gui scrollbars.
set guioptions-=L
set guioptions-=r
set guioptions-=R
"We'll fake a custom left padding for each window.
hi LineNr guibg=bg
set foldcolumn=2
hi foldcolumn guibg=bg
"Get rid of ugly split borders.
hi vertsplit guifg=bg guibg=bg
set hlsearch "Highlight all matched terms.
set incsearch "Incrementally highlight, as we type.
"-------------Split Management--------------"
set splitbelow "Make splits default to below...
set splitright "And to the right. This feels more natural.
"We'll set simpler mappings to switch between splits.
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-H> <C-W><C-H>
nmap <C-L> <C-W><C-L>
"Make it easy to edit the Vimrc file.
nmap <Leader>ev :tabedit $MYVIMRC<cr>
nmap <Leader>es :e ~/.vim/snippets/
"Add simple highlight removal.
nmap <Leader><space> :nohlsearch<cr>
"Quickly browse to any tag/symbol in the project.
"Tip: run ctags -R to regenerated the index.
nmap <Leader>f :tag<space>
"/ CtrlP
let g:ctrlp_custom_ignore = 'node_modules\DS_Store\|git'
let g:ctrlp_match_window = 'top,order:ttb,min:1,max:30,results:30'
nmap <D-p> :CtrlP<cr>
nmap <D-r> :CtrlPBufTag<cr>
nmap <D-e> :CtrlPMRUFiles<cr>
nmap <D-t> <Plug>PeepOpen
"/ NERDTree
let NERDTreeHijackNetrw = 0
"Make NERDTree easier to toggle.
nmap <D-1> :NERDTreeToggle<cr>
"/ Greplace.vim
set grepprg=ag "We want to use Ag for the search.
let g:grep_cmd_opts = '--line-numbers --noheading'
nmap <Leader>lr :e app/Http/routes.php<cr>
nmap <Leader>lm :!php artisan make:
nmap <Leader><Leader>c :e app/Http/Controllers/<cr>
nmap <Leader><Leader>m :CtrlP<cr>app/
nmap <Leader><Leader>v :e resources/views/<cr>
"Automatically source the Vimrc file on save.
augroup autosourcing
autocmd BufWritePost .vimrc source %
augroup END
"-------------Tips and Reminders--------------"
" - Press 'zz' to instantly center the line where the cursor is located.
snippet met
public function ${1}()
snippet pmet
protected function ${1}()
snippet smet
public static function ${1}()
snippet rg
Route::get('${1}', '${2}');
snippet rga
Route::get('${1}', function () {
snippet rp
Route::post('${1}', '${2}');
snippet rpa
Route::post('${1}', function () {
snippet $
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-vinegar'
Plugin 'scrooloose/nerdtree'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'rking/ag.vim'
Plugin 'skwp/greplace.vim'
Plugin 'file:///Users/Screencasts/.vim/bundle/vim-peepopen'
Plugin 'msanders/snipmate.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment