My vim configuration (~/.vimrc, ~/.vim).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vimrc 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. set nocompatible
  2. filetype off
  3. runtime! debian.vim
  4. if filereadable("/etc/vim/vimrc.local")
  5. source /etc/vim/vimrc.local
  6. endif
  7. """""""""""""""""""""""""""
  8. " PLUGINS
  9. """""""""""""""""""""""""""
  10. let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
  11. set rtp+=~/.vim/bundle/Vundle.vim
  12. call vundle#begin()
  13. Plugin 'VundleVim/Vundle.vim'
  14. Plugin 'mileszs/ack.vim.git'
  15. Plugin 'Shougo/neocomplete.vim'
  16. Plugin 'tobyS/pdv.git'
  17. Plugin 'scrooloose/syntastic.git'
  18. Plugin 'majutsushi/tagbar'
  19. Plugin 'leafgarland/typescript-vim.git'
  20. Plugin 'SirVer/ultisnips.git'
  21. Plugin 'taglist.vim'
  22. Plugin 'bling/vim-airline.git'
  23. Plugin 'kchmck/vim-coffee-script.git'
  24. Plugin 'sheerun/vim-polyglot'
  25. Plugin 'honza/vim-snippets.git'
  26. Plugin 'tobyS/vmustache.git'
  27. Plugin 'sjl/gundo.vim.git'
  28. Plugin 'godlygeek/tabular.git'
  29. Plugin 'tpope/vim-fugitive.git'
  30. Plugin 'groenewege/vim-less.git'
  31. Plugin 'arnaud-lb/vim-php-namespace.git'
  32. Plugin 'tpope/vim-surround.git'
  33. Plugin 'scrooloose/nerdtree'
  34. Plugin 'nerdtree-ack'
  35. Plugin 'php-cs-fixer'
  36. Plugin 'php-doc-upgrade'
  37. Plugin 'php.vim'
  38. Plugin 'closetag.vim'
  39. Plugin 'vim-scripts/Emmet.vim'
  40. Plugin 'beyondwords/vim-twig'
  41. Plugin 'ctrlpvim/ctrlp.vim'
  42. Plugin 'Xuyuanp/nerdtree-git-plugin'
  43. Plugin 'jistr/vim-nerdtree-tabs'
  44. Plugin 'raimondi/delimitmate'
  45. Plugin 'dietsche/vim-lastplace.git'
  46. Plugin 'tomtom/tcomment_vim'
  47. Plugin 'ahri/vim-sesspit'
  48. Plugin 'voronkovich/ctrlp-symfony2.vim'
  49. Plugin 'Colorizer--Brabandt'
  50. Plugin 'gregsexton/gitv'
  51. Plugin 'markgandolfo/nerdtree-fetch.vim'
  52. Plugin 'evandotpro/nerdtree-chmod'
  53. Plugin 'shawncplus/phpcomplete.vim'
  54. Plugin 'bronson/vim-trailing-whitespace'
  55. Plugin 'jacoborus/tender'
  56. " Plugin 'vexxor/phpdoc.vim'
  57. Plugin 'Rican7/php-doc-modded'
  58. Plugin 'mzlogin/vim-markdown-toc'
  59. Plugin 'rosenfeld/conque-term'
  60. " Plugin 'joonty/vdebug'
  61. Plugin 'isRuslan/vim-es6'
  62. Plugin 'suan/vim-instant-markdown'
  63. Plugin 'dracula/vim'
  64. Plugin 'sniphpets/sniphpets-doctrine'
  65. Plugin 'sniphpets/sniphpets'
  66. Plugin 'jaxbot/semantic-highlight.vim'
  67. Plugin 'thaerkh/vim-indentguides'
  68. Plugin 'PotatoesMaster/i3-vim-syntax'
  69. Plugin 'fatih/vim-go'
  70. Plugin 'mhinz/vim-signify'
  71. Plugin 'andrewradev/splitjoin.vim'
  72. Plugin 'wahidrahim/resize-font'
  73. Plugin 'skywind3000/asyncrun.vim'
  74. Plugin 'valloric/listtoggle'
  75. Plugin 'c9s/phpunit.vim'
  76. Plugin 'terryma/vim-multiple-cursors'
  77. Plugin 'dkarter/bullets.vim'
  78. Plugin 'connorholyday/vim-snazzy'
  79. call vundle#end()
  80. """""""""""""""""""""""""""
  81. " THEME
  82. """""""""""""""""""""""""""
  83. syntax on
  84. if has('gui_running')
  85. " colorscheme tender
  86. " colorscheme dracula
  87. colorscheme snazzy
  88. else
  89. colorscheme Tomorrow-Night-Bright
  90. endif
  91. set background=dark
  92. if has("autocmd")
  93. filetype plugin on
  94. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  95. endif
  96. set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)
  97. set completeopt-=preview
  98. """""""""""""""""""""""""""
  99. " PLUGINS CONFIGURATION
  100. """""""""""""""""""""""""""
  101. " SEMANTIC "
  102. """"""""""""
  103. if has('gui_running')
  104. let g:semanticEnableFileTypes = { 'javascript': 'js', 'vim': 'vim', 'php': 'php'}
  105. endif
  106. " PHP-CS-FIXER "
  107. """"""""""""""""
  108. let g:php_cs_fixer_level = 'symfony'
  109. " NERDTREE-GIT "
  110. """"""""""""""""
  111. let g:NERDTreeIndicatorMapCustom = {
  112. \ 'Modified' : 'M',
  113. \ 'Staged' : 'S',
  114. \ 'Untracked' : '?',
  115. \ 'Renamed' : 'R',
  116. \ 'Unmerged' : 'U',
  117. \ 'Deleted' : '!',
  118. \ 'Dirty' : 'D',
  119. \ 'Clean' : 'C',
  120. \ 'Unknown' : '?!'
  121. \ }
  122. " Markdown preview "
  123. """"""""""""""""""""
  124. let g:vim_markdown_auto_insert_bullets = 1
  125. let g:vim_markdown_follow_anchor = 1
  126. let g:vim_markdown_autowrite = 0
  127. let g:vim_markdown_conceal = 0
  128. let g:instant_markdown_autostart = 0
  129. " COLORIZER "
  130. """""""""""""
  131. let g:colorizer_auto_color = 1
  132. " SNIPS "
  133. """""""""
  134. let g:snips_author = "Simon Vieille <simon@deblan.fr>"
  135. let g:snips_email = "simon@deblan.fr"
  136. let g:snips_github = "https://gitnet.fr/deblan"
  137. let g:UltiSnipsExpandTrigger="<tab>"
  138. let g:UltiSnipsJumpForwardTrigger="<c-b>"
  139. let g:UltiSnipsJumpBackwardTrigger="<c-z>"
  140. let g:UltiSnipsEditSplit="vertical"
  141. " AIRLINE "
  142. """""""""""
  143. let g:airline_powerline_fonts = 1
  144. if !exists('g:airline_symbols')
  145. let g:airline_symbols = {}
  146. endif
  147. " unicode symbols
  148. let g:airline_left_sep = '»'
  149. let g:airline_left_sep = '▶'
  150. let g:airline_right_sep = '«'
  151. let g:airline_right_sep = '◀'
  152. let g:airline_symbols.linenr = '␊'
  153. let g:airline_symbols.linenr = '␤'
  154. let g:airline_symbols.linenr = '¶'
  155. let g:airline_symbols.branch = '⎇'
  156. let g:airline_symbols.paste = 'ρ'
  157. let g:airline_symbols.paste = 'Þ'
  158. let g:airline_symbols.paste = '∥'
  159. let g:airline_symbols.whitespace = 'Ξ'
  160. let g:airline_theme = 'tender'
  161. " airline symbols
  162. if has('gui_running')
  163. let g:airline_left_sep = ''
  164. let g:airline_left_alt_sep = ''
  165. let g:airline_right_sep = ''
  166. let g:airline_right_alt_sep = ''
  167. let g:airline_symbols.branch = ''
  168. let g:airline_symbols.readonly = ''
  169. let g:airline_symbols.linenr = ''
  170. endif
  171. " CLOSETAG "
  172. """"""""""""
  173. au Filetype html,xml,xsl,php,jsp,jspf,twig source ~/.vim/bundle/closetag.vim/plugin/closetag.vim
  174. " NERDTree "
  175. """"""""""""
  176. let g:nerdtree_tabs_open_on_gui_startup = 2
  177. let g:nerdtree_tabs_open_on_console_startup = 2
  178. let g:nerdtree_tabs_autoclose = 0
  179. let NERDTreeCascadeSingleChildDir = 0
  180. let NERDTreeCascadeOpenSingleChildDir = 1
  181. " CTRLP Symfony "
  182. """""""""""""""""
  183. command! Sfassets CtrlPSymfony2Assets
  184. command! Sfconfigs CtrlPSymfony2Configs
  185. command! Sfcontrollers CtrlPSymfony2Controllers
  186. command! Sfmodels CtrlPSymfony2Entities
  187. command! Sfentities CtrlPSymfony2Entities
  188. command! Sfviews CtrlPSymfony2Views
  189. command! Sfservices CtrlPSymfonyServices
  190. command! Sfservicesdefinition CtrlPSymfonyServiceDefinition
  191. command! Sfforms CtrlPSymfonyForms
  192. " PHP-CS-FIXER "
  193. """"""""""""""""
  194. let g:php_cs_fixer_php_path = "/usr/bin/php7.1"
  195. " CTAGS "
  196. """""""""
  197. command! CT AsyncRun ctags **/*.php
  198. " EMMET "
  199. """""""""
  200. let g:user_emmet_expandabbr_key = '<c-e>'
  201. let g:use_emmet_complete_tag = 1
  202. let g:user_emmet_settings = {
  203. \ 'indentation' : ' ',
  204. \ 'php' : {
  205. \ 'extends': 'html',
  206. \ 'aliases' : {
  207. \ },
  208. \ 'snippets' : {
  209. \ 'php': "<?php\n\t|\n?>",
  210. \ 'sf:exe' : "public function |Action()\n{\n\n}",
  211. \ 'pf' : "public function |()\n{\n\n}",
  212. \ 'ppf' : "protected function |()\n{\n\n}",
  213. \ 'pppf' : "private function |()\n{\n\n}",
  214. \ 'sf:pdo': "\\$con = Propel::getConnection();\n\\$stmt = \\$con->prepare('|');\n\\$stmt->bindValue();\n\\$stmt->execute();\n\\$results = \\$stmt->fetchAll();",
  215. \ 'b:add': "\\$builder->add(\n '|',\n 'text',\n [\n 'label' => '',\n 'required' => true,\n 'attr' => [\n ],\n 'constraints' => [\n ],\n ]\n);",
  216. \ 'b:addfile': "\\$builder->add(\n \\$builder->create(\n '|',\n 'file',\n [\n 'label' => '',\n 'attr' => [\n ],\n 'constraints' => [\n ],\n ]\n )->addModelTransformer(new \\Trinity\\Component\\Form\\DataTransformer\\StringToFileTransformer(\\$builder->getData(), 'file'))\n);\n\n\\$builder->addEventSubscriber(\n new \\Trinity\\Component\\Form\\EventListener\\FileDeleteFormListener(\n \\$builder->getFormFactory(),\n [\n '|',\n ]\n )\n);",
  217. \ 'foreach': "foreach (\\$| as \\$k => \\$v) {\n\t\n}",
  218. \ 'vard': "echo '<pre>', var_dump(|), '</pre>';\n",
  219. \ 'vardd': "echo '<pre>', var_dump(|), '</pre>';\ndie;\n",
  220. \ 'class': "class | {\n\tpublic function __construct() {\n\t\n\t}\n}\n",
  221. \ 'cc': "/**\n * @var type\n */\n",
  222. \ 'if': "if (|) {\n\n}",
  223. \ 'for': "for ($u = 0; $u < |; $u++) {\n\t\n}",
  224. \ 'while': "while (|) {\n\n}",
  225. \ }
  226. \ },
  227. \ 'javascript' : {
  228. \ 'aliases' : {
  229. \ },
  230. \ 'snippets' : {
  231. \ 'ready': "$(document).ready(function() {\n\t|\n});",
  232. \ 'closure': "(function($) {\n\t|\n})(jQuery);",
  233. \ 'load': "$(|).load('', function(datas) {});",
  234. \ 'if': "if (|) {\n\n}",
  235. \ 'for': "for (var u=0; u<|; u++) {\n\t\n}",
  236. \ 'while': "while (|) {\n\n}",
  237. \ }
  238. \ },
  239. \ 'xml' : {
  240. \ 'aliases' : {
  241. \ },
  242. \ 'snippets' : {
  243. \ 'table': "<table name=\"\" phpName=\"\">\n\t\n</table>",
  244. \ 'column': "<column name=\"\" type=\"integer\" size=\"\" required=\"true\" />\n",
  245. \ 'fkey': "<foreign-key onUpdate=\"none\" foreignTable=\"\" onDelete=\"cascade\">\n\t\n</foreign-key>\n",
  246. \ 'reference': "<reference local=\"\" foreign=\"\"/>\n"
  247. \ }
  248. \ },
  249. \ 'twig' : {
  250. \ 'extends': 'html',
  251. \ 'aliases' : {
  252. \ },
  253. \ 'snippets' : {
  254. \ 'if': "{% if | %}\n\n{% endif %}\n",
  255. \ 'else': "{% else %}\n",
  256. \ 'elseif': "{% elseif %}\n",
  257. \ 'twig': "{% | %}\n",
  258. \ 'include': "{% include \"|\" %}\n",
  259. \ 'render': "{% render \"|\" %}\n",
  260. \ 'vard': "<pre>{{ dump(|) }}</pre>\n",
  261. \ 'vardd': "<pre>{{ dump(|) }}</pre>\n",
  262. \ 'debug': "<pre>{{ dump(|) }}</pre>\n",
  263. \ 'dump': "<pre>{{ dump(|) }}</pre>\n",
  264. \ 'for': "{% for key, value in | %}\n\n{% endfor %}\n"
  265. \ }
  266. \ }
  267. \}
  268. " GITGUTTER "
  269. """""""""""""
  270. let g:gitgutter_max_signs = 1000
  271. " CTAGS "
  272. """""""""
  273. let Tlist_Process_File_Always = 1
  274. let Tlist_Ctags_Cmd='/usr/bin/ctags'
  275. " NEOCOMPLETE "
  276. """""""""""""""
  277. function! s:my_cr_function()
  278. return neocomplete#close_popup() . "\<CR>"
  279. "return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
  280. "inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
  281. "" \ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
  282. endfunction
  283. if !exists('g:neocomplete#keyword_patterns')
  284. let g:neocomplete#keyword_patterns = {}
  285. endif
  286. if !exists('g:neocomplete#force_omni_input_patterns')
  287. let g:neocomplete#force_omni_input_patterns = {}
  288. endif
  289. let g:acp_enableAtStartup = 0
  290. let g:neocomplete#enable_at_startup = 1
  291. let g:neocomplete#enable_smart_case = 1
  292. let g:neocomplete#sources#syntax#min_keyword_length = 3
  293. let g:neocomplete#force_omni_input_patterns.php = '\h\w*\|[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?'
  294. "let g:neocomplete#force_omni_input_patterns.php = '\h\w*\|[^- \t]->\w*'
  295. let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
  296. let g:neocomplete#sources#dictionary#dictionaries = {
  297. \ 'default' : '',
  298. \ 'vimshell' : $HOME.'/.vimshell_hist',
  299. \ 'scheme' : $HOME.'/.gosh_completions'
  300. \ }
  301. let g:neocomplete#disable_auto_complete = 1
  302. let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  303. inoremap <expr><C-g> neocomplete#undo_completion()
  304. inoremap <expr><C-l> neocomplete#complete_common_string()
  305. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
  306. inoremap <expr><TAB>
  307. \ pumvisible() ? "\<C-n>" :
  308. \ neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" :
  309. \ "\<TAB>"
  310. inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
  311. inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
  312. " PDV (DOC) "
  313. """""""""""""
  314. function! PhpSyntaxOverride()
  315. hi! def link phpDocTags phpDefine
  316. hi! def link phpDocParam phpType
  317. endfunction
  318. augroup phpSyntaxOverride
  319. autocmd!
  320. autocmd FileType php call PhpSyntaxOverride()
  321. augroup END
  322. let g:pdv_template_dir = $HOME."/.vim/bundle/pdv/templates_snip/"
  323. " Vdebug "
  324. """"""""""
  325. let g:vdebug_options = {}
  326. let g:vdebug_options['port'] = 9000
  327. " PHPDOC "
  328. """"""""""
  329. noremap <F11> :call PhpDoc()<CR>
  330. """""""""""""""""""""""""""
  331. " MAPPING
  332. """""""""""""""""""""""""""
  333. " set keywordprg=pman
  334. let mapleader = "_"
  335. map <F1> :!indentation %<CR>
  336. map <F2> :call PhpCsFixerFixFile()<CR>
  337. map <F8> :!phpmd % text /usr/share/phpmd/psr2.xml \| cut -d: -f2-<CR>
  338. map <c-B> :!php -l %<CR>
  339. map <c-s> :w<CR>
  340. map <F6> :call PhpInsertUse()<CR>
  341. vmap <leader>cc :s/\%V_\([a-z]\)/\U\1/g<cr>
  342. vmap <leader>sc :s/\%V\([A-Z]\)/_\L\1/g<cr>
  343. vmap <leader>lc <leader>sc<cr>
  344. nmap <leader>cc vaw<leader>cc
  345. nmap <leader>sc vaw<leader>sc
  346. nmap <leader>lc vaw<leader>sc
  347. nmap <F7> ins<tab><esc>o
  348. nmap <c-Down> :ResizeFontSmaller<CR>
  349. nmap <c-Up> :ResizeFontBigger<CR>
  350. inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
  351. function! s:align()
  352. let p = '^\s*|\s.*\s|\s*$'
  353. if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
  354. let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
  355. let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
  356. Tabularize/|/l1
  357. normal! 0
  358. call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
  359. endif
  360. endfunction
  361. """""""""""""""""""""""""""
  362. " UI AND EDITION
  363. """""""""""""""""""""""""""
  364. set mouse=a
  365. set autoindent
  366. set nu
  367. set rnu
  368. set showmatch
  369. set tabstop=4
  370. set shiftwidth=4
  371. set softtabstop=4
  372. set incsearch
  373. set wildmenu
  374. set cursorline
  375. set guipty
  376. set fdc=2
  377. set splitbelow
  378. set splitright
  379. set hlsearch
  380. set modeline
  381. " set guifont=Consolas\ 13
  382. set guifont=Fantasque\ Sans\ Mono\ 14
  383. autocmd FileType php setlocal expandtab
  384. autocmd FileType javascript setlocal expandtab
  385. autocmd FileType xml setlocal expandtab
  386. autocmd FileType css setlocal expandtab
  387. autocmd FileType scss setlocal expandtab
  388. autocmd FileType go setlocal expandtab
  389. autocmd FileType coffee setlocal expandtab
  390. autocmd FileType ts setlocal expandtab
  391. autocmd FileType html setlocal expandtab
  392. autocmd FileType twig setlocal expandtab
  393. autocmd FileType json setlocal expandtab
  394. autocmd FileType python setlocal noexpandtab
  395. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  396. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  397. autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  398. autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
  399. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  400. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  401. au BufRead,BufNewFile *.yaml,*.yml setfiletype yaml
  402. au BufRead,BufNewFile *.vue setfiletype html
  403. au BufRead,BufNewFile *.html.twig,*.twig setfiletype twig
  404. au BufRead,BufNewFile *.js setfiletype js