dotvim/vimrc

482 lines
13 KiB
VimL
Raw Normal View History

2016-10-30 18:03:03 +01:00
set nocompatible
filetype off
2016-10-27 00:54:46 +02:00
2016-10-27 23:57:40 +02:00
runtime! debian.vim
2016-10-27 00:54:46 +02:00
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
"""""""""""""""""""""""""""
" PLUGINS
"""""""""""""""""""""""""""
2016-10-27 23:57:40 +02:00
let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
2016-10-27 00:54:46 +02:00
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'mileszs/ack.vim.git'
Plugin 'Shougo/neocomplete.vim'
Plugin 'tobyS/pdv.git'
Plugin 'scrooloose/syntastic.git'
Plugin 'majutsushi/tagbar'
Plugin 'leafgarland/typescript-vim.git'
Plugin 'SirVer/ultisnips.git'
2016-10-27 23:57:40 +02:00
Plugin 'taglist.vim'
2016-10-27 00:54:46 +02:00
Plugin 'bling/vim-airline.git'
Plugin 'kchmck/vim-coffee-script.git'
Plugin 'sheerun/vim-polyglot'
Plugin 'honza/vim-snippets.git'
Plugin 'tobyS/vmustache.git'
Plugin 'sjl/gundo.vim.git'
Plugin 'godlygeek/tabular.git'
Plugin 'tpope/vim-fugitive.git'
Plugin 'groenewege/vim-less.git'
Plugin 'arnaud-lb/vim-php-namespace.git'
Plugin 'tpope/vim-surround.git'
Plugin 'scrooloose/nerdtree'
Plugin 'nerdtree-ack'
Plugin 'php-cs-fixer'
Plugin 'php-doc-upgrade'
Plugin 'php.vim'
Plugin 'closetag.vim'
2016-10-27 23:57:40 +02:00
Plugin 'vim-scripts/Emmet.vim'
2016-10-27 00:54:46 +02:00
Plugin 'beyondwords/vim-twig'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'raimondi/delimitmate'
Plugin 'dietsche/vim-lastplace.git'
2016-10-28 09:26:42 +02:00
Plugin 'tomtom/tcomment_vim'
2016-10-30 16:07:07 +01:00
Plugin 'ahri/vim-sesspit'
2016-10-30 16:28:11 +01:00
Plugin 'voronkovich/ctrlp-symfony2.vim'
2016-10-30 19:55:43 +01:00
Plugin 'Colorizer--Brabandt'
2016-10-30 22:07:30 +01:00
Plugin 'gregsexton/gitv'
2016-10-30 22:15:20 +01:00
Plugin 'markgandolfo/nerdtree-fetch.vim'
2016-10-30 22:40:01 +01:00
Plugin 'evandotpro/nerdtree-chmod'
2016-11-02 13:20:32 +01:00
Plugin 'shawncplus/phpcomplete.vim'
Plugin 'bronson/vim-trailing-whitespace'
Plugin 'jacoborus/tender'
2019-03-28 13:18:31 +01:00
" Plugin 'vexxor/phpdoc.vim'
Plugin 'Rican7/php-doc-modded'
2016-11-15 09:37:05 +01:00
Plugin 'mzlogin/vim-markdown-toc'
2016-11-22 09:29:35 +01:00
Plugin 'rosenfeld/conque-term'
2019-03-28 13:18:31 +01:00
" Plugin 'joonty/vdebug'
2017-04-21 22:55:22 +02:00
Plugin 'isRuslan/vim-es6'
Plugin 'suan/vim-instant-markdown'
2019-03-28 13:18:31 +01:00
Plugin 'dracula/vim'
Plugin 'sniphpets/sniphpets-doctrine'
Plugin 'sniphpets/sniphpets'
Plugin 'jaxbot/semantic-highlight.vim'
Plugin 'thaerkh/vim-indentguides'
Plugin 'PotatoesMaster/i3-vim-syntax'
Plugin 'fatih/vim-go'
Plugin 'mhinz/vim-signify'
Plugin 'andrewradev/splitjoin.vim'
Plugin 'wahidrahim/resize-font'
Plugin 'skywind3000/asyncrun.vim'
Plugin 'valloric/listtoggle'
Plugin 'c9s/phpunit.vim'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'dkarter/bullets.vim'
Plugin 'connorholyday/vim-snazzy'
2016-10-27 00:54:46 +02:00
call vundle#end()
"""""""""""""""""""""""""""
" THEME
"""""""""""""""""""""""""""
syntax on
2016-11-11 01:03:17 +01:00
if has('gui_running')
2019-03-28 13:18:31 +01:00
" colorscheme tender
" colorscheme dracula
colorscheme snazzy
2016-11-11 01:03:17 +01:00
else
colorscheme Tomorrow-Night-Bright
endif
2016-10-27 00:54:46 +02:00
set background=dark
if has("autocmd")
filetype plugin on
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
endif
set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)
2016-10-27 23:57:40 +02:00
set completeopt-=preview
2016-10-27 00:54:46 +02:00
2016-10-27 23:57:40 +02:00
"""""""""""""""""""""""""""
" PLUGINS CONFIGURATION
"""""""""""""""""""""""""""
2019-03-28 13:18:31 +01:00
" SEMANTIC "
""""""""""""
if has('gui_running')
let g:semanticEnableFileTypes = { 'javascript': 'js', 'vim': 'vim', 'php': 'php'}
endif
2016-10-29 16:34:22 +02:00
" PHP-CS-FIXER "
""""""""""""""""
let g:php_cs_fixer_level = 'symfony'
2016-11-12 18:15:17 +01:00
" NERDTREE-GIT "
""""""""""""""""
let g:NERDTreeIndicatorMapCustom = {
\ 'Modified' : 'M',
\ 'Staged' : 'S',
\ 'Untracked' : '?',
\ 'Renamed' : 'R',
\ 'Unmerged' : 'U',
\ 'Deleted' : '!',
\ 'Dirty' : 'D',
\ 'Clean' : 'C',
\ 'Unknown' : '?!'
\ }
2017-04-21 22:55:22 +02:00
" Markdown preview "
""""""""""""""""""""
2019-03-28 13:18:31 +01:00
let g:vim_markdown_auto_insert_bullets = 1
let g:vim_markdown_follow_anchor = 1
let g:vim_markdown_autowrite = 0
let g:vim_markdown_conceal = 0
2017-04-21 22:55:22 +02:00
let g:instant_markdown_autostart = 0
2016-11-12 18:15:17 +01:00
2016-10-30 19:55:43 +01:00
" COLORIZER "
"""""""""""""
let g:colorizer_auto_color = 1
2016-10-29 16:34:22 +02:00
" SNIPS "
"""""""""
2016-10-27 23:57:40 +02:00
let g:snips_author = "Simon Vieille <simon@deblan.fr>"
let g:snips_email = "simon@deblan.fr"
let g:snips_github = "https://gitnet.fr/deblan"
2016-10-27 00:54:46 +02:00
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:UltiSnipsEditSplit="vertical"
2019-03-28 13:18:31 +01:00
2016-10-31 00:12:47 +01:00
" AIRLINE "
"""""""""""
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
let g:airline_theme = 'tender'
2016-10-31 00:12:47 +01:00
" airline symbols
2017-01-06 13:16:57 +01:00
if has('gui_running')
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
endif
2016-10-31 00:12:47 +01:00
2016-10-29 16:34:22 +02:00
" CLOSETAG "
""""""""""""
2016-10-27 23:57:40 +02:00
au Filetype html,xml,xsl,php,jsp,jspf,twig source ~/.vim/bundle/closetag.vim/plugin/closetag.vim
2016-10-29 16:34:22 +02:00
" NERDTree "
""""""""""""
2016-10-27 23:57:40 +02:00
let g:nerdtree_tabs_open_on_gui_startup = 2
let g:nerdtree_tabs_open_on_console_startup = 2
let g:nerdtree_tabs_autoclose = 0
2016-11-22 09:29:35 +01:00
let NERDTreeCascadeSingleChildDir = 0
let NERDTreeCascadeOpenSingleChildDir = 1
2016-10-27 23:57:40 +02:00
2016-10-31 10:48:54 +01:00
" CTRLP Symfony "
"""""""""""""""""
2016-11-12 17:52:36 +01:00
command! Sfassets CtrlPSymfony2Assets
command! Sfconfigs CtrlPSymfony2Configs
command! Sfcontrollers CtrlPSymfony2Controllers
command! Sfmodels CtrlPSymfony2Entities
command! Sfentities CtrlPSymfony2Entities
command! Sfviews CtrlPSymfony2Views
command! Sfservices CtrlPSymfonyServices
command! Sfservicesdefinition CtrlPSymfonyServiceDefinition
command! Sfforms CtrlPSymfonyForms
2016-10-31 10:48:54 +01:00
2019-03-28 13:18:31 +01:00
" PHP-CS-FIXER "
""""""""""""""""
let g:php_cs_fixer_php_path = "/usr/bin/php7.1"
" CTAGS "
"""""""""
command! CT AsyncRun ctags **/*.php
2016-10-31 10:48:54 +01:00
2016-10-29 16:34:22 +02:00
" EMMET "
"""""""""
2016-10-27 23:57:40 +02:00
let g:user_emmet_expandabbr_key = '<c-e>'
let g:use_emmet_complete_tag = 1
let g:user_emmet_settings = {
\ 'indentation' : ' ',
\ 'php' : {
\ 'extends': 'html',
\ 'aliases' : {
\ },
\ 'snippets' : {
\ 'php': "<?php\n\t|\n?>",
\ 'sf:exe' : "public function |Action()\n{\n\n}",
\ 'pf' : "public function |()\n{\n\n}",
\ 'ppf' : "protected function |()\n{\n\n}",
\ 'pppf' : "private function |()\n{\n\n}",
2016-11-02 13:20:32 +01:00
\ 'sf:pdo': "\\$con = Propel::getConnection();\n\\$stmt = \\$con->prepare('|');\n\\$stmt->bindValue();\n\\$stmt->execute();\n\\$results = \\$stmt->fetchAll();",
\ 'b:add': "\\$builder->add(\n '|',\n 'text',\n [\n 'label' => '',\n 'required' => true,\n 'attr' => [\n ],\n 'constraints' => [\n ],\n ]\n);",
\ '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);",
\ 'foreach': "foreach (\\$| as \\$k => \\$v) {\n\t\n}",
2016-10-27 23:57:40 +02:00
\ 'vard': "echo '<pre>', var_dump(|), '</pre>';\n",
\ 'vardd': "echo '<pre>', var_dump(|), '</pre>';\ndie;\n",
\ 'class': "class | {\n\tpublic function __construct() {\n\t\n\t}\n}\n",
\ 'cc': "/**\n * @var type\n */\n",
\ 'if': "if (|) {\n\n}",
\ 'for': "for ($u = 0; $u < |; $u++) {\n\t\n}",
\ 'while': "while (|) {\n\n}",
\ }
\ },
\ 'javascript' : {
\ 'aliases' : {
\ },
\ 'snippets' : {
\ 'ready': "$(document).ready(function() {\n\t|\n});",
\ 'closure': "(function($) {\n\t|\n})(jQuery);",
\ 'load': "$(|).load('', function(datas) {});",
\ 'if': "if (|) {\n\n}",
\ 'for': "for (var u=0; u<|; u++) {\n\t\n}",
\ 'while': "while (|) {\n\n}",
\ }
\ },
\ 'xml' : {
\ 'aliases' : {
\ },
\ 'snippets' : {
\ 'table': "<table name=\"\" phpName=\"\">\n\t\n</table>",
\ 'column': "<column name=\"\" type=\"integer\" size=\"\" required=\"true\" />\n",
\ 'fkey': "<foreign-key onUpdate=\"none\" foreignTable=\"\" onDelete=\"cascade\">\n\t\n</foreign-key>\n",
\ 'reference': "<reference local=\"\" foreign=\"\"/>\n"
\ }
\ },
\ 'twig' : {
\ 'extends': 'html',
\ 'aliases' : {
\ },
\ 'snippets' : {
\ 'if': "{% if | %}\n\n{% endif %}\n",
\ 'else': "{% else %}\n",
\ 'elseif': "{% elseif %}\n",
\ 'twig': "{% | %}\n",
\ 'include': "{% include \"|\" %}\n",
\ 'render': "{% render \"|\" %}\n",
\ 'vard': "<pre>{{ dump(|) }}</pre>\n",
\ 'vardd': "<pre>{{ dump(|) }}</pre>\n",
\ 'debug': "<pre>{{ dump(|) }}</pre>\n",
\ 'dump': "<pre>{{ dump(|) }}</pre>\n",
\ 'for': "{% for key, value in | %}\n\n{% endfor %}\n"
\ }
\ }
\}
2016-10-29 16:34:22 +02:00
" GITGUTTER "
"""""""""""""
2016-10-27 23:57:40 +02:00
2016-10-27 00:54:46 +02:00
let g:gitgutter_max_signs = 1000
2016-10-29 16:34:22 +02:00
" CTAGS "
"""""""""
2016-10-27 23:57:40 +02:00
2016-10-27 00:54:46 +02:00
let Tlist_Process_File_Always = 1
2016-10-27 23:57:40 +02:00
let Tlist_Ctags_Cmd='/usr/bin/ctags'
2016-10-29 16:34:22 +02:00
" NEOCOMPLETE "
"""""""""""""""
2016-10-27 23:57:40 +02:00
function! s:my_cr_function()
return neocomplete#close_popup() . "\<CR>"
"return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
"inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
"" \ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
endfunction
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
2016-10-27 00:54:46 +02:00
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#syntax#min_keyword_length = 3
2016-11-02 13:20:32 +01:00
let g:neocomplete#force_omni_input_patterns.php = '\h\w*\|[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?'
"let g:neocomplete#force_omni_input_patterns.php = '\h\w*\|[^- \t]->\w*'
2016-10-27 00:54:46 +02:00
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
2016-10-27 23:57:40 +02:00
\ }
2016-11-02 13:20:32 +01:00
let g:neocomplete#disable_auto_complete = 1
2016-10-27 23:57:40 +02:00
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
2016-11-06 22:36:04 +01:00
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
2016-10-27 00:54:46 +02:00
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
2016-10-27 23:57:40 +02:00
2016-11-15 09:37:05 +01:00
inoremap <expr><TAB>
\ pumvisible() ? "\<C-n>" :
\ neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" :
2016-11-06 22:36:04 +01:00
\ "\<TAB>"
2016-10-27 00:54:46 +02:00
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
2016-10-29 16:34:22 +02:00
" PDV (DOC) "
"""""""""""""
2016-10-27 00:54:46 +02:00
function! PhpSyntaxOverride()
hi! def link phpDocTags phpDefine
hi! def link phpDocParam phpType
endfunction
augroup phpSyntaxOverride
autocmd!
autocmd FileType php call PhpSyntaxOverride()
augroup END
2016-10-27 23:57:40 +02:00
let g:pdv_template_dir = $HOME."/.vim/bundle/pdv/templates_snip/"
" Vdebug "
""""""""""
let g:vdebug_options = {}
let g:vdebug_options['port'] = 9000
2016-11-13 00:41:29 +01:00
" PHPDOC "
""""""""""
noremap <F11> :call PhpDoc()<CR>
2016-10-27 00:54:46 +02:00
"""""""""""""""""""""""""""
" MAPPING
"""""""""""""""""""""""""""
2016-10-27 23:57:40 +02:00
" set keywordprg=pman
2016-10-27 00:54:46 +02:00
let mapleader = "_"
2019-03-28 13:18:31 +01:00
2016-10-27 00:54:46 +02:00
map <F1> :!indentation %<CR>
map <F2> :call PhpCsFixerFixFile()<CR>
map <F8> :!phpmd % text /usr/share/phpmd/psr2.xml \| cut -d: -f2-<CR>
map <c-B> :!php -l %<CR>
map <c-s> :w<CR>
map <F6> :call PhpInsertUse()<CR>
2017-02-06 10:42:20 +01:00
2019-03-28 13:18:31 +01:00
vmap <leader>cc :s/\%V_\([a-z]\)/\U\1/g<cr>
vmap <leader>sc :s/\%V\([A-Z]\)/_\L\1/g<cr>
2017-02-06 10:42:20 +01:00
vmap <leader>lc <leader>sc<cr>
2019-03-28 13:18:31 +01:00
nmap <leader>cc vaw<leader>cc
nmap <leader>sc vaw<leader>sc
nmap <leader>lc vaw<leader>sc
2017-02-07 00:07:23 +01:00
nmap <F7> ins<tab><esc>o
2019-03-28 13:18:31 +01:00
nmap <c-Down> :ResizeFontSmaller<CR>
nmap <c-Up> :ResizeFontBigger<CR>
2017-02-06 10:42:20 +01:00
2016-11-26 20:30:57 +01:00
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
2016-10-27 00:54:46 +02:00
"""""""""""""""""""""""""""
" UI AND EDITION
"""""""""""""""""""""""""""
set mouse=a
set autoindent
set nu
2019-03-28 13:18:31 +01:00
set rnu
2016-10-27 00:54:46 +02:00
set showmatch
set tabstop=4
set shiftwidth=4
set softtabstop=4
set incsearch
set wildmenu
set cursorline
set guipty
set fdc=2
set splitbelow
set splitright
2017-02-06 10:42:20 +01:00
set hlsearch
2019-03-28 13:18:31 +01:00
set modeline
2017-02-06 10:42:20 +01:00
" set guifont=Consolas\ 13
set guifont=Fantasque\ Sans\ Mono\ 14
2016-10-27 00:54:46 +02:00
autocmd FileType php setlocal expandtab
autocmd FileType javascript setlocal expandtab
autocmd FileType xml setlocal expandtab
autocmd FileType css setlocal expandtab
2019-03-28 13:18:31 +01:00
autocmd FileType scss setlocal expandtab
autocmd FileType go setlocal expandtab
2016-10-27 00:54:46 +02:00
autocmd FileType coffee setlocal expandtab
autocmd FileType ts setlocal expandtab
autocmd FileType html setlocal expandtab
autocmd FileType twig setlocal expandtab
autocmd FileType json setlocal expandtab
2019-03-28 13:18:31 +01:00
autocmd FileType python setlocal noexpandtab
2016-10-27 00:54:46 +02:00
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
2016-10-27 23:57:40 +02:00
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
2016-10-27 00:54:46 +02:00
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
2019-03-28 13:18:31 +01:00
au BufRead,BufNewFile *.yaml,*.yml setfiletype yaml
au BufRead,BufNewFile *.vue setfiletype html
au BufRead,BufNewFile *.html.twig,*.twig setfiletype twig
au BufRead,BufNewFile *.js setfiletype js