Skip to content

Instantly share code, notes, and snippets.

@azimidev
Last active September 24, 2019 16:27
Show Gist options
  • Save azimidev/5ce1285f57d257f4240ac4d668d1e75e to your computer and use it in GitHub Desktop.
Save azimidev/5ce1285f57d257f4240ac4d668d1e75e to your computer and use it in GitHub Desktop.
Personal .vimrc file with ~/.vim/plugins.vim file and Vundle installed (https://github.com/VundleVim/Vundle.vim)
so ~/.vim/plugins.vim " Source from plugins
set nocompatible " Disable vi-compatibility
syntax on " Enable syntax highlighting
" Pathogen plugin specific
execute pathogen#infect()
filetype plugin indent on " Pathogen
set background=dark " Set bg to dark
colorscheme hybrid_material " Color scheme
set noerrorbells visualbell t_vb= " No bell
set t_Co=256 " Enable 256 color
let g:solarized_termcolors=256
let g:solarized_termtrans=1
"hi LineNr ctermfg=gray ctermbg=bg " Highlight line number
hi LineNr guibg=bg " Line number gui background
hi foldcolumn guibg=bg " Add left padding before line number
set foldcolumn=2 " Padding left size
let mapleader = ',' " Change leader from \ to ,
let g:mapleader = "," " Change gui leader from \ to ,
set ruler " Show ruler on the buttom
set showmode " Last line
set showcmd " Last line
set hidden " Allow hidden buffers
set hlsearch " Searching using /
set incsearch " Space to quit highlited search
set modelines=0 " Security
" Whitespace ==========================================
set wrap " Wrap the text
set textwidth=79 " Set text width
set formatoptions=tcqrn1 " Set format options
set tabstop=4 " Set tab stop
set shiftwidth=4 " number of spaces to use for autoindenting
set softtabstop=4 " when hitting <BS>, pretend like a tab is removed, even if spaces
set expandtab " expand tabs by default (overloadable per file type later)
" set noshiftround " No shift round
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set smarttab " Set smart tab
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
set visualbell " don't beep
set noerrorbells " don't beep
set autowrite " Save on buffer switch
set autowriteall " Automatically write the file when switching
nnoremap j gj " Down is really the next line
nnoremap k gk " Up is really the next line
imap jj <esc> " Easy escaping to normal model
set timeout timeoutlen=200 ttimeoutlen=100
set mouse=a
set tags=tags
let g:enable_bold_font = 1 " Enable bold font
let g:enable_italic_font = 1 " Enable italic font
set guifont=Operator_Mono_Lig:h15 " Set font and _ instead of space
" set macligatures " Enable font ligatures
set linespace=15 " Set line space
set complete=.,w,b,u
set guioptions-=l
set guioptions-=L " Removes left hand scroll bar
set guioptions-=r " Removes right hand scroll bar
set guioptions-=R
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
let g:ctrlp_match_window = 'top,order:ttb,min:1,max:30,results:30'
let NERDTreeHijackNetrw = 0
set grepprg=ag
let g:grep_cmd_opts = '--line-numbers --noheading'
" Mappings ============================================
nmap <Leader>ev :tabedit $MYVIMRC<cr> " Make it easy to edit the .vimrc file
nmap <Leader>es :e ~/.vim/snippets/ " Make it easy to edit the .vimrc file
nmap <Leader><space> :nohlsearch<cr> " Disable the seach highlight
nnoremap <silent><leader>pf :call PhpCsFixerFixFile()<CR>
" Make NerdTreeToggle easier ==========================
nmap <D-1> :NERDTreeToggle<cr>
nmap <c-R> :CtrlPBufTag<cr>
nmap <D-e> :CtrlPMRUFiles<cr>
nmap <Leader>f :tag<space>
nmap <leader>w :w!<cr> " Fast saves
" Split Management ====================================
set splitbelow
set splitright
" Easier window navigation ============================
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>
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 :e app/<cr>
nmap <Leader><Leader>v :e resources/views/<cr>
" Resize vsplit =======================================
nmap <C-v> :vertical resize +5<cr>
nmap 25 :vertical resize 40<cr>
nmap 50 <c-w>=
nmap 75 :vertical resize 120<cr>
nmap ,c :!open -a Google\ Chrome<cr> " Load the current buffer in Chrome
" Quickly go forward or backward to buffer
nmap :bp :BufSurfBack<cr>
nmap :bn :BufSurfForward<cr>
hi Search cterm=underline
map <Leader>t :!phpunit %<cr> " Run PHPUnit tests
" Swap files out of the project root ===================
" set backupdir=~/.vim/backup//
" set directory=~/.vim/swap//
let g:EasyMotion_leader_key = '<Leader>' " Easy motion stuff
" Powerline (Fancy thingy at bottom stuff) =============
let g:Powerline_symbols = 'fancy'
set laststatus=2 " Always show the statusline
set encoding=utf-8 " Necessary to show Unicode glyphs
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
autocmd cursorhold * set nohlsearch
autocmd cursormoved * set hlsearch
autocmd BufWritePre *.php :%s/\s\+$//e " Auto-remove trailing spaces
command! H let @/="" " Remove search results
" If you prefer the Omni-Completion tip window to close when a selection is
" made, these lines close it on movement in insert mode or when leaving
" insert mode
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Auto-Command ==========================================
"Automatically source the vimrc file on save
augroup autosourcing
autocmd!
autocmd BufWritePost .vimrc source %
augroup END
" CtrlP Stuff ===========================================
" Familiar commands for file/symbol browsing
map <D-p> :CtrlP<cr>
map <C-r> :CtrlPBufTag<cr>
" I don't want to pull up these folders/files when calling CtrlP
set wildignore+=*/vendor/**
set wildignore+=*/public/forum/**
" Open splits ===========================================
nmap vs :vsplit<cr>
nmap sp :split<cr>
function! IPhpInsertUse()
call PhpInsertUse()
call feedkeys('a', 'n')
endfunction
autocmd FileType php inoremap <Leader>n <Esc>:call IPPhpInsertUse()<CR>
autocmd FileType php noremap <Leader>n :call PhpInsertUse()<CR>
" NOTE: install Vundle from (https://github.com/VundleVim/Vundle.vim)
" Create --> PATH = ~/.vim/plugins.vim
" Paste the config below
" Run :PluginInstall
" =========================
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-vinegar'
Plugin 'scrooloose/nerdtree'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'rking/ag.vim'
Plugin 'tpope/vim-surround'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
@azimidev
Copy link
Author

in vim type

:PluginInstall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment