Skip to content

Instantly share code, notes, and snippets.

@petervmeijgaard
Last active August 16, 2016 12:55
Show Gist options
  • Save petervmeijgaard/1cf75f93e412a225bb86 to your computer and use it in GitHub Desktop.
Save petervmeijgaard/1cf75f93e412a225bb86 to your computer and use it in GitHub Desktop.
Development configuration
set macligatures
"Disable Command + P
if has("gui_macvim")
macmenu &File.Print key=<nop>
endif
set nocompatible "The latest Vim settings/options"
so ~/.vim/plugins.vim
syntax enable
"--- Override keys ---"
set backspace=indent,eol,start
"--- Override setting ---"
set backupdir=~/.vim/backup_files// "Set backup directory"
set directory=~/.vim/swap_files// "Set swap directory"
set undodir=~/.vim/undo_files// "Set undo directory"
set hidden
set autowriteall "Always save the file"
set complete=.,w,b,u "Set autocompletion"
"--- Visuals ---"
let g:seoul256_background = 233
colorscheme seoul256
set number "Enable line numbers"
set linespace=15 "Line height"
set t_Co=256 "Set colors for terminal"
set guifont=Fira_Code:h17 "Set font and size"
set guioptions-=e "Remove the tabs"
set noerrorbells visualbell t_vb= "Disable the bells"
"Remove the sidebars for mvim"
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
"Override visuals"
"Override the visuals for the vsplit"
hi vertsplit guifg=bg guibg=bg
hi TabLineFill guifg=bg guibg=bg
"--- Search ---"
set hlsearch "Enable highlight search"
set incsearch "Enable incremental search"
"--- Split ---"
set splitbelow
set splitright
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>
"--- Mappings ---"
let mapleader = ','
nmap <Leader>ev :tabedit $MYVIMRC<cr>
nmap <Leader>es :e ~/.vim/snippets/
nmap <Leader><space> :nohlsearch<cr>
"--- Plugins ---"
"=== PeepOpen ==="
"--- Mappings ---"
nmap <D-p> <Plug>PeepOpen
"=== CtrlP ==="
"--- Mappings ---"
nmap <D-r> :CtrlPBufTag<cr>
nmap <D-e> :CtrlPMRUFiles<cr>
"--- Overrides ---"
let g:ctrlp_custom_ignore = 'node_modules\DS_Store\|git'
let g:ctrlp_match_window = 'top,order:ttb,min:1,max:30,results:30'
" 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
"=== NERDTree ==="
"--- Mappings ---"
nmap <D-1> :NERDTreeToggle<cr>
"--- Overrides ---"
let NERDTreeHijackNetrw = 0
"=== CTags ==="
"--- Mappings ---"
nmap <Leader>f :tag<space>
"=== PregReplace ==="
"--- Overrides ---"
set grepprg=ag "We want to use Ag"
let g:grep_cmd_opts = '--line-numbers --noheading'
"=== vim-php-cs-fixer.vim ==="
"--- Mappings ---"
nnoremap <silent><leader>pd :call PhpCsFixerFixDirectory()<CR>
nnoremap <silent><leader>pf :call PhpCsFixerFixFile()<CR>
"--- Overrides ---"
let g:php_cs_fixer_level = "psr2"
"--- Language and Framework Specific ---"
"=== Laravel ==="
nmap <Leader>lr :e app/Http/routes.php<cr>
nmap <Leader>lc :e app/Http/Controllers<cr>
nmap <Leader>lm :e app<cr>
nmap <Leader>lv :e resources/views<cr>
"--- Auto-Commands ---"
"Auto source the Vimrc file on save.
augroup autosourcing
autocmd!
autocmd BufWritePost .vimrc source%
augroup END
function! IPhpInsertUse()
call PhpInsertUse()
call feedkeys('a', 'n')
endfunction
autocmd FileType php inoremap <Leader>n <Esc>:call IPhpInsertUse()<CR>
autocmd FileType php noremap <Leader>n :call PhpInsertUse()<CR>
function! IPhpExpandClass()
call PhpExpandClass()
call feedkeys('a', 'n')
endfunction
autocmd FileType php inoremap <Leader>nf <Esc>:call IPhpExpandClass()<CR>
autocmd FileType php noremap <Leader>nf :call PhpExpandClass()<CR>
"--- Frequently Used Keystrokes ---"
" - Press ctrl + ] to jump to the method or property the cursor is on
" - Press zz to instantly center the line where the cursor is located
" - Press ctrl + ^ to jump back to the previous selection
" - Press vi' to select everything between the single quotes
" (You can change the single quote to you desired character)
" - Press di' to delete everything between the single quotes
" - Press ci' to change everything between the single quotes
" - Press gg to move to the top of the file
" - Press G to move to the end of the file
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="mh"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
# User configuration
export ANDROID_HOME=/usr/local/opt/android-sdk
export USER_PATH="$HOME/bin"
export COMPOSER_BIN="$HOME/.composer/vendor/bin"
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:$USER_PATH:$COMPOSER_BIN"
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
source ~/.zsh/aliases.zsh
# Open files
alias vrc='vim ~/.vimrc'
alias gvrc='vim ~/.gvimrc'
alias zrc='vim ~/.zshrc'
alias af='vim ~/.zsh/aliases.zsh'
alias vpf='vim ~/.vim/plugins.vim'
alias hosts='sudo vim /private/etc/hosts'
# Open snippets
alias phpsnip='mvim ~/.vim/snippets/php.snippets'
# Open directories
alias clouds='cd ~/Documents/Clouds'
alias dbox='cd ~/Documents/Clouds/Dropbox'
alias odrive='cd ~/Documents/Clouds/OneDrive'
alias gdrive='cd ~/Documents/Clouds/Google\ Drive'
# Project & Web aliases
alias ph='cd ~/Development/projects'
alias wh='cd ~/Development/web'
# Go to websites
alias flexbox-grid-website='cd ~/Development/web/flexbox-grid'
alias jwt-example='cd ~/Development/web/jwt-example'
alias vivid-blog='cd ~/Development/web/vivid-blog'
alias vivid-cms='cd ~/Development/web/vivid-cms'
alias vivid-finance='cd ~/Development/web/vivid-finance'
alias vivid-panel='cd ~/Development/web/vivid-panel'
alias vivid-websolutions='cd ~/Development/web/vivid-websolutions'
alias vue-components-website='cd ~/Development/web/vue-components'
alias vue-development-website='cd ~/Development/web/vue-development'
# Go to projects
alias flexbox-grid-less='cd ~/Development/projects/flexbox-grid-less'
alias flexbox-grid-sass='cd ~/Development/projects/flexbox-grid-sass'
alias flexbox-grid-stylus='cd ~/Development/projects/flexbox-grid-stylus'
alias vue-components='cd ~/Development/web/vue-development/src/assets/vendor/vue-components'
alias vue-flexbox='cd ~/Development/web/vue-development/src/assets/vendor/vue-flexbox'
# Gulp
alias gw='gulp && gulp watch'
# NPM
alias npmd='npm run dev'
alias npmb='npm run build'
# PHP
alias art='php artisan'
alias tinker='php artisan tinker'
alias mr='php artisan migrate:refresh'
alias mrs='php artisan migrate:refresh --seed'
# PHPUnit
alias pu='clear && vendor/bin/phpunit'
# Vagrant
alias vu='sudo vagrant up'
alias vd='sudo vagrant destroy --force'
alias vr='sudo vagrant reload'
alias vh='sudo vagrant halt'
alias vs='sudo vagrant ssh'
# Homestead
alias hm='vendor/bin/homestead make'
# Composer
alias cda='composer dump-autoload'
# Git
alias nah='git reset --hard'
# ZSH-specific
alias update='. ~/.zsh/aliases.zsh'
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 'junegunn/seoul256.vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'jiangmiao/auto-pairs'
Plugin 'rking/ag.vim'
Plugin 'skwp/greplace.vim'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'tpope/vim-surround'
Plugin 'StanAngeloff/php.vim'
Plugin 'arnaud-lb/vim-php-namespace'
Plugin 'ervandew/supertab'
Plugin 'stephpy/vim-php-cs-fixer'
Plugin 'file:///Users/p.c.vanmeijgaard/.vim/bundle/vim-peepopen'
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