2016-11-03 09:08:32 +00:00
|
|
|
|
" configuration vim + IDE
|
2018-04-06 12:48:14 +00:00
|
|
|
|
" pcht 2016-2018
|
2016-11-03 09:08:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Vundle https://github.com/VundleVim/Vundle.vim
|
|
|
|
|
" install with :
|
|
|
|
|
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
|
|
|
|
" set nocompatible be iMproved, required - Isnt it automatic with .vimrc??
|
|
|
|
|
filetype off " required
|
|
|
|
|
|
|
|
|
|
" set the runtime path to include Vundle and initialize
|
|
|
|
|
set rtp+=~/.vim/bundle/Vundle.vim
|
|
|
|
|
call vundle#begin()
|
|
|
|
|
|
|
|
|
|
" let Vundle manage Vundle, required
|
|
|
|
|
Plugin 'VundleVim/Vundle.vim'
|
|
|
|
|
|
|
|
|
|
Plugin 'tpope/vim-fugitive'
|
|
|
|
|
Plugin 'commentary.vim'
|
2016-11-23 10:06:05 +00:00
|
|
|
|
" Plugin 'Syntastic'
|
2016-11-03 09:08:32 +00:00
|
|
|
|
Plugin 'ctrlpvim/ctrlp.vim'
|
2018-04-06 12:48:14 +00:00
|
|
|
|
Plugin 'tpope/vim-surround'
|
2016-11-03 09:08:32 +00:00
|
|
|
|
|
|
|
|
|
Plugin 'ciscoacl.vim'
|
2017-04-21 10:27:23 +00:00
|
|
|
|
|
2018-06-01 13:22:50 +00:00
|
|
|
|
" https://github.com/dhruvasagar/vim-table-mode
|
|
|
|
|
Plugin 'dhruvasagar/vim-table-mode'
|
|
|
|
|
|
2017-04-21 10:27:23 +00:00
|
|
|
|
" language
|
2017-05-11 14:59:58 +00:00
|
|
|
|
" Plugin 'octol/vim-cpp-enhanced-highlight'
|
|
|
|
|
" C++ http://www.vim.org/scripts/script.php?script_id=3302
|
|
|
|
|
" install with vim clang_complete.vmb -c 'so %' -c 'q'
|
|
|
|
|
" GLSL
|
|
|
|
|
Plugin 'tikhomirov/vim-glsl'
|
|
|
|
|
" Plugin 'rust-lang/rust.vim'
|
2017-04-21 10:27:23 +00:00
|
|
|
|
|
2019-01-10 14:37:01 +00:00
|
|
|
|
Plugin 'ElmCast/elm-vim'
|
|
|
|
|
|
|
|
|
|
" https://valloric.github.io/YouCompleteMe/
|
|
|
|
|
Plugin 'Valloric/YouCompleteMe'
|
|
|
|
|
|
|
|
|
|
" KSP script syntax
|
|
|
|
|
Plugin 'KSP-KOS/EditorTools', {'rtp': 'VIM/vim-kerboscript'}
|
|
|
|
|
|
2016-11-03 09:08:32 +00:00
|
|
|
|
" All of your Plugins must be added before the following line
|
|
|
|
|
call vundle#end() " required
|
|
|
|
|
filetype plugin indent on " required
|
|
|
|
|
|
|
|
|
|
" syntax
|
|
|
|
|
syntax on
|
|
|
|
|
|
|
|
|
|
" colorscheme default
|
|
|
|
|
colorscheme elflord
|
|
|
|
|
|
|
|
|
|
" print code with :hardcopy using impression.lam.jussieu.fr
|
|
|
|
|
set printdevice=hp5550-509
|
|
|
|
|
set printoptions=left:5pt,right:5pt,top:5pt,bottom:5pt,number:y,duplex:off,wrap:y,paper:A4,portrait:y
|
|
|
|
|
set printheader=%<%F\ -\ page\ %N%=Print\ at\ %{strftime(\'%Y-%m-%d\ %H:%M\')}
|
|
|
|
|
" FIXME set printfont=:h18
|
|
|
|
|
|
2018-06-01 13:22:50 +00:00
|
|
|
|
" modeline : enable « vim:<space> [ vim_set ] + »
|
2017-04-27 08:47:56 +00:00
|
|
|
|
set modeline
|
|
|
|
|
|
2019-01-10 14:37:01 +00:00
|
|
|
|
" set backspace normal
|
|
|
|
|
set backspace=2
|
|
|
|
|
|
2019-01-25 10:50:10 +00:00
|
|
|
|
" no wrap
|
|
|
|
|
set nowrap
|
|
|
|
|
|
2016-11-03 09:08:32 +00:00
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" ligne de statut
|
|
|
|
|
set statusline=%F%m%r%h%w\ %{fugitive#statusline()}%=[BUF=%n][FORMAT=%{&ff}][TYPE=%Y][ASCII=%03.3b][LINE=%03l][COL=%03v][%p%%]
|
|
|
|
|
set laststatus=2
|
|
|
|
|
|
2016-11-14 14:56:21 +00:00
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" affiche les touches en mode commande
|
|
|
|
|
set showcmd
|
|
|
|
|
|
2016-11-03 09:08:32 +00:00
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" numéro de ligne
|
|
|
|
|
set number
|
|
|
|
|
highlight LineNr ctermbg=black ctermfg=gray
|
|
|
|
|
|
|
|
|
|
"""""""""""""""""""
|
2018-06-01 13:22:50 +00:00
|
|
|
|
" ligne et colonne courante: activation en mode insert et pas en mode normal
|
|
|
|
|
:autocmd InsertEnter,InsertLeave * set cursorline! cursorcolumn!
|
2016-11-03 09:08:32 +00:00
|
|
|
|
highlight CursorLine term=underline cterm=underline
|
2018-06-07 17:04:55 +00:00
|
|
|
|
set cursorcolumn cursorline
|
2018-06-01 13:22:50 +00:00
|
|
|
|
" highlight CursorColumn term=none cterm=none ctermbg=grey ctermfg=black
|
|
|
|
|
highlight CursorColumn term=underline cterm=underline
|
2019-01-10 14:37:01 +00:00
|
|
|
|
|
2016-11-23 10:07:24 +00:00
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" Search/IncSearch
|
|
|
|
|
set hlsearch
|
|
|
|
|
highlight Search term=reverse,bold cterm=reverse,bold ctermfg=None ctermbg=None
|
|
|
|
|
set incsearch
|
2016-11-28 09:48:59 +00:00
|
|
|
|
highlight IncSearch term=reverse cterm=reverse ctermfg=None ctermbg=None
|
2016-11-03 09:08:32 +00:00
|
|
|
|
|
2019-01-10 14:37:01 +00:00
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" tab/eof as characters
|
|
|
|
|
" https://vi.stackexchange.com/questions/422/displaying-tabs-as-characters
|
|
|
|
|
" dans vim, uriliser Ctrl-v + u + code utf8
|
|
|
|
|
" code : https://codepoints.net/control_pictures
|
|
|
|
|
" tab : ␉ (U+2409 - SYMBOL FOR HORIZONTAL TABULATION)
|
|
|
|
|
" : ˍ (U+02cd - MODIFIER LETTER LOW MACRON)
|
|
|
|
|
" : ․ (U+2024 - ONE DOT LEADER)
|
|
|
|
|
" : • (U+2022 - BULLET)
|
|
|
|
|
" eol : ¶ (U+00b6 - PILCROW SIGN)
|
|
|
|
|
" trail : ␠ (U+2420 - SYMBOL FOR SPACE)
|
|
|
|
|
" : ␣ (U+2423 - OPEN BOX)
|
|
|
|
|
"
|
|
|
|
|
set list
|
|
|
|
|
set listchars=tab:␉․,trail:␠,nbsp:⎵,precedes:<,extends:>
|
|
|
|
|
" listchars as grey
|
|
|
|
|
highlight SpecialKey ctermfg=DarkGrey
|
|
|
|
|
highlight NonText ctermfg=DarkGrey
|
|
|
|
|
nmap <Leader>l <Esc>:set invlist<cr>
|
|
|
|
|
imap <Leader>l <Esc>:set invlist<cr>li
|
|
|
|
|
|
|
|
|
|
|
2016-11-03 09:08:32 +00:00
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" autoindent
|
|
|
|
|
" set autoindent
|
|
|
|
|
" tabulation
|
|
|
|
|
" set expandtab
|
|
|
|
|
" set shiftwidth=4
|
|
|
|
|
" set softtabstop=4
|
|
|
|
|
" set tabstop=4
|
|
|
|
|
|
|
|
|
|
"" replis de code <fold>
|
|
|
|
|
"" <n>zf pour créer un repli
|
|
|
|
|
"" za pour ouvrir/fermer un repli déjà crée
|
|
|
|
|
"" zm pour fermer tous les replis
|
|
|
|
|
"" zr pour ouvrir tous les replis
|
|
|
|
|
" function! MyFoldFunction ()
|
|
|
|
|
" let line = getline(v:foldstart)
|
|
|
|
|
" let sub = substitute(line,'/\*\|\*/\|^\s+','','g')
|
|
|
|
|
" let lines = v:foldend - v:foldstart + 1
|
|
|
|
|
" return '[+] ' . v:folddashes.sub . '...' . lines . ' lignes...' . getline(v:foldend)
|
|
|
|
|
" endfunction
|
|
|
|
|
" set foldenable
|
|
|
|
|
"" afficher un = sur les replis
|
|
|
|
|
" set fillchars=fold:=
|
|
|
|
|
" set foldtext=MyFoldFunction()
|
|
|
|
|
|
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" les onglets
|
|
|
|
|
" tabe <file> créer un onglet
|
|
|
|
|
"function! MoveTab(direction)
|
|
|
|
|
" if (a:direction == 'left')
|
|
|
|
|
" let tabnum = tabpagenr()-2
|
|
|
|
|
" if (tabnum < 0)
|
|
|
|
|
" let tabnum = 0
|
|
|
|
|
" endif
|
|
|
|
|
" execute 'tabm '.tabnum
|
|
|
|
|
" else
|
|
|
|
|
" let tabnum = tabpagenr()
|
|
|
|
|
" execute 'tabm '.tabnum
|
|
|
|
|
" endif
|
|
|
|
|
"endfunction
|
|
|
|
|
"highlight TabLine term=none cterm=none
|
|
|
|
|
"highlight TabLineSel ctermbg=darkblue
|
|
|
|
|
" raccourcis
|
|
|
|
|
" gF ouvre un onglet sur le mot sous le cursor
|
|
|
|
|
"map <C-LEFT> <ESC>:tabprevious<CR>
|
|
|
|
|
"map <C-RIGHT> <ESC>:tabnext<CR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" correcteur orthographique
|
|
|
|
|
" utilisation
|
|
|
|
|
" <]+s>, <[+s>: aller a l'erreur precedente, suivante
|
|
|
|
|
|
|
|
|
|
"setlocal spell spelllang=fr,en
|
2017-02-24 15:04:31 +00:00
|
|
|
|
setlocal spell spelllang=en_us,fr
|
|
|
|
|
highlight SpellBad term=underline ctermfg=white ctermbg=red cterm=underline
|
|
|
|
|
highlight SpellCap term=italic,underline ctermfg=yellow ctermbg=red cterm=underline
|
|
|
|
|
highlight SpellRare term=bold,italic,underline ctermfg=cyan ctermbg=red cterm=underline
|
|
|
|
|
highlight SpellLocal term=underline ctermfg=grey ctermbg=red cterm=underline
|
|
|
|
|
highlight SpellErrors term=italic,underline ctermbg=red ctermfg=white
|
2016-11-03 09:08:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""""""""""""""""""
|
|
|
|
|
" ouverture du fichier à l'ancienne position
|
|
|
|
|
function! s:CursorOldPosition()
|
|
|
|
|
if line("'\"") > 0 && line("'\"") <= line("$")
|
|
|
|
|
exe "normal g`\""
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
autocmd BufReadPost * silent! call s:CursorOldPosition()
|
|
|
|
|
|
|
|
|
|
" """""""""""""""""""
|
|
|
|
|
" " autocompletion
|
|
|
|
|
" " <Ctrl+x><Ctrl+n> autocompletion direct (nom dans le fichier courant)
|
|
|
|
|
" " <Ctrl+x><Ctrl+k> autocompletion dictionnaire (dictionnaire perso ou fichier syntax/<ext>.vim)
|
|
|
|
|
" " autocmd FileType * exec('setlocal dict+='.$VIMRUNTIME.'/syntax/'.expand('<amatch>').'.vim')
|
|
|
|
|
" function! MultiCompletion()
|
|
|
|
|
" if &omnifunc != ''
|
|
|
|
|
" return "\<C-x>\<C-o>"
|
|
|
|
|
" elseif &dictionary != ''
|
|
|
|
|
" return "\<C-x>\<C-k>"
|
|
|
|
|
" else
|
|
|
|
|
" return "\<C-x>\<C-n>"
|
|
|
|
|
" endif
|
|
|
|
|
" endfunction
|
|
|
|
|
" " map <S-TAB> <C-r>=MultiCompletion()<CR>
|
|
|
|
|
" map <c-o> <C-r>=MultiCompletion()<CR>
|
|
|
|
|
|
|
|
|
|
"""""""""""""""""""
|
|
|
|
|
" templates
|
|
|
|
|
function! LoadTemplate(extension,type)
|
|
|
|
|
if (a:type == 'all')
|
|
|
|
|
silent! execute '0r' . $HOME . '/.vim/__tpl/' . a:extension . '.tpl'
|
|
|
|
|
silent! execute 'source ' .$HOME . '/.vim/__tpl.vim'
|
|
|
|
|
endif
|
|
|
|
|
" abbreviations
|
|
|
|
|
silent! execute 'source ' .$HOME . '/.vim/__tpl/' . a:extension . '.abb'
|
|
|
|
|
" dictionaries
|
|
|
|
|
silent! execute 'source ' .$HOME . '/.vim/__tpl/' . a:extension . '.dict'
|
|
|
|
|
" commandes vim
|
|
|
|
|
silent! execute 'source ' .$HOME . '/.vim/__tpl/' . a:extension . '.vim'
|
|
|
|
|
endfunction
|
|
|
|
|
autocmd BufNewFile * silent! call LoadTemplate('%:e','all')
|
|
|
|
|
autocmd BufRead * silent! call LoadTemplate('%:e','notall')
|
|
|
|
|
|
|
|
|
|
" " omnifunc
|
|
|
|
|
" if has("autocmd") && exists("+omnifunc")
|
|
|
|
|
" autocmd Filetype *
|
|
|
|
|
" \ if &omnifunc == "" |
|
|
|
|
|
" \ setlocal omnifunc=syntaxcomplete#Complete |
|
|
|
|
|
" \ endif
|
|
|
|
|
" endif
|
|
|
|
|
|
|
|
|
|
" CISCO ACL
|
|
|
|
|
augroup filetype
|
|
|
|
|
au! BufRead,BufNewFile *.crules set filetype=ciscoacl
|
|
|
|
|
au! BufRead,BufNewFile *.acl set filetype=ciscoacl
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
" markdown syntax for gitit
|
|
|
|
|
augroup filetype
|
|
|
|
|
au! BufRead,BufNewFile *.page set filetype=markdown
|
|
|
|
|
au! BufRead,BufNewFile *.md set filetype=markdown
|
|
|
|
|
augroup END
|
|
|
|
|
|
2019-01-10 14:37:01 +00:00
|
|
|
|
" kerboscript comment
|
|
|
|
|
autocmd FileType kerboscript setlocal commentstring=//\ %s
|
|
|
|
|
|
2016-11-03 09:08:32 +00:00
|
|
|
|
"" UltiSnips https://github.com/sirver/ultisnips
|
|
|
|
|
"" Activate snipMate snippers (disable by default)
|
|
|
|
|
" let g:UltiSnips = {}
|
|
|
|
|
" let g:UltiSnips.snipmate_ft_filter = { 'default' : {'filetypes': ['_', 'FILETYPE'] } }
|
|
|
|
|
" use python 2
|
|
|
|
|
" let g:UltiSnipsUsePythonVersion = 2
|
|
|
|
|
"" change key binding
|
|
|
|
|
" let g:UltiSnipsExpandTrigger="<tab>"
|
|
|
|
|
" let g:UltiSnipsJumpForwardTrigger="<tab>"
|
|
|
|
|
" let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
|
|
|
|
|
" let g:UltiSnipsListSnippets="<c-l>"
|
|
|
|
|
" If you want :UltiSnipsEdit to split your window.
|
|
|
|
|
" let g:UltiSnipsEditSplit="vertical"
|
|
|
|
|
|
|
|
|
|
" let g:snips_author = 'Patrick CAO HUU THIEN'
|
|
|
|
|
" let g:UltiSnips.ExpandTrigger="<tab>"
|
|
|
|
|
" let g:UltiSnips.JumpForwardTrigger="<tab>"
|
|
|
|
|
" let g:UltiSnips.JumpBackwardTrigger="<s-tab>"
|
|
|
|
|
" let g:UltiSnips.ListSnippets="<c-tab>"
|
|
|
|
|
|
|
|
|
|
"" numbers-vim
|
|
|
|
|
" nnoremap <F3> :NumbersToggle<CR>
|
|
|
|
|
|
2016-11-08 10:03:03 +00:00
|
|
|
|
" syntastic
|
2016-11-23 10:06:05 +00:00
|
|
|
|
" set statusline+=%#warningmsg#
|
|
|
|
|
" set statusline+=%{SyntasticStatuslineFlag()}
|
|
|
|
|
" set statusline+=%*
|
2016-11-08 10:03:03 +00:00
|
|
|
|
|
|
|
|
|
" let g:syntastic_always_populate_loc_list = 1
|
|
|
|
|
" let g:syntastic_auto_loc_list = 1
|
|
|
|
|
" let g:syntastic_check_on_open = 1
|
|
|
|
|
" let g:syntastic_check_on_wq = 0
|
2016-11-28 09:48:59 +00:00
|
|
|
|
" let g:syntastic_auto_jump = 2
|
|
|
|
|
|
|
|
|
|
" Search down into subfolders
|
|
|
|
|
" Provides tab-completion for all file-related tasks
|
|
|
|
|
" use :find + <tab>
|
|
|
|
|
set path+=**
|
|
|
|
|
" Display all matching files when we tab complete
|
|
|
|
|
set wildmenu
|
2016-11-08 10:03:03 +00:00
|
|
|
|
|
2016-11-03 09:08:32 +00:00
|
|
|
|
""" keymaps
|
2016-11-03 09:46:22 +00:00
|
|
|
|
" no arrows keys no more
|
2016-11-03 09:08:32 +00:00
|
|
|
|
nmap <Left> <Nop>
|
|
|
|
|
nmap <Right> <Nop>
|
|
|
|
|
nmap <Up> <Nop>
|
|
|
|
|
nmap <Down> <Nop>
|
2016-11-23 10:08:08 +00:00
|
|
|
|
" imap <Left> <Np>
|
|
|
|
|
" imap <Right> <Nop>
|
|
|
|
|
" imap <Up> <Nop>
|
|
|
|
|
" imap <Down> <Nop>
|
2016-11-03 09:46:22 +00:00
|
|
|
|
|
|
|
|
|
" Esc remap
|
|
|
|
|
imap jj <Esc>
|
|
|
|
|
imap kk <Esc>
|
|
|
|
|
" map caps-lock with Xvindow
|
2019-01-25 10:50:10 +00:00
|
|
|
|
" au VimEnter * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
|
2016-11-03 10:36:16 +00:00
|
|
|
|
" au VimLeave * !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock'
|
2016-11-03 09:08:32 +00:00
|
|
|
|
|
2016-11-04 09:20:16 +00:00
|
|
|
|
" moves
|
|
|
|
|
nmap K <C-u>
|
|
|
|
|
nmap J <C-d>
|
|
|
|
|
" speed up
|
|
|
|
|
" edit .vimrc
|
|
|
|
|
nmap <Leader>v :vs ~/.vimrc<Cr>
|
2018-06-07 17:04:55 +00:00
|
|
|
|
imap <Leader>v <Esc>:vs ~/.vimrc<Cr>i
|
|
|
|
|
" source .vimrc
|
|
|
|
|
nmap <Leader>V :source ~/.vimrc<Cr>
|
2016-11-23 10:08:08 +00:00
|
|
|
|
" quick save
|
2017-02-24 15:04:31 +00:00
|
|
|
|
imap <Leader>s <Esc>:w<Cr>i
|
2016-11-23 10:08:08 +00:00
|
|
|
|
nmap <Leader>s :w<Cr>
|
2018-06-07 17:04:55 +00:00
|
|
|
|
" html + php
|
|
|
|
|
nmap <Leader>h :set ft=html<Cr>
|
2019-01-10 14:37:01 +00:00
|
|
|
|
imap <Leader>h <esc>:set ft=html<Cr>i
|
2018-06-07 17:04:55 +00:00
|
|
|
|
nmap <Leader>p :set ft=php<Cr>
|
2019-01-10 14:37:01 +00:00
|
|
|
|
imap <Leader>p <esc>:set ft=php<Cr>i
|
2019-01-22 16:00:52 +00:00
|
|
|
|
" make
|
2019-01-25 10:50:10 +00:00
|
|
|
|
nmap <Leader>m :w<cr>:!clear<cr>:make<cr>
|
|
|
|
|
imap <Leader>m <esc>:w<cr>:!clear<cr>:make<cr>
|
2018-06-07 17:04:55 +00:00
|
|
|
|
|
2018-06-01 13:22:50 +00:00
|
|
|
|
|
|
|
|
|
" vim-table-mode
|
|
|
|
|
" :TableModeToggle pour activer/deactiver
|
|
|
|
|
" table cpmatible rst
|
2018-06-07 17:04:55 +00:00
|
|
|
|
" racourcis:
|
|
|
|
|
" visual + :Tableize pour transformer csv (avec ,) en table
|
2018-06-01 13:22:50 +00:00
|
|
|
|
let g:table_mode_corner_corner='+'
|
|
|
|
|
let g:table_mode_header_fillchar='='
|
|
|
|
|
nmap <Leader>tm <Esc>:TableModeToggle<cr>
|
|
|
|
|
imap <Leader>tm <Esc>:TableModeToggle<cr>i
|
|
|
|
|
|