Advertisement
Guest User

Untitled

a guest
Nov 27th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 10.14 KB | None | 0 0
  1. "Pour la gestion des plugins avec vundle
  2. "crée un dossier vundle dans le .vim, permet de ne pas tout éparpiller.
  3. "ATTENTION: mettre tous les plugins à installer ici
  4. "http://hobbestigrou.interface-c.com/articles/gestion_plugin_vim_avec_vundle
  5.  
  6. set nocompatible              " be iMproved, required
  7. filetype off                  " required
  8.  
  9. " set the runtime path to include Vundle and initialize
  10. set rtp+=~/.vim/bundle/Vundle.vim
  11. call vundle#begin()
  12.  
  13. " let Vundle manage Vundle, required
  14. Plugin 'gmarik/Vundle.vim'
  15.  
  16. "Nerdtree, pr voir hiérarchie des files
  17. Plugin 'scrooloose/nerdtree'
  18. "Améliore autocomplétion
  19. Plugin 'ervandew/supertab'
  20. "Avoir les tags ds un dock
  21. Plugin 'taglist.vim'
  22. " Commenter ac des raccourcis clavier
  23. Plugin 'comments.vim'  
  24. " Redéfinir un vimrc dans un dossier
  25. Plugin 'LucHermitte/lh-vim-lib'
  26. Plugin 'LucHermitte/local_vimrc'
  27. "
  28. " Les snippets persos + fournis
  29. Plugin 'garbas/vim-snipmate'
  30. Plugin 'MarcWeber/vim-addon-mw-utils'
  31. Plugin 'tomtom/tlib_vim'
  32. Plugin 'honza/vim-snippets'
  33.  
  34. " Sélectionner des blocs indentés (python)
  35. Plugin 'vim-indent-object'
  36. "" Plugin pr Arduino
  37. "Plugin 'stevearc/vim-arduino'
  38. " Syntax Arduino
  39. Plugin 'vim-scripts/Arduino-syntax-file'
  40. "Markdown syntax
  41. Plugin 'plasticboy/vim-markdown'
  42. "Python linter
  43. Plugin 'scrooloose/syntastic'
  44. "Colorise les codes couleurs hexadécimaux
  45. Plugin 'vim-scripts/colorizer'
  46. "Pour incrémenter/décrémenter/inverser une valeur
  47. Plugin 'vim-scripts/nextval'
  48. "Pour aligner facilement
  49. Plugin 'junegunn/vim-easy-align'
  50. "Curseurs multiples
  51. Plugin 'terryma/vim-multiple-cursors'
  52. "Openscad syntax
  53. Plugin 'vim-scripts/openscad.vim'
  54. "Async completion
  55. Plugin 'maralla/completor.vim'
  56. "Syntax highlighting for Python (better than default)
  57. Plugin 'vim-python/python-syntax'
  58. "Black code formatter for Python
  59. Plugin 'ambv/black'
  60. "Auto docstring in Python
  61. Plugin 'heavenshell/vim-pydocstring'
  62. "Rust syntax
  63. Plugin 'rust-lang/rust.vim'
  64.  
  65. "Activate all syntax highlighting for Python
  66. let g:python_highlight_all = 1
  67.  
  68. "Don't highlight self and cls
  69. let g:python_highlight_class_vars = 0
  70.  
  71. "Supertab completion from top to bottom
  72. let g:SuperTabDefaultCompletionType = "<c-n>"
  73.  
  74. "Réglages linter flake8 pour python
  75. let g:syntastic_python_checkers=['flake8', 'mypy']
  76. let g:syntastic_python_flake8_args='--ignore=E303,F405'
  77. let g:syntastic_python_flake8_args='--max-line-length=88'
  78. "let g:syntastic_python_checkers=['flake8', 'pylint']
  79. "let g:syntastic_python_pylint_args='-d C0103,R0902,W0621,W0201'
  80. "All checkers together
  81. let g:syntastic_aggregate_errors = 1
  82.  
  83. "All of your Plugins must be added before the following line
  84. call vundle#end()            " required
  85. filetype plugin indent on    " required
  86.  
  87. call lh#local_vimrc#munge('whitelist', '/home/djipey/')
  88.  
  89. "On remappe les touches du plugin nextval. C'est mieux
  90. "d'utiliser le stouches + et -
  91. nmap <silent> <unique> + <Plug>nextvalInc
  92. nmap <silent> <unique> - <Plug>nextvalDec
  93.  
  94. "----------------- Partie Plugins terminée -----------------------
  95.  
  96. " Vim5 and later versions support syntax highlighting. Uncommenting the next
  97. " line enables syntax highlighting by default.
  98. syntax on
  99. filetype plugin indent on
  100.  
  101. " If using a dark background within the editing area and syntax highlighting
  102. " turn on this option as well
  103. set background=dark
  104.  
  105. " Uncomment the following to have Vim jump to the last position when
  106. " reopening a file
  107. au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  108.  
  109. "Actions spéciales sur python: template et header
  110. "http://www.thegeekstuff.com/2008/12/vi-and-vim-autocommand-3-steps-to-add-custom-header-to-your-file
  111. autocmd bufnewfile *.py so ~/.vim/templates/python.py
  112.  
  113. " On détecte le type de fichier, et si appartient aux lignes suivantes, utilisation d'un modèle stocké dans .vim/templates
  114. "au bufNewFile *.py 0r ~/.vim/templates/python.py
  115. au bufNewFile *.sh 0r ~/.vim/templates/bash.sh
  116. au bufNewFile *.tex 0r ~/.vim/templates/latex.tex
  117.  
  118. au BufRead,BufNewFile *.scad set filetype=openscad
  119.  
  120. " Détecte les conkyrc
  121. au BufNewFile,BufRead *conkyrc* set filetype=conkyrc
  122.  
  123. " Détecte les fichiers Arduino
  124. au BufRead,BufNewFile *.pde set filetype=arduino
  125. au BufRead,BufNewFile *.ino set filetype=arduino
  126. let g:vim_arduino_library_path = "/usr/share/arduino"
  127. let g:vim_arduino_serial_port = "/dev/ttyACM0"
  128.  
  129. "Restore l'état des folders (code folding)
  130. "https://ubuntuforums.org/showthread.php?t=1639591
  131. au BufWinLeave ?* mkview
  132. au BufWinEnter ?* silent loadview
  133.  
  134. " On active l'historique
  135. set backup
  136. set backupdir=~/.vim/backup/
  137.  
  138. " On active ctags, qui récupère les variables et les fonctions du fichier de
  139. " code. On l'active pour être utilisé avec TagList.
  140. let Tlist_Ctags_Cmd = "/usr/local/bin/ctags"
  141. let tlist_python_settings = 'python;c:class;f:function;m:member;v:variable;i:import'
  142. "
  143. " Donne le focus à TagList à l'ouverture
  144. let Tlist_GainFocus_On_ToggleOpen = 1 "automatically switch to taglist window
  145. let Tlist_Close_On_Select = 1 "close taglist window once we selected something
  146. let Tlist_Exit_OnlyWindow = 1 "if taglist window is the only window left, exit vim
  147.  
  148. " Petit hack permettant de copier/coller de et vers Vim avec Ctrl+C et Ctrl+V.
  149. " Trouvé sur http://forum.ubuntu-fr.org/viewtopic.php?id=295612
  150. " On ubuntu (running Vim in gnome-terminal)
  151. " " The reason for the double-command on <C-c> is due to some weirdness with
  152. " the X clipboard system.
  153. vmap <C-c> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR>
  154. map <C-v> :call setreg("\"",system("xclip -o -selection clipboard"))<CR>
  155.  
  156. let mapleader = ","
  157.  
  158. " Start interactive EasyAlign in visual mode (e.g. vipga)
  159.  xmap ga <Plug>(EasyAlign)
  160. " Start interactive EasyAlign for a motion/text object (e.g. gaip)
  161.  nmap ga <Plug>(EasyAlign)
  162.  
  163. "Petit fix pr que entrée ne fasse que sélectionner la suggestion de
  164. "l'autocompletion. Sans ça, la suggestion est insérée, ainsi q'un retour
  165. "chariot
  166. "http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE
  167. inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
  168.  
  169. " On remappe la touche F9 pr activer/désactiver paste.
  170. " Activé, ça garde l'indention lors d'un copier/coller, mais désactive
  171. " l'autocomplétion intelligente
  172. map <F9> :set paste!<CR>
  173.  
  174. " On remape la touche F8 pour mettre à jour les plugins installés
  175. " manuellement
  176. map <F8> :BundleInstall!<CR>
  177. "
  178. "On remape la touche F7 pour activer/désactiver l'auto-correction
  179. nmap <F7> :set spell!<CR>
  180.  
  181. " On remape F2 pour splitter l'écran verticalement
  182. nmap <F2> :vsp<CR>
  183.  
  184. " On remape F3 pour avoir la liste des tags
  185. nmap <F3> :TlistToggle<cr>
  186. "
  187. "Add a blank line w/o insert mode, stay on current line
  188. nnoremap <Enter> :call append(line('.'), '')<CR>
  189.  
  190. " On remape F4 pour toggle Nertree
  191. "map <F4> :NERDTreeToggle<CR>
  192.  
  193. "Open a terminal in a vertical split with F4
  194. fu! OpenTerminal()
  195. " open split windows on the topleft
  196. vert bo split
  197. :call term_start('zsh', {'curwin' : 1, 'term_finish' : 'close'})
  198. endf
  199. nnoremap <F4> :call OpenTerminal()<cr>
  200.  
  201. set encoding=utf-8  " The encoding displayed.
  202. set fileencoding=utf-8  " The encoding written to file.
  203.  
  204. " The following are commented out as they cause vim to behave a lot
  205. " differently from regular Vi. They are highly recommended though.
  206. set showcmd     " Show (partial) command in status line.
  207. set ignorecase      " Do case insensitive matching
  208. set smartcase       " Do smart case matching
  209. set incsearch       " Incremental search: bouge l'écran sur les matches dés
  210.                     " qu'on tape. Nul.
  211. set hidden          " Hide buffers when they are abandoned
  212. set mouse=a         " Enable mouse usage (all modes)
  213. set confirm         " Active une confirmation si on quitte sans sauver
  214.  
  215.  
  216. " Ajouté par djipey
  217. colorscheme molokai   " On définit ici le thème de vim. Les fichiers sont dans .vim/colors/
  218. set t_Co=256          " On passe le terminal en 256 couleurs pour pouvoir utiliser les thèmes de coloration de vim
  219. set spelllang=fr,en      " On définit la langue pour la correction orthographique
  220. set spellsuggest =5     " 5 suggestions seulement lors de la correciton orthographique
  221. "set spell             " On active la correction orthographique par défaut. :set nospell pour la désactiver.:set nospell
  222.  
  223. set laststatus=2      " Afficher la barre d'état
  224. :set statusline=%f\ (x,y)=(%3v;%3l)\ [tot.lignes=%L]\ [%p%%]
  225.  
  226. set number            " Afficher le numéro de ligne
  227. set ruler             " Afficher la position du curseur
  228. set hlsearch          " Met en surbrillance les termes trouvés lors d'une recherche
  229. set autoindent        " Pour garder l'indention quand on passe à la ligne
  230. set smartindent       " Indention intelligente
  231. set noscrollbind      " Désolidarise le défilement lorsque l'écran est splitté
  232. set nocursorbind
  233.  
  234. " Colore la ligne et la colonne courante
  235. set cursorline
  236. set cursorcolumn
  237.  
  238. "Split vim below
  239. set splitbelow
  240.  
  241. set tabstop=4  
  242. set softtabstop=4
  243. set shiftwidth=4
  244. set expandtab
  245. set so=3                " toujours 3 lignes à partir du début
  246. set siso=2              " toujours 2 lignes avant la fin
  247. set title               " affiche le titre dans la barre de titre du term
  248.  
  249. " On active l'enregistrement automatique
  250. 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.
  251.  
  252. "On enregistre dès que vim perd le focus
  253. autocmd BufLeave,FocusLost,TabLeave * silent! wall
  254.  
  255.  
  256. " Les replis se font sur l'indention
  257. set foldmethod=indent
  258.  
  259. "Specific to Mac
  260. set clipboard=unnamed
  261. set backspace=eol,start,indent
  262.  
  263. " Set the title of the Terminal to the currently open file
  264. function! SetTerminalTitle()
  265.     let titleString = expand('%:t')
  266.     if len(titleString) > 0
  267.         let &titlestring = expand('%:t')
  268.         " this is the format iTerm2 expects when setting the window title
  269.         let args = "\033];".&titlestring."\007"
  270.         let cmd = 'silent !echo -e "'.args.'"'
  271.         execute cmd
  272.         redraw!
  273.     endif
  274. endfunction
  275.  
  276. autocmd BufEnter * call SetTerminalTitle()
  277.  
  278. "Better scrolling perf on mac
  279. set regexpengine=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement