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.

493 lines
14KB

  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. " Plugin 'patstockwell/vim-monokai-tasty'
  80. call vundle#end()
  81. """""""""""""""""""""""""""
  82. " THEME
  83. """""""""""""""""""""""""""
  84. syntax on
  85. if has('gui_running')
  86. " colorscheme tender
  87. " colorscheme dracula
  88. " colorscheme vim-monokai-tasty
  89. colorscheme snazzy
  90. else
  91. colorscheme Tomorrow-Night-Bright
  92. endif
  93. set background=dark
  94. if has("autocmd")
  95. filetype plugin on
  96. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  97. endif
  98. set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)
  99. set completeopt-=preview
  100. """""""""""""""""""""""""""
  101. " PLUGINS CONFIGURATION
  102. """""""""""""""""""""""""""
  103. " SEMANTIC "
  104. """"""""""""
  105. if has('gui_running')
  106. let g:semanticEnableFileTypes = { 'javascript': 'js', 'vim': 'vim', 'php': 'php'}
  107. endif
  108. " NERDTREE-GIT "
  109. """"""""""""""""
  110. let g:NERDTreeIndicatorMapCustom = {
  111. \ 'Modified' : 'M',
  112. \ 'Staged' : 'S',
  113. \ 'Untracked' : '?',
  114. \ 'Renamed' : 'R',
  115. \ 'Unmerged' : 'U',
  116. \ 'Deleted' : '!',
  117. \ 'Dirty' : 'D',
  118. \ 'Clean' : 'C',
  119. \ 'Unknown' : '?!'
  120. \ }
  121. " Markdown preview "
  122. """"""""""""""""""""
  123. let g:vim_markdown_auto_insert_bullets = 1
  124. let g:vim_markdown_follow_anchor = 1
  125. let g:vim_markdown_autowrite = 0
  126. let g:vim_markdown_conceal = 0
  127. let g:instant_markdown_autostart = 0
  128. let g:polyglot_disabled = ['markdown']
  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_level = ''
  195. let g:php_cs_fixer_php_path = "/usr/bin/php7.3"
  196. " CTAGS "
  197. """""""""
  198. command! CT AsyncRun ctags **/*.php
  199. " EMMET "
  200. """""""""
  201. let g:user_emmet_expandabbr_key = '<c-e>'
  202. let g:use_emmet_complete_tag = 1
  203. let g:user_emmet_settings = {
  204. \ 'indentation' : ' ',
  205. \ 'php' : {
  206. \ 'extends': 'html',
  207. \ 'aliases' : {
  208. \ },
  209. \ 'snippets' : {
  210. \ 'php': "<?php\n\t|\n?>",
  211. \ 'sf:exe' : "public function |Action()\n{\n\n}",
  212. \ 'pf' : "public function |()\n{\n\n}",
  213. \ 'ppf' : "protected function |()\n{\n\n}",
  214. \ 'pppf' : "private function |()\n{\n\n}",
  215. \ 'sf:pdo': "\\$con = Propel::getConnection();\n\\$stmt = \\$con->prepare('|');\n\\$stmt->bindValue();\n\\$stmt->execute();\n\\$results = \\$stmt->fetchAll();",
  216. \ 'b:add': "\\$builder->add(\n '|',\n 'text',\n [\n 'label' => '',\n 'required' => true,\n 'attr' => [\n ],\n 'constraints' => [\n ],\n ]\n);",
  217. \ '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);",
  218. \ 'foreach': "foreach (\\$| as \\$k => \\$v) {\n\t\n}",
  219. \ 'vard': "echo '<pre>', var_dump(|), '</pre>';\n",
  220. \ 'vardd': "echo '<pre>', var_dump(|), '</pre>';\ndie;\n",
  221. \ 'class': "class | {\n\tpublic function __construct() {\n\t\n\t}\n}\n",
  222. \ 'cc': "/**\n * @var type\n */\n",
  223. \ 'if': "if (|) {\n\n}",
  224. \ 'for': "for ($u = 0; $u < |; $u++) {\n\t\n}",
  225. \ 'while': "while (|) {\n\n}",
  226. \ }
  227. \ },
  228. \ 'javascript' : {
  229. \ 'aliases' : {
  230. \ },
  231. \ 'snippets' : {
  232. \ 'ready': "$(document).ready(function() {\n\t|\n});",
  233. \ 'closure': "(function($) {\n\t|\n})(jQuery);",
  234. \ 'load': "$(|).load('', function(datas) {});",
  235. \ 'if': "if (|) {\n\n}",
  236. \ 'for': "for (var u=0; u<|; u++) {\n\t\n}",
  237. \ 'while': "while (|) {\n\n}",
  238. \ }
  239. \ },
  240. \ 'xml' : {
  241. \ 'aliases' : {
  242. \ },
  243. \ 'snippets' : {
  244. \ 'table': "<table name=\"\" phpName=\"\">\n\t\n</table>",
  245. \ 'column': "<column name=\"\" type=\"integer\" size=\"\" required=\"true\" />\n",
  246. \ 'fkey': "<foreign-key onUpdate=\"none\" foreignTable=\"\" onDelete=\"cascade\">\n\t\n</foreign-key>\n",
  247. \ 'reference': "<reference local=\"\" foreign=\"\"/>\n"
  248. \ }
  249. \ },
  250. \ 'twig' : {
  251. \ 'extends': 'html',
  252. \ 'aliases' : {
  253. \ },
  254. \ 'snippets' : {
  255. \ 'if': "{% if | %}\n\n{% endif %}\n",
  256. \ 'else': "{% else %}\n",
  257. \ 'elseif': "{% elseif %}\n",
  258. \ 'twig': "{% | %}\n",
  259. \ 'include': "{% include \"|\" %}\n",
  260. \ 'render': "{% render \"|\" %}\n",
  261. \ 'vard': "<pre>{{ dump(|) }}</pre>\n",
  262. \ 'vardd': "<pre>{{ dump(|) }}</pre>\n",
  263. \ 'debug': "<pre>{{ dump(|) }}</pre>\n",
  264. \ 'dump': "<pre>{{ dump(|) }}</pre>\n",
  265. \ 'for': "{% for key, value in | %}\n\n{% endfor %}\n"
  266. \ }
  267. \ }
  268. \}
  269. " GITGUTTER "
  270. """""""""""""
  271. let g:gitgutter_max_signs = 1000
  272. " CTAGS "
  273. """""""""
  274. let Tlist_Process_File_Always = 1
  275. let Tlist_Ctags_Cmd='/usr/bin/ctags'
  276. " NEOCOMPLETE "
  277. """""""""""""""
  278. function! s:my_cr_function()
  279. return neocomplete#close_popup() . "\<CR>"
  280. "return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
  281. "inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
  282. "" \ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
  283. endfunction
  284. if !exists('g:neocomplete#keyword_patterns')
  285. let g:neocomplete#keyword_patterns = {}
  286. endif
  287. if !exists('g:neocomplete#force_omni_input_patterns')
  288. let g:neocomplete#force_omni_input_patterns = {}
  289. endif
  290. let g:acp_enableAtStartup = 0
  291. let g:neocomplete#enable_at_startup = 1
  292. let g:neocomplete#enable_smart_case = 1
  293. let g:neocomplete#sources#syntax#min_keyword_length = 3
  294. let g:neocomplete#force_omni_input_patterns.php = '\h\w*\|[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?'
  295. "let g:neocomplete#force_omni_input_patterns.php = '\h\w*\|[^- \t]->\w*'
  296. let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
  297. let g:neocomplete#sources#dictionary#dictionaries = {
  298. \ 'default' : '',
  299. \ 'vimshell' : $HOME.'/.vimshell_hist',
  300. \ 'scheme' : $HOME.'/.gosh_completions'
  301. \ }
  302. let g:neocomplete#disable_auto_complete = 1
  303. let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  304. inoremap <expr><C-g> neocomplete#undo_completion()
  305. inoremap <expr><C-l> neocomplete#complete_common_string()
  306. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
  307. inoremap <expr><TAB>
  308. \ pumvisible() ? "\<C-n>" :
  309. \ neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" :
  310. \ "\<TAB>"
  311. inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
  312. inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
  313. " PDV (DOC) "
  314. """""""""""""
  315. function! PhpSyntaxOverride()
  316. hi! def link phpDocTags phpDefine
  317. hi! def link phpDocParam phpType
  318. endfunction
  319. augroup phpSyntaxOverride
  320. autocmd!
  321. autocmd FileType php call PhpSyntaxOverride()
  322. augroup END
  323. let g:pdv_template_dir = $HOME."/.vim/bundle/pdv/templates_snip/"
  324. let g:pdv_cfg_autoEndFunction = 0
  325. let g:pdv_cfg_autoEndClass = 0
  326. let g:pdv_cfg_php4always = 0
  327. let g:pdv_cfg_php4guess = 0
  328. let g:pdv_cfg_annotation_Package = 0
  329. let g:pdv_cfg_annotation_Version = 0
  330. let g:pdv_cfg_annotation_Copyright = 0
  331. let g:pdv_cfg_annotation_License = 0
  332. " Vdebug "
  333. """"""""""
  334. let g:vdebug_options = {}
  335. let g:vdebug_options['port'] = 9000
  336. " PHPDOC "
  337. """"""""""
  338. noremap <F11> :call PhpDoc()<CR>
  339. """""""""""""""""""""""""""
  340. " MAPPING
  341. """""""""""""""""""""""""""
  342. " set keywordprg=pman
  343. let mapleader = "_"
  344. map <F1> :!indentation %<CR>
  345. map <F2> :!php7.3 ~/php-cs-fixer.phar fix "%" --rules=@PSR2 <CR>
  346. map <F8> :!phpmd % text /usr/share/phpmd/psr2.xml \| cut -d: -f2-<CR>
  347. map <c-B> :!php -l %<CR>
  348. map <c-s> :w<CR>
  349. map <F6> :call PhpInsertUse()<CR>
  350. vmap <leader>cc :s/\%V_\([a-z]\)/\U\1/g<cr>
  351. vmap <leader>sc :s/\%V\([A-Z]\)/_\L\1/g<cr>
  352. vmap <leader>lc <leader>sc<cr>
  353. nmap <leader>cc vaw<leader>cc
  354. nmap <leader>sc vaw<leader>sc
  355. nmap <leader>lc vaw<leader>sc
  356. nmap <F7> ins<tab><esc>o
  357. nmap <c-Down> :ResizeFontSmaller<CR>
  358. nmap <c-Up> :ResizeFontBigger<CR>
  359. inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
  360. function! s:align()
  361. let p = '^\s*|\s.*\s|\s*$'
  362. if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
  363. let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
  364. let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
  365. Tabularize/|/l1
  366. normal! 0
  367. call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
  368. endif
  369. endfunction
  370. """""""""""""""""""""""""""
  371. " UI AND EDITION
  372. """""""""""""""""""""""""""
  373. set mouse=a
  374. set autoindent
  375. set nu
  376. set rnu
  377. set showmatch
  378. set tabstop=4
  379. set shiftwidth=4
  380. set softtabstop=4
  381. set incsearch
  382. set wildmenu
  383. set cursorline
  384. set guipty
  385. set fdc=2
  386. set splitbelow
  387. set splitright
  388. set hlsearch
  389. set nomodeline
  390. " set modeline
  391. " set guifont=Consolas\ 13
  392. set guifont=Fantasque\ Sans\ Mono\ 14
  393. autocmd FileType php setlocal expandtab
  394. autocmd FileType javascript setlocal expandtab
  395. autocmd FileType xml setlocal expandtab
  396. autocmd FileType css setlocal expandtab
  397. autocmd FileType scss setlocal expandtab
  398. autocmd FileType go setlocal expandtab
  399. autocmd FileType coffee setlocal expandtab
  400. autocmd FileType ts setlocal expandtab
  401. autocmd FileType html setlocal expandtab
  402. autocmd FileType twig setlocal expandtab
  403. autocmd FileType json setlocal expandtab
  404. autocmd FileType python setlocal noexpandtab
  405. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  406. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  407. autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  408. autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
  409. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  410. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  411. au BufRead,BufNewFile *.yaml,*.yml setfiletype yaml
  412. au BufRead,BufNewFile *.vue setfiletype html
  413. au BufRead,BufNewFile *.html.twig,*.twig setfiletype twig
  414. au BufRead,BufNewFile *.js setfiletype js