|
set nocompatible " be iMproved, required |
|
so ~/.vim/plugins.vim |
|
|
|
|
|
syntax enable |
|
|
|
|
|
set backspace=indent,eol,start |
|
let mapleader = ',' |
|
set number |
|
"Automatically write the file when switching buffers |
|
set autowriteall |
|
"Idents |
|
set tabstop=8 |
|
set expandtab |
|
set softtabstop=4 |
|
set shiftwidth=4 |
|
|
|
|
|
|
|
"----------------Visuals----------- |
|
"set Lucius coloerscheme |
|
colorscheme lucius |
|
let g:lucius_style='light' |
|
let g:lucius_contrast='low' |
|
let g:lucius_contrast_bg='normal' |
|
let g:lucius_use_bold = 1 |
|
let g:lucius_use_underline = 1 |
|
|
|
|
|
|
|
"colorscheme desert |
|
"colorscheme atom-dark |
|
set t_Co=256 |
|
set linespace=15 |
|
|
|
set guioptions-=l |
|
set guioptions-=L |
|
set guioptions-=r |
|
set guioptions-=R |
|
|
|
highlight LineNr ctermfg=darkgray ctermbg=bg |
|
|
|
"fake left padding |
|
set foldcolumn=0 |
|
highlight foldcolumn ctermbg=bg |
|
"style for all splits |
|
highlight vertsplit ctermfg=darkgray ctermbg=bg |
|
|
|
|
|
|
|
|
|
"----------------Serch----------- |
|
set hlsearch |
|
set incsearch |
|
|
|
|
|
|
|
|
|
|
|
"----------------Split Management----------- |
|
set splitbelow |
|
set splitright |
|
map <C-J> <C-W><C-J> |
|
map <C-K> <C-W><C-K> |
|
map <C-H> <C-W><C-H> |
|
map <C-L> <C-W><C-L> |
|
|
|
|
|
|
|
|
|
|
|
"----------------Mapings----------- |
|
|
|
"Make it easy to edit the Vimrc file. |
|
nmap <Leader>ev :tabedit ~/.vimrc<cr> |
|
|
|
"Quick access snippets folder |
|
nmap <Leader>es :e ~/.vim/snippets/ |
|
"Reload All Snippets |
|
nmap <Leader>rs :call ReloadAllSnippets()<cr> |
|
|
|
|
|
"Add simple highlight removal. |
|
nmap <Leader><space> :nohlsearch<cr> |
|
|
|
nmap <Leader>f :tag<space> |
|
|
|
|
|
|
|
|
|
|
|
"----------------Plugins----- |
|
"/ |
|
"/ CtrlP |
|
"/ |
|
|
|
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|idea\|git' |
|
nmap <C-R> :CtrlPBufTag<cr> |
|
|
|
nmap <C-E> :CtrlPMRUFiles<cr> |
|
let g:ctrlp_match_window = 'top,order:ttb,min:1,max:30,results:30' |
|
|
|
nmap <C-R> :CtrlPBufTag<cr> |
|
|
|
nmap <C-E> :CtrlPMRUFiles<cr> |
|
|
|
"/ |
|
"/ NERDTree |
|
"/ |
|
|
|
let NERDTreeHijackNetrw = 0 |
|
|
|
"Make NERDTree easier to toggle. |
|
nmap <tab><tab> :NERDTreeToggle<cr> |
|
|
|
"/ |
|
"/ Greplace.vim |
|
"/ |
|
"We want to use ag for the search |
|
set grepprg=ag |
|
|
|
let g:grep_cmd_opts = '--line-numbers --noheading' |
|
|
|
|
|
|
|
"/ |
|
"/ vim-php-cs-fixer.vim |
|
"/ |
|
let g:php_cs_fixer_level = "psr2" |
|
"nnoremap <silent><leader>pcd :call PhpCsFixerFixDirectory()<CR> |
|
nnoremap <silent><leader>pf :call PhpCsFixerFixFile()<CR> |
|
|
|
"----------------Auto-Commands----- |
|
|
|
"Automatically 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>:callIPhpExpandClass()<CR> |
|
autocmd FileType php noremap <Leader>nf :call PhpExpandClass()<CR> |
|
|
|
|
|
|
|
"Sort PHP use statements |
|
"http://stackoverflow.com/questions/11531073/how-do-you-sort-a-range-of-lines-by-length |
|
vmap <Leader>su ! awk '{ print length(), $0 \| "sort -n \| cut -d\\ -f2-"}'<cr> |
|
|
|
|
|
|
|
|
|
" Notes and Tips |
|
" - ',ev' to open .vimrc configuration file |
|
" - '/' to search, ',space' to remove highlights |
|
" - ',f<searchword>' to search in tags |
|
" - ':tn' to next tag |
|
" - ':tp' to previos tag |
|
" - ':ts' to to view all tags |
|
" - Press 'zz' to instanly center the linewhere the cursor is located. |
|
" - 'gg' go to the top |
|
" - 'G' go to the bottom |
|
" - '^]' to go to original method, '^6' to go back |
|
" - '<tab><tab>' to open fs tree |
|
" - '^P' to serch a file |
|
" - '^e' to see latest opened files list |
|
" - '^v' to select symbols, '^V' to select lines |
|
" - 'ggVG' select all code lines or alternatively 'GVgg' |
|
" - 'd' cut and don't exit from normal mode, |
|
" - 'c' cut and enter insert mode |
|
" - 'y' yank or copy |
|
" - 'cc' delete curent line |
|
" - 'dd' to cut current line |
|
" - 'yy' to copy curent line |
|
" - 'p' to paste |
|
" - behaviour depends on first typed letter 'd' or 'c' or 'y' or 'v' |
|
" - 'di'' to cut between ' |
|
" - 'da'' to cut detween ' including ' |
|
" - 'di)' to cut between () |
|
" - 'da)' to cut between () including () |
|
" - 'diB' to cut between curly brackets {} |
|
" - 'daB' to cut between curly brackets {} including {} |
|
" - 'di[' to cut between square brackets [] |
|
" - 'da[' to cut between square brackets [] including [] |
|
" - in visual mode using the same tecknique we can insert things and a |
|
" numeral is used to select leveles (g(oo)d) cursor after first o '2i)' will |
|
" select everething inside second bracket level (<-->) 'v2i)' |
|
" - t is for tag |
|
" - 'p' to paste |
|
" - ':vs' vertical split |
|
" - ':sp' horizontal split |
|
" - // tpope/vim-surround plugin |
|
" - change suround ' \" cs'" - will chane ' with " |
|
" - delete suround ' ds' - will delete singleqwote |
|
" - delete suround tag 'dst' - will delete surounding html tag |
|
" - change the surounding tag 'cst' then type new tag name |
|
" - wrap in tag: insert text to wrap then press S then type the tag name |
|
" - ',n' to add the namespace of the class, ',nf' to add namespace of class inline. |
|
" Dont forget to update ctags file |
|
" - sort namespacer alphabeticaly. Selecct lines taht you want to sort then |
|
" type :'<,'>sort |
|
" - ',su' to sort by string lenght. |
|
" - 'J' join the lines |