Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. set nocompatible " Latest Vim setting
  2. so ~/.vim/plugins.vim
  3. syntax enable
  4. set backspace=indent,eol,start " Make backspace behave like in any other editor
  5. let mapleader=',' " Set the default leader
  6. set foldcolumn=2
  7. set autowriteall " Write when switching buffers
  8.  
  9. "---------- Visuals ----------"
  10. set background=dark " Set the background to be dark
  11. colorscheme hybrid_material " Set the color scheme
  12. set expandtab " Tab settins (4 spaces)
  13. set shiftwidth=4 " -
  14. set tabstop=4
  15. set softtabstop=4 " -
  16. set cindent
  17. set smartindent
  18. nmap <Leader>p :set paste<cr>
  19. nmap <Leader>np :set nopaste<cr>
  20.  
  21. set t_CO=256 " Force 256 colors for the terminal Vim
  22.  
  23. "---------- Searching ----------"
  24. set hlsearch
  25. set incsearch
  26.  
  27. "---------- Mappings ----------"
  28.  
  29. " Edit the vimrc file.
  30. nmap <Leader>ev :edit $MYVIMRC<cr>
  31.  
  32. " Remove highlighting after search.
  33. nmap <Leader><space> :nohlsearch<cr>
  34.  
  35. " Split manipulation
  36. set splitbelow
  37. set splitright
  38.  
  39. nmap <C-J> <C-W><C-J>
  40. nmap <C-K> <C-W><C-K>
  41. nmap <C-L> <C-W><C-L>
  42. nmap <C-H> <C-W><C-H>
  43.  
  44. " Ctrl+p
  45. nmap <Leader>r :CtrlPBufTag<cr>
  46.  
  47. " Tags
  48. nmap <Leader>ct :!ctags<cr>
  49. nmap <C-T> :tag
  50.  
  51. " Emmet
  52. imap <C-E> <C-Y>,
  53.  
  54. " Sort php uses
  55. vmap <leader>su ! awk '{print length(), $0 \| "sort -n \| cut -d \" \" -f2-" }'<cr>
  56.  
  57. " Compilers
  58. nmap <Leader>cc :!clear && gcc % -lm -lcurl -o temp && ./temp<cr>
  59. nmap <Leader>cr :!clear && racket %<cr>
  60. nmap <Leader>cj :!clear && javac % && java %i:r.class<cr>
  61. nmap <Leader>ca :!clear && nasm -felf64 hello.asm && ld %:r.o && ./a.out<cr>
  62.  
  63. " Moving lines
  64. nnoremap <C-k> :m .-2<CR>==
  65. nnoremap <C-j> :m .+1<CR>==
  66. inoremap <C-j> <Esc>:m .+1<CR>==gi
  67. inoremap <C-k> <Esc>:m .-2<CR>==gi
  68. vnoremap <C-j> :m '>+1<CR>gv=gv
  69. vnoremap <C-k> :m '<-2<CR>gv=gv
  70.  
  71. " Helpers
  72. imap jj <Esc>
  73.  
  74. "---------- Plugins ----------"
  75.  
  76. "/
  77. "/ Control P
  78. "/
  79. let g:ctrlp_custom_ignore = 'node_modules\|git'
  80. let g:ctrlp_match_window = 'top,order:ttb,min:1,max:30,results:30'
  81.  
  82. "/
  83. "/ PSR-2
  84. "/
  85. let g:php_cs_fixer_level = 'psr2'
  86. nnoremap <leader>psr :call PhpCsFixerFixFile()<CR><CR>
  87.  
  88. "/
  89. "/ pdv
  90. "/
  91. let g:pdv_template_dir = $HOME ."/.vim/bundle/pdv/templates_snip"
  92. nnoremap <Leader>d :call pdv#DocumentWithSnip()<CR>
  93.  
  94. "/
  95. "/ ultisnips
  96. "/
  97. let g:UltiSnipsExpandTrigger="<Tab>"
  98. let g:UltiSnipsJumpForwardTrigger="<Tab>"
  99. let g:UltiSnipsJumpBackwardTrigger="<s-Tag>"
  100. let g:UltiSnipsSnippetDirectories=['~/.vim/snippets']
  101.  
  102. "---------- Macros ----------"
  103.  
  104. "/
  105. "/ PHP
  106. "/
  107. let @c="yiw/}
  108. O$this->pA = $pA;?function __construct
  109. Oprotected $pA;
  110. /€kb/o€kbconstruct
  111. /;\"
  112. e, "
  113.  
  114. "/
  115. "/ Macros among lines
  116. "/
  117. xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
  118.  
  119. function! ExecuteMacroOverVisualRange()
  120. echo "@".getcmdline()
  121. execute ":'<,'>normal @".nr2char(getchar())
  122. endfunction
  123.  
  124. "---------- Auto-commands ----------"
  125.  
  126. " Automatically source the Vimrc file on save.
  127. augroup autosourcing
  128. autocmd!
  129. autocmd BufWritePost .vimrc source %
  130. augroup END
  131.  
  132. " Php syntax
  133. function! PhpSyntaxOverride()
  134. hi! def link phpDocTags phpDefine
  135. hi! def link phpDocParam phpType
  136. endfunction
  137.  
  138. augroup phpSyntaxOverride
  139. autocmd!
  140. autocmd FileType php call PhpSyntaxOverride()
  141. augroup END
  142.  
  143. " Insert use
  144. function! IPhpInsertUse()
  145. call PhpInsertUse()
  146. call feedkeys('a', 'n')
  147. endfunction
  148. autocmd FileType php inoremap <Leader>u <Esc>:call IPhpInsertUse()<CR>
  149. autocmd FileType php noremap <Leader>u :call PhpInsertUse()<CR>
  150.  
  151. " Namespace expansion
  152. function! IPhpExpandClass()
  153. call PhpExpandClass()
  154. call feedkeys('a', 'n')
  155. endfunction
  156. autocmd FileType php inoremap <Leader>n <Esc>:call IPhpExpandClass()<CR>
  157. autocmd FileType php noremap <Leader>n :call PhpExpandClass()<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement