Skip to content

Instantly share code, notes, and snippets.

@gravitano
Last active August 29, 2015 13:57
Show Gist options
  • Save gravitano/9618691 to your computer and use it in GitHub Desktop.
Save gravitano/9618691 to your computer and use it in GitHub Desktop.
My ~/.vimrc file :D
execute pathogen#infect()
syntax on
filetype plugin indent on
" CtrlP Stuff
set runtimepath^=~/.vim/bundle/ctrlp.vim
set encoding=utf-8
let g:ctrl_max_height=20
set wildignore+=*.pyc
set wildignore+=_build/*
set wildignore+=*/coverage/*
" Jangan tampilkan source dari vendor directory pada saat panggil ctrl+p
set wildignore+=*/vendor/**
set t_Co=256
set laststatus=2
"Tampilkan NERDTRee jika tidak ada file yang dibuka
"autocmd vimenter * if !argc() | NERDTree | endif
" Color Scheme
colorscheme xoria256
set nocompatible " Disable vi-compatibility
"set guifont=Monaco:h12
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=25
set showmode " always show what mode we're currently editing in
set nowrap " don't wrap lines
set tabstop=4 " a tab is four spaces
set smarttab
set tags=tags
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 shiftwidth=4 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
set timeout timeoutlen=200 ttimeoutlen=100
set visualbell " don't beep
set noerrorbells " don't beep
set autowrite "Save on buffer switch
set mouse=a
" Swap files out of the project root
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
set cursorline " Aktifkan posisi cursor
set hidden " Ganti buffer tanpa save
set hlsearch " Pencarian dengan hightlight
set incsearch " Pencarian langsung di-hightlight tiap kali diketik
" Kalau sudah selesai cari, hilangkan highlight
nmap <silent> :silent :nohlsearch<CR>
autocmd cursorhold * set nohlsearch
autocmd cursormoved * set hlsearch
" Laravel snippet
autocmd FileType php set ft=php.laravel
autocmd FileType blade set ft=blade.html
" MAPPING
" Reformat Code
nmap <C-F> gg=G<CR>
" NERDTreeToggle
map <C-e> :NERDTreeToggle<CR>
map <C-w> :NERDTreeToggle<CR>
" Buffer Tag
map <C-r> :CtrlPBufTag<CR>
" Select All
nmap <C-A> ggVG$
" Show Buffer
nmap <C-B> :CtrlPBuffer<CR>
" Move Window
" Ke atas
nnoremap <C-Up> :wincmd k<CR>
" Ke Kanan
nnoremap <C-Right> :wincmd l<CR>
" Ke Kiri
nnoremap <C-Left> :wincmd h<CR>
" Ke Bawah
nnoremap <C-Down> :wincmd j<CR>
" Otomatis buat direktori saat save jiga parent directory tidak ada
augroup BWCCreateDir
autocmd!
autocmd BufWritePre * if expand("<afile>")!~#'^\w\+:/' && !isdirectory(expand("%:h")) | execute "silent! !mkdir -p ".shellescape(expand('%:h'), 1) | redraw! | endif
augroup END
" Open splits
nmap vs :vsplit<cr>
nmap sp :split<cr>
" Create/edit file in the current directory
nmap :ed :edit %:p:h/
" Duplikat
nmap <C-d> yyp
" Window resizer
nmap <C-v> :vertical resize +10<CR>
" Esc
imap jj <esc>
nmap jj <esc>
" Save
imap js <esc>:w<CR>
" Visual
imap jv <esc>v
" Abbreviations
abbrev pft PHPUnit_Framework_TestCase
abbrev gm !php artisan generate:model
abbrev gc !php artisan generate:controller
abbrev gmig !php artisan generate:migration
abbrev bootcss <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" />
abbrev bootjs <script href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.js"></script>
abbrev jquerytag <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
" Laravel Stuff
nmap ,lr :e app/routes.php<CR>
nmap ,lca :e app/config/app.php<cr>81Gf(%O
nmap ,lcd :e app/config/database.php<cr>
nmap ,lc :e composer.json<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment