dotvim/vimrc

373 lines
11 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 'airblade/vim-gitgutter.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'
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')
colorscheme tender
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
"""""""""""""""""""""""""""
2016-10-29 16:34:22 +02:00
" PHP-CS-FIXER "
""""""""""""""""
let g:php_cs_fixer_level = 'symfony'
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"
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
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 = ''
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-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
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-06 22:36:04 +01:00
inoremap <expr><TAB>
\ pumvisible() ? "\<C-n>" :
\ neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" :
\ "\<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/"
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 = "_"
map <F1> :!indentation %<CR>
map <F2> :call PhpCsFixerFixFile()<CR>
map <F7> :r!namespace %<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>
nnoremap <F5> :GundoToggle<CR>
"""""""""""""""""""""""""""
" UI AND EDITION
"""""""""""""""""""""""""""
set mouse=a
set autoindent
set nu
set showmatch
set tabstop=4
set shiftwidth=4
set softtabstop=4
set incsearch
set wildmenu
set cursorline
set guipty
set fdc=2
" set guifont=Consolas\ 13
set guifont=Fantasque\ Sans\ Mono\ 14
set splitbelow
set splitright
autocmd FileType php setlocal expandtab
autocmd FileType javascript setlocal expandtab
autocmd FileType xml setlocal expandtab
autocmd FileType css setlocal expandtab
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
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
2016-10-27 23:57:40 +02:00
au BufNewFile,BufRead *.yaml,*.yml setfiletype yaml
2016-10-27 00:54:46 +02:00
au BufRead,BufNewFile *.twig setfiletype twig