-
-
Save rdok-pigogo/9c407b6667b436b7db1a747088109a5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"|-----------------------------------------------------------------------------| | |
"| Awesome Tips | | |
"|-----------------------------------------------------------------------------| | |
" <C-B> " Go to Definition | |
" zz " Center screen on current line | |
" di( " Delete inside parentheses | |
" ci( " Change inside parentheses | |
" vi( " Select inside parentheses | |
" va( " Select including parentheses | |
" J " Join next line with current one | |
" | |
"|-----------------------------------------------------------------------------| | |
"| End Tips | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| Plugins - Vundle | | |
"------------------------------------------------------------------------------| | |
" Preparations | |
set nocompatible " Behave more Vi-compatible, or a more useful way. | |
filetype off " Don't detect filetypes. | |
" Start Vundle | |
set rtp+=~/.vim/bundle/Vundle.vim " Runtime path: include and initialize Vundle. | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' " Let Vundle manage Vundle, required. | |
" Colorschemes | |
Plugin 'joshdick/onedark.vim' | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'vim-scripts/pyte' | |
Plugin 'vim-scripts/summerfruit256.vim' | |
Plugin 'vim-scripts/simpleandfriendly.vim' | |
Plugin 'NLKNguyen/papercolor-theme' | |
Plugin 'reedes/vim-colors-pencil' | |
Plugin 'vim-scripts/mayansmoke' | |
" File Browsing | |
Plugin 'scrooloose/nerdtree' | |
" Requires sudo apt-get install exuberant-ctags in order to detect tags | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'mileszs/ack.vim' | |
Plugin 'skwp/greplace.vim' | |
" Code | |
Plugin 'ervandew/supertab' | |
Plugin 'MarcWeber/vim-addon-mw-utils' | |
Plugin 'tomtom/tlib_vim' | |
Plugin 'garbas/vim-snipmate' | |
Plugin 'stephpy/vim-php-cs-fixer' | |
Plugin 'tpope/vim-surround' | |
Plugin 'StanAngeloff/php.vim' | |
Plugin 'arnaud-lb/vim-php-namespace' | |
Plugin '907th/vim-auto-save' | |
call vundle#end() " Plugins must be added before the following line. | |
" End Vundlskwp/greplace.vime | |
filetype plugin indent on " Required: Enable filetype: detection, specific | |
" scripts, and indent scripts. | |
"|-----------------------------------------------------------------------------| | |
"| End Plugins - Vundle | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| Vim Settings | | |
"|-----------------------------------------------------------------------------| | |
let $BASH_ENV = "~/.bash_aliases" " Read each time a shell command is run. | |
set autowriteall " Automatically write the file | |
set complete=.,w,b,u " Complete by current, other windows, buffer, or | |
" any other unloaded buffers. | |
" Use an undo file | |
set undofile | |
" Create directories if they don't exist | |
function! CreateDirIfNotExists(name) | |
if !isdirectory(a:name) | |
call mkdir(a:name, "p") | |
endif | |
endfunction | |
call CreateDirIfNotExists("~/.vim/backup/") | |
call CreateDirIfNotExists("~/.vim/swap/") | |
call CreateDirIfNotExists("~/.vim/undo/") | |
" Swap files out of the project root | |
set backupdir=~/.vim/backup// | |
set directory=~/.vim/swap// | |
set undodir=~/.vim/undo// | |
set noerrorbells visualbell t_vb= "Disable bell | |
let mapleader = ',' " Use comma as Leader | |
" | |
" Terminal Title | |
" | |
set title | |
set titlestring=Vim | |
"|-----------------------------------------------------------------------------| | |
"| Vim Settings | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| Plugins Settings | | |
"|-----------------------------------------------------------------------------| | |
" | |
" CtrlP | |
" | |
" MacOSX/Linux: Ignore files/dirs. | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip | |
set wildignore+=*/vendor/** | |
set wildignore+=*/public/packages/** | |
set wildignore+=*/node_modules/** | |
let g:ctrlp_custom_ignore = 'node_modules' | |
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:7,results:7' | |
" | |
" NERDTree | |
" | |
let NERDTreeShowHidden = 1 | |
let NERDTreeHijackNetrw = 0 | |
" | |
" Fallback Ack in case system does not have Ag | |
" | |
if executable('ag') | |
let g:ackprg = 'ag --vimgrep' | |
endif | |
" | |
" skwp/greplace.vim | |
" | |
set grepprg=ag | |
let g:grep_cmd_opts = '--line-numbers --noheading' | |
" | |
" stephpy/vim-php-cs-fixer | |
" | |
let g:php_cs_fixer_level = "psr2" | |
let g:php_cs_fixer_fixers_list = "-psr0" | |
let g:php_cs_fixer_path = '/home/rizart/.config/composer/vendor/bin/php-cs-fixer' | |
nnoremap <silent><Leader>pcd :call PhpCsFixerFixDirectory()<cr> | |
nnoremap <silent><Leader>pcf :call PhpCsFixerFixFile()<cr> | |
" | |
" 907th/vim-auto-save | |
" | |
let g:auto_save = 1 " enable AutoSave on Vim startup | |
let g:auto_save_silent = 1 " do not display the auto-save notification | |
let g:auto_save_events = ["InsertLeave", "TextChanged"] | |
"|-----------------------------------------------------------------------------| | |
"| End Plugin Settings | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| Styling | | |
"|-----------------------------------------------------------------------------| | |
syntax on " Switch on syntax highlighting. | |
set background=light " light/dark | |
" Dark: onedark, solarized | |
" Light: summerfruit256, solarized, pyte, PaperColor, pencil | |
colo summerfruit256 " Use color scheme. | |
set number | |
set lsp=3 | |
set guifont=Monospace\ 12 | |
"hi LineNr guifg=black | |
"hi LineNr guibg=bg | |
"set macligatures " Fire Coda '=' not supported on Ubuntu. | |
" Remove split borders | |
hi vertsplit guifg=bg guibg=bg | |
set showcmd | |
set laststatus=2 | |
set encoding=utf-8 " Necessary to show Unicode glyphs | |
"|-----------------------------------------------------------------------------| | |
"| End Styling | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| Formatting | | |
"|-----------------------------------------------------------------------------| | |
set tabstop=4 "insert 4 spaces for a tab. | |
set shiftwidth=4 "insert 4 spaces for an indentation. | |
set expandtab "insert spaces whenever the tab key is pressed. | |
"|-----------------------------------------------------------------------------| | |
"| End Formatting | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| gVim else Terminal | | |
"|-----------------------------------------------------------------------------| | |
if has("gui_running") " GUI is running or is about to start. | |
set guioptions=c " Use console dialogs | |
set guioptions-=M " Remove menu bar. | |
set guioptions-=T " Remove toolbar. | |
set guioptions-=r " Remove right-hand scroll bar. | |
set guioptions-=R " Remove right-hand scroll bar. | |
set guioptions-=l " Remove left-hand scroll bar. | |
set guioptions-=L " Remove left-hand scroll bar. | |
set guitablabel=%N\:%f " Insert page number and the buffer name. | |
set guioptions-=e " Add tab pages. | |
set lines=999 columns=999 " Maximize gvim window. | |
set ghr=-10 " Remove fat bottom border. Run mutliple times. | |
let g:auto_save = 1 " enable AutoSave on Vim startup | |
let g:auto_save_silent = 1 " do not display the auto-save notification | |
else | |
" Terminal | |
set t_CO=256 " Use 256 colors. | |
endif | |
"|-----------------------------------------------------------------------------| | |
"| End gVim else Terminal | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| Search | | |
"|-----------------------------------------------------------------------------| | |
set hlsearch " Highlight search resulsts | |
set is " While typing a search command, show where the | |
" pattern, as it was typed so far, matches. | |
"|-----------------------------------------------------------------------------| | |
"| End Search | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| Mappings | | |
"|-----------------------------------------------------------------------------| | |
" | |
" Edit files | |
nmap <Leader>ev :vi $MYVIMRC<cr> | |
nmap <Leader>sv :so $MYVIMRC<cr> " Source Vimrc file | |
nmap <Leader>q :q<cr> | |
nmap <Leader>w :w<cr> | |
nmap <Leader>wq :wq<cr> | |
nmap <Leader>bd :bd<cr> " Close current buffer | |
nmap <Leader><SPACE> :nohl<cr> " Stop the highlighting for the search | |
" | |
" Window Splits | |
" | |
set splitbelow " Put windows below the current one. | |
set splitright " Put windows right of the current one. | |
" | |
" Splits | |
" | |
nmap <Leader>sp :sp<cr> | |
nmap <Leader>vsp :vsp<cr> | |
" Windows | |
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> | |
" NERDTree: Toggle Sidebar | |
nmap <S-l> :NERDTreeToggle<cr> <S-r> | |
" CtrlP: Show class properties. | |
nmap <C-T> :CtrlPBufTag<cr> | |
" CtrlP: Show history. | |
nmap <C-E> :CtrlPMRUFiles<cr> | |
nmap <C-P> :CtrlP .<cr> | |
" | |
" Tags | |
" | |
nmap <Leader>f :tag<space> | |
nmap <C-B> <C-]> | |
" Escape to normal mode | |
imap jj <esc> | |
" Change directory to match current file ,cd | |
nnoremap <Leader>cd :cd %:p:h<cr>:pwd<cr> | |
" | |
" Laravel | |
" | |
nmap <Leader><Leader>c :CtrlP<cr>app/Http/Controllers/ | |
" | |
" StanAngeloff/php.vim | |
" | |
function! IPhpInsertUse() | |
call PhpInsertUse() | |
call feedkeys('a', 'n') | |
endfunction | |
autocmd FileType php inoremap <Leader>u <Esc>:call IPhpInsertUse()<CR> | |
autocmd FileType php noremap <Leader>u :call PhpInsertUse()<CR> | |
"|-----------------------------------------------------------------------------| | |
"| End Mappings | | |
"|-----------------------------------------------------------------------------| | |
"|-----------------------------------------------------------------------------| | |
"| Automation | | |
"|-----------------------------------------------------------------------------| | |
augroup vimrc " Combine groups of commands. | |
" Avoid mutlple appearance of autocommands: Clear group. | |
autocmd! | |
autocmd BufWritePost ~/.vimrc source % " Source the Vimrc file on save. | |
augroup END | |
"|-----------------------------------------------------------------------------| | |
"| End Automation | | |
"|-----------------------------------------------------------------------------| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment