Skip to content

Instantly share code, notes, and snippets.

@phcostabh
Created December 26, 2013 12:59
Show Gist options
  • Select an option

  • Save phcostabh/8133557 to your computer and use it in GitHub Desktop.

Select an option

Save phcostabh/8133557 to your computer and use it in GitHub Desktop.
" UI Configuration {
colorscheme jellybeans
set guifont=Liberation\ Mono\ 09
set linespace=1
set nospell
set t_Co=256
nnoremap ; :
set nofoldenable
set showmatch
set nohidden
highlight clear SignColumn " SignColumn should match background
highlight clear LineNr " Current line number row will have same background color in relative mode
" highlight clear CursorLineNr " Remove highlight color from current line number
set backup
set swapfile
highlight normal ctermbg=none
highlight nontext ctermbg=none
function! EnsureDirExists(dir)
if !isdirectory(a:dir)
if exists("*mkdir")
call mkdir(a:dir,'p')
echo "Created directory: " . a:dir
else
echo "Please create directory: " . a:dir
endif
endif
endfunction
call EnsureDirExists($HOME . '/.vim_backup')
set backupdir=~/.vim_backup
set directory=~/.vim_backup
set undodir=~/.vim_backup
if has('persistent_undo')
set undofile
set undolevels=1000
set undoreload=10000
endif
" }
" vim-php-cs-fixer configuration {
autocmd FileType php noremap <buffer> <c-f> :call PhpCsFixerFixFile()<cr>
" }
" Gist vim configurations {
let g:gist_clip_command = 'xclip -selection clipboard'
" }
" js-beautify {
map <Leader>r :!js-beautify -r "%"<CR>:update<CR>
" }
" Integrating with powerline fonts {
let g:airline_powerline_fonts = 1
" }
" Disable auto PHPFolding {
let g:DisableAutoPHPFolding = 1
" }
" Custom syntaxe highlighting. {
au BufRead,BufNewFile *.volt setfiletype htmljinja
" }
" Striping whitespaces {
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
autocmd BufWritePre *.* :call <SID>StripTrailingWhitespaces()
" }
" Remapping tab navigation {
nmap <S-h> :tabprevious <CR>
nmap <S-l> :tabnext <CR>
" }
" Surrounding mappings. {
:nnoremap <leader>" ciw""<esc>hp<esc>el
:nnoremap <leader>' ciw''<esc>hp<esc>el
:nnoremap <leader>( ciw()<esc>hp<esc>el
:nnoremap <leader>[ ciw[]<esc>hp<esc>el
:nnoremap <leader>{ ciw{}<esc>hp<esc>el
vmap <silent> <Leader>' :call Quote("'")<CR>
vmap <silent> <Leader>" :call Quote('"')<CR>
function! Quote(quote)
let save = @"
silent normal gvy
let @" = a:quote . @" . a:quote
silent normal gvp
let @" = save
endfunction
" }
" Tabularize {
nmap <Leader>a& :Tabularize /&<CR>
vmap <Leader>a& :Tabularize /&<CR>
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:<CR>
vmap <Leader>a: :Tabularize /:<CR>
nmap <Leader>a:: :Tabularize /:\zs<CR>
vmap <Leader>a:: :Tabularize /:\zs<CR>
nmap <Leader>a, :Tabularize /,<CR>
vmap <Leader>a, :Tabularize /,<CR>
nmap <Leader>a,, :Tabularize /,\zs<CR>
vmap <Leader>a,, :Tabularize /,\zs<CR>
nmap <Leader>a<Bar> :Tabularize /<Bar><CR>
vmap <Leader>a<Bar> :Tabularize /<Bar><CR>
" }
" CtrlP {
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|vendor\|static',
\ }
nnoremap <C-k> :CtrlPBufTag<CR>
"let g:ctrlp_buftag_types = {
"\ 'php': '--PHP-kinds=+f-vc --regex-PHP="/(public\s+|static\s+|abstract\s+|protected\s+|private\s+)function\s+\&?\s*([^ (]+)/\2/f/"'
"\}
" }
" Testing some config {
set showcmd
set whichwrap+=<,>,h,l,[,]
" }
" Find merge conflict markers {
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
" }
" Fugitive {
nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
nnoremap <silent> <leader>ge :Gedit<CR>
nnoremap <silent> <leader>gg :SignifyToggle<CR>
"}
" ToggleNumbering {
function! ToggleNumbering()
if &relativenumber
set number
set norelativenumber
else
set relativenumber
set nonumber
endif
endfunc
noremap <leader>n :call ToggleNumbering()<cr>
" }
" UnBundle {
function! UnBundle(arg, ...)
let bundle = vundle#config#init_bundle(a:arg, a:000)
call filter(g:bundles, 'v:val["name_spec"] != "' . a:arg . '"')
endfunction
com! -nargs=+ UnBundle
\ call UnBundle(<args>)
" }
" Remove Bundles {
UnBundle 'daylerees/colour-schemes'
" }
" Twig {
autocmd BufNewFile,BufRead *.html set filetype=html.twig
" }
" fullscreen mode for GVIM and Terminal, need 'wmctrl' in you PATH {
map <silent> <F11> :call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")<CR>
" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment