Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
utilisateurs:hypathie:tutos:vim-ide-python [09/12/2015 22:46] Hypathie [Installer VIM IDE pour python] |
utilisateurs:hypathie:tutos:vim-ide-python [15/01/2016 09:50] Hypathie [Installer VIM IDE pour python 3] |
||
---|---|---|---|
Ligne 5: | Ligne 5: | ||
* Commentaires : //Contexte d'utilisation du sujet du tuto. // FIXME | * Commentaires : //Contexte d'utilisation du sujet du tuto. // FIXME | ||
* Débutant, à savoir : [[:doc:systeme:commandes:le_debianiste_qui_papillonne|Utiliser GNU/Linux en ligne de commande, tout commence là !.]] :-) | * Débutant, à savoir : [[:doc:systeme:commandes:le_debianiste_qui_papillonne|Utiliser GNU/Linux en ligne de commande, tout commence là !.]] :-) | ||
+ | * Références : \\ https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source \\ https://github.com/thesheff17/youtube/blob/master/vim/vim_notes.txt | ||
- | ===== Installer VIM IDE pour python ===== | + | ===== Installer VIM IDE pour python 3===== |
- | ===On supprime les versions vim existantes sur le système== | ||
- | * En effet, | + | ====Introduction ==== |
+ | * Si vim est déjà installé il n'est peut être pas configuré avec un interpréteur pour python ou python 3 : | ||
<code user> | <code user> | ||
- | vim --version | + | vim --version | grep python |
</code> | </code> | ||
- | <code retour>VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:36:07) | + | <code retour>+cryptv +linebreak -python +viminfo |
- | Rustines incluses : 1-488, 576 | + | +cscope +lispindent -python3 +vreplace</code> |
- | Modifié par pkg-vim-maintainers@lists.alioth.debian.org | + | |
- | Compilé par jamessan@debian.org | + | => ''-python -python3'' :-/ |
- | Énorme version avec interface graphique GTK2. | + | |
- | Fonctionnalités incluses (+) ou non (-) : | + | * Si l'on veut repartir à neuf : |
- | +acl +farsi +mouse_netterm +syntax | + | |
- | +arabic +file_in_path +mouse_sgr +tag_binary | + | <code root>dpkg --status vim</code> |
- | +autocmd +find_in_path -mouse_sysmouse +tag_old_static | + | <code retour> |
- | +balloon_eval +float +mouse_urxvt -tag_any_white | + | Package: vim |
- | +browse +folding +mouse_xterm +tcl | + | Status: install ok installed |
- | ++builtin_terms -footer +multi_byte +terminfo | + | Priority: optional |
- | +byte_offset +fork() +multi_lang +termresponse | + | Section: editors |
- | +cindent +gettext -mzscheme +textobjects | + | Installed-Size: 2233 |
- | +clientserver -hangul_input +netbeans_intg +title | + | Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> |
- | +clipboard +iconv +path_extra +toolbar | + | Architecture: amd64 |
- | +cmdline_compl +insert_expand +perl +user_commands | + | Version: 2:7.4.488-7 |
- | +cmdline_hist +jumplist +persistent_undo +vertsplit | + | Provides: editor |
- | +cmdline_info +keymap +postscript +virtualedit | + | Depends: vim-common (= 2:7.4.488-7), vim-runtime (= 2:7.4.488-7), libacl1 (>= 2.2.51-8), libc6 (>= 2.15), libgpm2 (>= 1.20.4), libselinux1 (>= 1.32), libtinfo5 |
- | +comments +langmap +printer +visual | + | Suggests: ctags, vim-doc, vim-scripts |
- | +conceal +libcall +profile +visualextra | + | Description: Vi IMproved - enhanced vi editor |
- | +cryptv +linebreak +python +viminfo | + | Vim is an almost compatible version of the UNIX editor Vi. |
- | +cscope +lispindent -python3 +vreplace | + | <...> |
</code> | </code> | ||
- | => ''+python -python3'' :-/ | + | On supprime la version installée et ses dépendances |
- | <code root>apt-get remove vim vim-runtime gvim vim-tiny vim-common vim-gui-common</code> | + | <code root>apt-get remove vim vim-common vim-runtime</code> |
- | ===On récupère vim à la source et on le compile avec l'option python3=== | ||
- | <code root>cd ~</code> | + | * Sur un système Jessie tout neuf la commande : ''apt-get install vim'' |
- | <code root>hg clone https://code.google.com/p/vim/</code> | + | |
- | <code root>cd vim</code> | + | |
- | <code root>./configure --with-features=huge \ | + | |
- | --enable-multibyte \ | + | |
- | --enable-rubyinterp \ | + | |
- | --enable-python3interp vi_cv_path_python3=/usr/bin/python3.4 \ | + | |
- | --with-python-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu \ | + | |
- | --enable-perlinterp \ | + | |
- | --enable-luainterp \ | + | |
- | --enable-gui=gtk2 --enable-cscope --prefix=/usr</code> | + | |
- | <code root>make VIMRUNTIMEDIR=/usr/share/vim/vim74</code> | + | |
- | <code root>apt-get install checkinstall</code> | + | |
- | <code root>checkinstall</code> | + | |
- | <code retour>********************************************************************** | + | installera les paquets ''vim-doc'' et ''vim-scripts''. Il est suggéré d'installer aussi ''vim-common'' et ''vim-runtime''... |
- | Done. The new package has been installed and saved to | + | Allons-y : |
- | /root/vim/vim_20151209-1_amd64.deb | + | <code root>apt-get install vim vim-common vim-runtime</code> |
- | You can remove it from your system anytime using: | ||
- | dpkg -r vim | ||
- | **********************************************************************</code> | + | === Reconfiguration de vim === |
- | <note> | + | Pour utiliser vim avec python3 : |
- | **Et maintenant ''vim --version'' retourne ''-python +python3 ''** 8-) | + | |
- | </note> | + | * on installe pour ce qui concerne python 3 : |
+ | |||
+ | <code root>apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \ | ||
+ | libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \ | ||
+ | libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \ | ||
+ | ruby-dev mercurial</code> | ||
+ | |||
+ | * Pour ce concerne la configuration de vim : | ||
+ | |||
+ | <code root>apt-get install devscripts</code> | ||
+ | |||
+ | |||
+ | * Changer les options de vim | ||
+ | |||
+ | On crée un répertoire où travailler : | ||
+ | |||
+ | <code user>mkdir temp && cd temp</code> | ||
- | ===On fait de vim son éditeur par défaut=== | + | On recupère les sources : |
- | <code root>update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1</code> | + | <code user>apt-get source vim</code> |
- | <code root>update-alternatives --set editor /usr/bin/vim</code> | + | |
- | <code root>update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1</code> | + | |
- | <code root>update-alternatives --set vi /usr/bin/vim</code> | + | |
- | ===Configurer vim=== | + | Ce qui donne : |
+ | |||
+ | <code user>ls</code> | ||
+ | |||
+ | <code retour>vim-7.4.488 vim_7.4.488-7.debian.tar.xz vim_7.4.488-7.dsc vim_7.4.488.orig.tar.gz</code> | ||
+ | |||
+ | On se déplace dans le dossier ''vim-7.4.488'' : | ||
+ | |||
+ | <code user>cd vim-7.4.488</code> | ||
+ | |||
+ | * Pour reconstruire vim | ||
+ | |||
+ | D'abord on installer toutes les dépendances nécessaires à la reconstruction du paquet : | ||
+ | |||
+ | <code root>apt-get build-dep vim</code> | ||
+ | |||
+ | Dans ce répertoire ''vim-7.4.488'' il y a le répertoire ''debian'' : | ||
+ | |||
+ | <code user>ls</code> | ||
+ | <code retour> | ||
+ | configure Filelist README_amibin.txt.info README_dos.txt README_srcdos.txt README_w32s.txt vimdir.info | ||
+ | Contents libs README_amisrc.txt README_extra.txt README_src.txt runtime Vim.info | ||
+ | Contents.info Makefile README_amisrc.txt.info README_mac.txt README.txt runtime.info vimtutor.bat | ||
+ | csdpmi4b.zip nsis README_ami.txt README_ole.txt README.txt.info src vimtutor.com | ||
+ | debian pixmaps README_ami.txt.info README_os2.txt README_unix.txt src.info Xxd.info | ||
+ | farsi README_amibin.txt README_bindos.txt README_os390.txt README_vms.txt uninstal.txt | ||
+ | </code> | ||
+ | |||
+ | Et dans ce répertoire ''debian'' il y a un fichier ''rules'' : | ||
+ | |||
+ | <code user>ls -la debian/rules</code> | ||
+ | |||
+ | <code retour>-rwxr-xr-x 1 hypathie hypathie 18825 mars 21 2015 rules</code> | ||
+ | |||
+ | Puis on édite rules pour obtenir les lignes suivantes : | ||
+ | |||
+ | <code user>vim rules</code> | ||
+ | |||
+ | <code>ALLINTERPFLAGS+=--enable-python3interp --with-python3-config-dir=$(shell python3-config --configdir)</code> | ||
+ | |||
+ | On choisit son éditeur par défaut et on lui ajoute sa touche personnelle : | ||
+ | |||
+ | <code user>dch -i</code> | ||
+ | Par exemple : | ||
+ | <code> | ||
+ | vim (2:7.4.488-7.1) UNRELEASED; urgency=medium | ||
+ | * Non-maintainer upload. | ||
+ | * vim_python3 | ||
+ | </code> | ||
+ | |||
+ | Enfin on reconstruit le paquet : | ||
+ | |||
+ | <code root>debuild binary</code> | ||
+ | |||
+ | Il fait ses tests ;-) ... | ||
+ | |||
+ | Et voilà ! | ||
+ | |||
+ | <code user>vim --version</code> | ||
+ | <code retour></code> | ||
+ | |||
+ | |||
+ | ====vim IDE pour python 3==== | ||
+ | |||
+ | * On installe git | ||
+ | <code root>apt-get install git</code> | ||
* On télécharge ce script | * On télécharge ce script | ||
Ligne 134: | Ligne 197: | ||
<code root>./vim.py -u root</code> | <code root>./vim.py -u root</code> | ||
<note tip> | <note tip> | ||
+ | Et pour supprimer cette configuration de vim utiliser en tant que root : | ||
+ | |||
<code root>cd ~ && rm -rf ~/.vim/ && rm -r ~/.vimrc</code> | <code root>cd ~ && rm -rf ~/.vim/ && rm -r ~/.vimrc</code> | ||
</note> | </note> | ||
- | =====Configurer Vim pour Python ===== | + | =====Utilisations===== |
- | * On installe curl | ||
- | |||
- | <code root>apt-get install curl</code> | ||
- | |||
- | * On installe git : | ||
- | |||
- | <code root>apt-get install git-core</code> | ||
- | |||
- | * On installe pathogen | ||
- | |||
- | Voir : https://github.com/search?utf8=%E2%9C%93&q=pathogen | ||
- | |||
- | <code user> | ||
- | mkdir -p ~/.vim/autoload ~/.vim/bundle && \ | ||
- | curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim | ||
- | </code> | ||
- | |||
- | * On crée et édite un fichier caché ~/.vimrc : | ||
- | |||
- | <code user>vim ~/.vimrc</code> | ||
- | |||
- | <file> | ||
- | execute pathogen#infect() | ||
- | syntax on | ||
- | filetype plugin indent on | ||
- | </file> | ||
- | |||
- | pathogen va chercher dans le répertoire bundle les plugin qu'on lui a installé et les utiliser comme si on les avait installé dans le fichier .vimrc | ||
- | |||
- | * On installe le module nerdtree : | ||
- | |||
- | Voir : https://github.com/scrooloose/nerdtree | ||
- | |||
- | <code user>git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree</code> | ||
- | |||
- | <note tip> | ||
- | ** | ||
- | Principales commandes de NERD Tree :** | ||
- | |||
- | |||
- | t: Ouvrir le fichier sélectionné dans un nouvel onglet | ||
- | i: Ouvrez le fichier sélectionné dans une fenêtre fissure verticale | ||
- | s: Open the selected file in a vertical split window | ||
- | I: Commutation de fichiers cachés | ||
- | m: Pour faire apparaître un menu qui vous permettra d'ajouter rapidement, déplacer(=renomer), copier et supprimer des nœuds (ou fichiers). | ||
- | R: Actualiser l'arbre, utile si les fichiers ont changés en dehors de Vim | ||
- | ?: Commutation entre l'aide rapide et l'explorateur NERD Tree | ||
- | Ctrl +w puis w: Passer de l'explorateur NERD Tree à la fenêtre d'édition des fichiers | ||
- | |||
- | </note> | ||
- | |||
- | * On installe vim-airLine améliorer le statusline. | ||
- | |||
- | <code user>git clone https://github.com/bling/vim-airline.git ~/.vim/bundle/vim-airline</code> | ||
- | |||
- | On ajoute la ligne suivante dans ''~./vimrc'' : | ||
- | |||
- | <code>let g:airline#extensions#tabline#enabled = 1</code> | ||
- | |||
- | <note tip> | ||
- | * Après avoir ouvert plusieurs fichiers, pour passer d'un fichier à l'autre, le curseur entant placé dans l'encadré d'édition d'un fichier: | ||
- | |||
- | - On peut utiliser la commande vim '':register'' puis on choisit son buffer ; | ||
- | - On peut faire '':bn'' (pour Buffer Next) ou '':bp'' (pour Buffer Prevous) ; | ||
- | |||
- | * On peut se faire un racourcit : | ||
- | |||
- | - On édite ''~/.vimrc'' | ||
- | - on ajoute : | ||
- | |||
- | <code> | ||
- | nmap <C-n> :bn<CR> | ||
- | nmap <C-p> :bp<CR> | ||
- | </code> | ||
- | |||
- | * Pour utiliser la souris | ||
- | |||
- | <code> | ||
- | set mouse=a | ||
- | </code> | ||
- | </note> | ||
- | |||
- | |||
- | * Utilisation de la souris pour naviger entre les fenêtres, et sélectionner dans une seule fenêtre (i.e mode visuel de vim) | ||
- | |||
- | On édite ''~/.vimrc'' | ||
- | |||
- | On ajoute : | ||
- | <file> | ||
- | set mouse=a | ||
- | </file> | ||
- | |||
- | * On ajoute le plugin syntastic | ||
- | |||
- | Voir : https://github.com/scrooloose/syntastic | ||
- | |||
- | <code user>git clone https://github.com/scrooloose/syntastic.git ~/.vim/bundle/syntastic</code> | ||
- | |||
- | * On ajoute le plugin tagbar | ||
- | |||
- | <code user>git clone https://github.com/majutsushi/tagbar.git ~/.vim/bundle/tagbar</code> | ||
- | |||
- | <note tip> | ||
- | Ajout dans '' ~/.vimrc '' | ||
- | <code> | ||
- | "Racourci clavier pour basculer avec Tagbar | ||
- | nmap <F2> :TagbarToggle<CR> | ||
- | </code> | ||
- | </note> | ||
- | |||
- | |||
- | * Ajout de l'autocomplétion : | ||
- | <note tip> | ||
- | Ajout dans '' ~/.vimrc '' | ||
- | <code> | ||
- | "Pour utiliser un plugin d'autocomplétion | ||
- | set omnifunc=syntaxComplet#Complete | ||
- | </code> | ||
- | </note> | ||
===== VIM IDE DJANGO ===== | ===== VIM IDE DJANGO ===== | ||