Skip to content

Instantly share code, notes, and snippets.

@vcostin
Last active March 22, 2016 23:28
Show Gist options
  • Save vcostin/a3db975772eac8c3a9ad to your computer and use it in GitHub Desktop.
Save vcostin/a3db975772eac8c3a9ad to your computer and use it in GitHub Desktop.
vim conficuration
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

Initialization Ubuntu based system

installation

install Powerline-patched font

git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh

install oh-my-zsh

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

change ZSH_THEME="robbyrussell" to ZSH_THEME="agnoster"

tweak terminal

I prefer white or slightly grey tone of background. Also color of character a dark gray tone and for bold text a little darker


vim configuration

hope will work

create mkdir .vim folder in your home directory if it doesn't exist, cd .vim then wget -O ~/.vim/plugins.vim https://gist.githubusercontent.com/vcostin/a3db975772eac8c3a9ad/raw/1f32177d9ffa7645d1c715fcb1c5c59d9fa45961/.vimFolderPlugins.vim Create mkdir colors directory cd colors then wget https://raw.githubusercontent.com/jonathanfilip/vim-lucius/master/colors/lucius.vim. Install Vundle plugin git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim start vim, shouldn't see any errors, then :PluginInstall inside vim shell

filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-vinegar'
Plugin 'scrooloose/nerdtree'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'rking/ag.vim'
Plugin 'skwp/greplace.vim'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'tpope/vim-surround'
Plugin 'StanAngeloff/php.vim'
Plugin 'arnaud-lb/vim-php-namespace'
Plugin 'ervandew/supertab'
Plugin 'stephpy/vim-php-cs-fixer'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment