Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set nocompatible " Latest Vim setting
- so ~/.vim/plugins.vim
- syntax enable
- set backspace=indent,eol,start " Make backspace behave like in any other editor
- let mapleader=',' " Set the default leader
- set foldcolumn=2
- set autowriteall " Write when switching buffers
- "---------- Visuals ----------"
- set background=dark " Set the background to be dark
- colorscheme hybrid_material " Set the color scheme
- set expandtab " Tab settins (4 spaces)
- set shiftwidth=4 " -
- set tabstop=4
- set softtabstop=4 " -
- set cindent
- set smartindent
- nmap <Leader>p :set paste<cr>
- nmap <Leader>np :set nopaste<cr>
- set t_CO=256 " Force 256 colors for the terminal Vim
- "---------- Searching ----------"
- set hlsearch
- set incsearch
- "---------- Mappings ----------"
- " Edit the vimrc file.
- nmap <Leader>ev :edit $MYVIMRC<cr>
- " Remove highlighting after search.
- nmap <Leader><space> :nohlsearch<cr>
- " Split manipulation
- set splitbelow
- set splitright
- nmap <C-J> <C-W><C-J>
- nmap <C-K> <C-W><C-K>
- nmap <C-L> <C-W><C-L>
- nmap <C-H> <C-W><C-H>
- " Ctrl+p
- nmap <Leader>r :CtrlPBufTag<cr>
- " Tags
- nmap <Leader>ct :!ctags<cr>
- nmap <C-T> :tag
- " Emmet
- imap <C-E> <C-Y>,
- " Sort php uses
- vmap <leader>su ! awk '{print length(), $0 \| "sort -n \| cut -d \" \" -f2-" }'<cr>
- " Compilers
- nmap <Leader>cc :!clear && gcc % -lm -lcurl -o temp && ./temp<cr>
- nmap <Leader>cr :!clear && racket %<cr>
- nmap <Leader>cj :!clear && javac % && java %i:r.class<cr>
- nmap <Leader>ca :!clear && nasm -felf64 hello.asm && ld %:r.o && ./a.out<cr>
- " Moving lines
- nnoremap <C-k> :m .-2<CR>==
- nnoremap <C-j> :m .+1<CR>==
- inoremap <C-j> <Esc>:m .+1<CR>==gi
- inoremap <C-k> <Esc>:m .-2<CR>==gi
- vnoremap <C-j> :m '>+1<CR>gv=gv
- vnoremap <C-k> :m '<-2<CR>gv=gv
- " Helpers
- imap jj <Esc>
- "---------- Plugins ----------"
- "/
- "/ Control P
- "/
- let g:ctrlp_custom_ignore = 'node_modules\|git'
- let g:ctrlp_match_window = 'top,order:ttb,min:1,max:30,results:30'
- "/
- "/ PSR-2
- "/
- let g:php_cs_fixer_level = 'psr2'
- nnoremap <leader>psr :call PhpCsFixerFixFile()<CR><CR>
- "/
- "/ pdv
- "/
- let g:pdv_template_dir = $HOME ."/.vim/bundle/pdv/templates_snip"
- nnoremap <Leader>d :call pdv#DocumentWithSnip()<CR>
- "/
- "/ ultisnips
- "/
- let g:UltiSnipsExpandTrigger="<Tab>"
- let g:UltiSnipsJumpForwardTrigger="<Tab>"
- let g:UltiSnipsJumpBackwardTrigger="<s-Tag>"
- let g:UltiSnipsSnippetDirectories=['~/.vim/snippets']
- "---------- Macros ----------"
- "/
- "/ PHP
- "/
- let @c="yiw/}
- O$this->pA = $pA;?function __construct
- Oprotected $pA;
- /€kb/o€kbconstruct
- /;\"
- e, "
- "/
- "/ Macros among lines
- "/
- xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
- function! ExecuteMacroOverVisualRange()
- echo "@".getcmdline()
- execute ":'<,'>normal @".nr2char(getchar())
- endfunction
- "---------- Auto-commands ----------"
- " Automatically source the Vimrc file on save.
- augroup autosourcing
- autocmd!
- autocmd BufWritePost .vimrc source %
- augroup END
- " Php syntax
- function! PhpSyntaxOverride()
- hi! def link phpDocTags phpDefine
- hi! def link phpDocParam phpType
- endfunction
- augroup phpSyntaxOverride
- autocmd!
- autocmd FileType php call PhpSyntaxOverride()
- augroup END
- " Insert use
- 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>
- " Namespace expansion
- function! IPhpExpandClass()
- call PhpExpandClass()
- call feedkeys('a', 'n')
- endfunction
- autocmd FileType php inoremap <Leader>n <Esc>:call IPhpExpandClass()<CR>
- autocmd FileType php noremap <Leader>n :call PhpExpandClass()<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement