Skip to content

Instantly share code, notes, and snippets.

@sahibalejandro
Last active March 24, 2017 17:42
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 sahibalejandro/0085680fd8ddd057e7dd to your computer and use it in GitHub Desktop.
Save sahibalejandro/0085680fd8ddd057e7dd to your computer and use it in GitHub Desktop.
vimrc file
"---------- Vundle {{{
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin() "Start Vundle plugins definition
Plugin 'VundleVim/Vundle.vim' "Vundle to manage Vimplugins
Plugin 'wincent/command-t' "Fast file navigation for VIM
Plugin 'ctrlpvim/ctrlp.vim' "Fuzzy file, buffer, mru, tag, etc finder
Plugin 'scrooloose/nerdtree' "A tree explorer plugin for vim.
Plugin 'duggiefresh/vim-easydir' "A simple way to create, edit and save files and parent directories
Plugin 'airblade/vim-gitgutter' "git diff in the gutter
Plugin 'tpope/vim-fugitive' "A Git wrapper so awesome, it should be illegal
Plugin 'kristijanhusak/vim-hybrid-material' "Material color scheme
Plugin 'elentok/plaintasks.vim' "Manage tasks list
Plugin 'tpope/vim-surround' "All about surround
Plugin 'mattn/emmet-vim' "Emmet for vim
Plugin 'sahibalejandro/vim-php' "PHP Support for humans
Plugin 'easymotion/vim-easymotion' "Move at the speed of light
Plugin 'terryma/vim-multiple-cursors' "Multiple cursors
Plugin 'jiangmiao/auto-pairs' "Auto pairs
Plugin 'dietsche/vim-lastplace' "Reopen files at last edit position
Plugin 'stephpy/vim-php-cs-fixer' "Integrate php-cs-fixer
Plugin 'trevordmiller/nova-vim' "A color scheme for modern web development
Plugin 'pangloss/vim-javascript' "Vastly improved Javascript indentation and syntax support
Plugin 'othree/html5.vim' "HTML5 omnicomplete and syntax
Plugin 'hail2u/vim-css3-syntax' "Full CSS colors
Plugin 'jwalton512/vim-blade' "Vim syntax highlighting for Blade templates
Plugin 'posva/vim-vue' "Syntax Highligth for Vue.js components
" Plugins that only works on GUI vim
"if has('gui_macvim')
Plugin 'SirVer/ultisnips' "The ultimate snippet solution for Vim
"endif
call vundle#end() "End Vundle plugins definition
filetype plugin indent on
"}}}
"---------- General {{{
set undofile "Saves undo history to an undo file
set undodir=~/.vim/undo/ "Store undo files in this directory
set nobackup "Disable backup files
set noswapfile "Disable swap files
set backspace=indent,eol,start "Make backspace behave like every other editor
set noerrorbells visualbell "Turn off sound/visual bells
set showcmd "Show (partial) command in the last line of the screen
set autowriteall "Write buffers automagically
set scrolloff=3 "Number of lines visible when scrolling
set encoding=utf-8 "Sets the character encoding used inside Vim
set tags=tags,tags.vendor "Tags files
"}}}
"---------- Indentation {{{
set tabstop=4 "Tabs are 4 spaces big
set shiftwidth=4 "Insert 4 spaces when indenting with >>, <<, > or <
set softtabstop=4 "Number of spaces a tab will insert
set smarttab "Pressing backspace on blank indented line will delete `shiftwidth` spaces
set autoindent "If we're indented, vim will make next line indented when pressing `Enter`
set smartindent "Indent lines inside block syntax like { and }
set expandtab "Insert spaces instead of tab
"}}}
"---------- Text Wrap {{{
set nowrap "Don't wrap
set textwidth=0 "Don't wrap when typing
"}}}
"---------- Search {{{
set hlsearch "Highlight search results
set incsearch "Activate incremental search
set ignorecase "Ignore case when searching
"}}}
"---------- Auto Commands {{{
augroup SAHIB_AUTOCOMMANDS
autocmd!
autocmd BufWritePost .vimrc source %
autocmd FileType vim setlocal foldmethod=marker
augroup END
"}}}
"---------- Status Line {{{
set laststatus=2 "Needed to always show last status
set statusline=%f\ %m\ %r\ %h\ %w\ %q
set statusline+=%= "Switch to the other side
set statusline+=%{fugitive#statusline()}\ %y\ %l,%c\ %p%%\ "
"}}}
"---------- Plugin: CommandT {{{
nnoremap <D-p> :CommandT<CR>
"Number of milliseconds to wait before updating the match listing.
let g:CommandTInputDebounce=50
"Use Vim's present working directory as a root.
let g:CommandTTraverseSCM='pwd'
"Ignore these patterns
let g:CommandTWildIgnore='*/node_modules,*/bower_components,*/public/js,*/public/css,Makefile'
"}}}
"---------- Plugin: CtrlP {{{
nnoremap <D-e> :CtrlPMRU<CR>
nnoremap <D-r> :CtrlPBufTag<CR>
"}}}
"---------- Plugin: NERDTree {{{
nnoremap <D-1> :NERDTreeToggle<CR>
nnoremap - :NERDTreeFind<CR>
"}}}
"---------- Plugin: Git Gutter {{{
set updatetime=500
let g:gitgutter_map_keys=0
"}}}
"---------- Plugin: PHP Vim {{{
augroup VIM_PHP
autocmd!
autocmd FileType php nnoremap <Leader>u :PHPImportClass<cr>
autocmd FileType php nnoremap <Leader>e :PHPExpandFQCNAbsolute<cr>
autocmd FileType php nnoremap <Leader>E :PHPExpandFQCN<cr>
augroup END
"}}}
"---------- Plugin: Emmet {{{
let g:user_emmet_leader_key='<c-z>' "Expand emmet <c-x>,
"}}}
"---------- Plugin: UltiSnips {{{
let g:UltiSnipsSnippetDirectories=[$HOME.'/Vim/Snippets']
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
"}}}
"---------- Plugin: Vim PHP CS Fixer {{{
let g:php_cs_fixer_path = "~/.composer/vendor/bin/php-cs-fixer"
let g:php_cs_fixer_rules= "'{\"@Symfony\": true, \"ordered_imports\": {\"sortAlgorithm\": \"length\"}, \"not_operator_with_space\": true, \"ordered_class_elements\": true, \"phpdoc_add_missing_param_annotation\": {\"only_untyped\": false}, \"phpdoc_order\": true, \"phpdoc_separation\": false}'"
"}}}
"---------- Mappings {{{
let mapleader="," "Leader key
inoremap jk <Esc>
nnoremap <Leader>v :e ~/.vimrc<CR>
"Stop highlighting search results
nnoremap <Leader>ns :nohlsearch<CR>
"Go to tag (Add to .gvimrc: macmenu &Tools.Buid key=<nop>)
nnoremap <D-b> <C-]>
"Delete/close current buffer (Add to .gvimrc: macmenu &File.Close key=<nop>)
nnoremap <D-w> :bd<CR>
nnoremap ,op :silent! bufdo bd<cr>:cd ~/Code/
"Insert spaces on normal mode
nnoremap <Space> i<Space><Esc>l
"Toggle color column
function! ToggleColorColumn()
if &colorcolumn == 0
set colorcolumn=81
else
set colorcolumn=0
endif
endfunction
nnoremap <Leader>r :call ToggleColorColumn()<CR>
" Delete the current file and buffer
nnoremap <Leader>rm :call delete(@%) \| bd<CR>
"}}}
"---------- Visuals {{{
syntax enable
set guifont=source_code_pro:h15
set linespace=20 "Add space between lines
set foldcolumn=1 "Add gutter
set guioptions-=e "Remove MacVim tabs
"Remove scrollbars
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
set number
set background=dark
colorscheme hybrid_reverse
"Personal color tweaks
highlight StatusLine guifg=bg guibg=#888888
highlight ColorColumn guibg=#333333 guifg=red
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment