Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "Pour la gestion des plugins avec vundle
- "crée un dossier vundle dans le .vim, permet de ne pas tout éparpiller.
- "ATTENTION: mettre tous les plugins à installer ici
- "http://hobbestigrou.interface-c.com/articles/gestion_plugin_vim_avec_vundle
- set nocompatible " be iMproved, required
- 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 'gmarik/Vundle.vim'
- "Nerdtree, pr voir hiérarchie des files
- Plugin 'scrooloose/nerdtree'
- "Améliore autocomplétion
- Plugin 'ervandew/supertab'
- "Avoir les tags ds un dock
- Plugin 'taglist.vim'
- " Commenter ac des raccourcis clavier
- Plugin 'comments.vim'
- " Redéfinir un vimrc dans un dossier
- Plugin 'LucHermitte/lh-vim-lib'
- Plugin 'LucHermitte/local_vimrc'
- "
- " Les snippets persos + fournis
- Plugin 'garbas/vim-snipmate'
- Plugin 'MarcWeber/vim-addon-mw-utils'
- Plugin 'tomtom/tlib_vim'
- Plugin 'honza/vim-snippets'
- " Sélectionner des blocs indentés (python)
- Plugin 'vim-indent-object'
- "" Plugin pr Arduino
- "Plugin 'stevearc/vim-arduino'
- " Syntax Arduino
- Plugin 'vim-scripts/Arduino-syntax-file'
- "Markdown syntax
- Plugin 'plasticboy/vim-markdown'
- "Python linter
- Plugin 'scrooloose/syntastic'
- "Colorise les codes couleurs hexadécimaux
- Plugin 'vim-scripts/colorizer'
- "Pour incrémenter/décrémenter/inverser une valeur
- Plugin 'vim-scripts/nextval'
- "Pour aligner facilement
- Plugin 'junegunn/vim-easy-align'
- "Curseurs multiples
- Plugin 'terryma/vim-multiple-cursors'
- "Openscad syntax
- Plugin 'vim-scripts/openscad.vim'
- "Async completion
- Plugin 'maralla/completor.vim'
- "Syntax highlighting for Python (better than default)
- Plugin 'vim-python/python-syntax'
- "Black code formatter for Python
- Plugin 'ambv/black'
- "Auto docstring in Python
- Plugin 'heavenshell/vim-pydocstring'
- "Rust syntax
- Plugin 'rust-lang/rust.vim'
- "Activate all syntax highlighting for Python
- let g:python_highlight_all = 1
- "Don't highlight self and cls
- let g:python_highlight_class_vars = 0
- "Supertab completion from top to bottom
- let g:SuperTabDefaultCompletionType = "<c-n>"
- "Réglages linter flake8 pour python
- let g:syntastic_python_checkers=['flake8', 'mypy']
- let g:syntastic_python_flake8_args='--ignore=E303,F405'
- let g:syntastic_python_flake8_args='--max-line-length=88'
- "let g:syntastic_python_checkers=['flake8', 'pylint']
- "let g:syntastic_python_pylint_args='-d C0103,R0902,W0621,W0201'
- "All checkers together
- let g:syntastic_aggregate_errors = 1
- "All of your Plugins must be added before the following line
- call vundle#end() " required
- filetype plugin indent on " required
- call lh#local_vimrc#munge('whitelist', '/home/djipey/')
- "On remappe les touches du plugin nextval. C'est mieux
- "d'utiliser le stouches + et -
- nmap <silent> <unique> + <Plug>nextvalInc
- nmap <silent> <unique> - <Plug>nextvalDec
- "----------------- Partie Plugins terminée -----------------------
- " Vim5 and later versions support syntax highlighting. Uncommenting the next
- " line enables syntax highlighting by default.
- syntax on
- filetype plugin indent on
- " If using a dark background within the editing area and syntax highlighting
- " turn on this option as well
- set background=dark
- " Uncomment the following to have Vim jump to the last position when
- " reopening a file
- au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
- "Actions spéciales sur python: template et header
- "http://www.thegeekstuff.com/2008/12/vi-and-vim-autocommand-3-steps-to-add-custom-header-to-your-file
- autocmd bufnewfile *.py so ~/.vim/templates/python.py
- " On détecte le type de fichier, et si appartient aux lignes suivantes, utilisation d'un modèle stocké dans .vim/templates
- "au bufNewFile *.py 0r ~/.vim/templates/python.py
- au bufNewFile *.sh 0r ~/.vim/templates/bash.sh
- au bufNewFile *.tex 0r ~/.vim/templates/latex.tex
- au BufRead,BufNewFile *.scad set filetype=openscad
- " Détecte les conkyrc
- au BufNewFile,BufRead *conkyrc* set filetype=conkyrc
- " Détecte les fichiers Arduino
- au BufRead,BufNewFile *.pde set filetype=arduino
- au BufRead,BufNewFile *.ino set filetype=arduino
- let g:vim_arduino_library_path = "/usr/share/arduino"
- let g:vim_arduino_serial_port = "/dev/ttyACM0"
- "Restore l'état des folders (code folding)
- "https://ubuntuforums.org/showthread.php?t=1639591
- au BufWinLeave ?* mkview
- au BufWinEnter ?* silent loadview
- " On active l'historique
- set backup
- set backupdir=~/.vim/backup/
- " On active ctags, qui récupère les variables et les fonctions du fichier de
- " code. On l'active pour être utilisé avec TagList.
- let Tlist_Ctags_Cmd = "/usr/local/bin/ctags"
- let tlist_python_settings = 'python;c:class;f:function;m:member;v:variable;i:import'
- "
- " Donne le focus à TagList à l'ouverture
- let Tlist_GainFocus_On_ToggleOpen = 1 "automatically switch to taglist window
- let Tlist_Close_On_Select = 1 "close taglist window once we selected something
- let Tlist_Exit_OnlyWindow = 1 "if taglist window is the only window left, exit vim
- " Petit hack permettant de copier/coller de et vers Vim avec Ctrl+C et Ctrl+V.
- " Trouvé sur http://forum.ubuntu-fr.org/viewtopic.php?id=295612
- " On ubuntu (running Vim in gnome-terminal)
- " " The reason for the double-command on <C-c> is due to some weirdness with
- " the X clipboard system.
- vmap <C-c> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR>
- map <C-v> :call setreg("\"",system("xclip -o -selection clipboard"))<CR>
- let mapleader = ","
- " Start interactive EasyAlign in visual mode (e.g. vipga)
- xmap ga <Plug>(EasyAlign)
- " Start interactive EasyAlign for a motion/text object (e.g. gaip)
- nmap ga <Plug>(EasyAlign)
- "Petit fix pr que entrée ne fasse que sélectionner la suggestion de
- "l'autocompletion. Sans ça, la suggestion est insérée, ainsi q'un retour
- "chariot
- "http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE
- inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
- " On remappe la touche F9 pr activer/désactiver paste.
- " Activé, ça garde l'indention lors d'un copier/coller, mais désactive
- " l'autocomplétion intelligente
- map <F9> :set paste!<CR>
- " On remape la touche F8 pour mettre à jour les plugins installés
- " manuellement
- map <F8> :BundleInstall!<CR>
- "
- "On remape la touche F7 pour activer/désactiver l'auto-correction
- nmap <F7> :set spell!<CR>
- " On remape F2 pour splitter l'écran verticalement
- nmap <F2> :vsp<CR>
- " On remape F3 pour avoir la liste des tags
- nmap <F3> :TlistToggle<cr>
- "
- "Add a blank line w/o insert mode, stay on current line
- nnoremap <Enter> :call append(line('.'), '')<CR>
- " On remape F4 pour toggle Nertree
- "map <F4> :NERDTreeToggle<CR>
- "Open a terminal in a vertical split with F4
- fu! OpenTerminal()
- " open split windows on the topleft
- vert bo split
- :call term_start('zsh', {'curwin' : 1, 'term_finish' : 'close'})
- endf
- nnoremap <F4> :call OpenTerminal()<cr>
- set encoding=utf-8 " The encoding displayed.
- set fileencoding=utf-8 " The encoding written to file.
- " The following are commented out as they cause vim to behave a lot
- " differently from regular Vi. They are highly recommended though.
- set showcmd " Show (partial) command in status line.
- set ignorecase " Do case insensitive matching
- set smartcase " Do smart case matching
- set incsearch " Incremental search: bouge l'écran sur les matches dés
- " qu'on tape. Nul.
- set hidden " Hide buffers when they are abandoned
- set mouse=a " Enable mouse usage (all modes)
- set confirm " Active une confirmation si on quitte sans sauver
- " Ajouté par djipey
- colorscheme molokai " On définit ici le thème de vim. Les fichiers sont dans .vim/colors/
- set t_Co=256 " On passe le terminal en 256 couleurs pour pouvoir utiliser les thèmes de coloration de vim
- set spelllang=fr,en " On définit la langue pour la correction orthographique
- set spellsuggest =5 " 5 suggestions seulement lors de la correciton orthographique
- "set spell " On active la correction orthographique par défaut. :set nospell pour la désactiver.:set nospell
- set laststatus=2 " Afficher la barre d'état
- :set statusline=%f\ (x,y)=(%3v;%3l)\ [tot.lignes=%L]\ [%p%%]
- set number " Afficher le numéro de ligne
- set ruler " Afficher la position du curseur
- set hlsearch " Met en surbrillance les termes trouvés lors d'une recherche
- set autoindent " Pour garder l'indention quand on passe à la ligne
- set smartindent " Indention intelligente
- set noscrollbind " Désolidarise le défilement lorsque l'écran est splitté
- set nocursorbind
- " Colore la ligne et la colonne courante
- set cursorline
- set cursorcolumn
- "Split vim below
- set splitbelow
- set tabstop=4
- set softtabstop=4
- set shiftwidth=4
- set expandtab
- set so=3 " toujours 3 lignes à partir du début
- set siso=2 " toujours 2 lignes avant la fin
- set title " affiche le titre dans la barre de titre du term
- " On active l'enregistrement automatique
- set autowriteall "Comme 'autowrite', mais également utilisé pour les commandes :edit, :quit, :qall, :exit, :xit, :recover et les commandes de fermeture de la fenêtre Vim. Si vous activez cette option, Vim se comportera comme si 'autowrite' était activée.
- "On enregistre dès que vim perd le focus
- autocmd BufLeave,FocusLost,TabLeave * silent! wall
- " Les replis se font sur l'indention
- set foldmethod=indent
- "Specific to Mac
- set clipboard=unnamed
- set backspace=eol,start,indent
- " Set the title of the Terminal to the currently open file
- function! SetTerminalTitle()
- let titleString = expand('%:t')
- if len(titleString) > 0
- let &titlestring = expand('%:t')
- " this is the format iTerm2 expects when setting the window title
- let args = "\033];".&titlestring."\007"
- let cmd = 'silent !echo -e "'.args.'"'
- execute cmd
- redraw!
- endif
- endfunction
- autocmd BufEnter * call SetTerminalTitle()
- "Better scrolling perf on mac
- set regexpengine=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement