From 081da8a840d3b09dc98b7a5b0bb878d906c4be62 Mon Sep 17 00:00:00 2001 From: bastien Date: Sat, 6 Apr 2024 23:33:41 +0200 Subject: [PATCH] Mise a jour du readme + Changement Majeur dans VimsCode --- README-ENG.md | 140 ++++++++++++++++++++++++++++++++++++++ README.md | 117 +++++++++++++++----------------- vimrc-conf | 181 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 346 insertions(+), 92 deletions(-) create mode 100644 README-ENG.md diff --git a/README-ENG.md b/README-ENG.md new file mode 100644 index 0000000..34a01a3 --- /dev/null +++ b/README-ENG.md @@ -0,0 +1,140 @@ +## Table of Contents + +- [Why VimsCode](#why-vimscode) +- [About](#about) +- [Quick Start](#quick-start) +- [Documentation](#documentation) +- [Update](#update) +- [Troubleshooting](#troubleshooting) + +## Why VimsCode + +### VimsCode, it's beautiful : + +To write or edit computer code, program an arduino etc... we use IDE (integrated development environment) +Many very complete graphic software exist to do that like VScode from microsoft or Atom. + +So why not use them ? + +**drawbacks :** + +* They are resource intensive, lots of RAM (~1.3 GB, about 18,000 times more than the Apollo 11 mission that sent the first men to the moon :/ ) +* They are quite difficult to debug because of the large abstraction layers that make them up +* They don't work without a graphical system (through ssh, on a server or a Raspberry Pi) +* It is sometimes difficult to make them do something simple if it was not planned by the developers +* Its frequent updates sometimes impose changes in working habits (new interfaces, new default configuration, new paths etc.) + +So which solution? We suggest you use one of the historical command line text editors (vi, Vim) to make your own IDE :) + +**Advantages :** + +* Lightweight, ~15Kb which is 4.6 x less than Apollo 11 and 83000 times less than VSCODE!!! +* Configurable, you can configure everything in text files from already shared and popular configurations +* Stable, it only evolves without breaking the ergonomic continuity (always the same commands and shortcuts since 1991 for vim and 1976 for vi :) same for the configurations which remain valid since the beginning...) +* Usable through SSH on servers or very light computers (Raspberry Pi, etc.) +* Rock solid, crashes must exist, but I've never even heard of them + +## About + +VimsCode is an IDE with vim for beginner or expert : + +* VimsCode use arduino-cli, idf-esp and platform.io-cli for remplace VScode only in terminal +* Very easy to use +* Very easy to install + +![Example-picture](/pictures/image.png) + +## Quick Start + +### Introduction : + +Installation requires : +``` +sudo apt update +sudo apt install git elinks +``` + +### Set up VimsCode : + + +After clone don't forgot to rename "vimrc-conf" -> ".vimrc" : + +``` +cd Vimscode +chmod +x install.sh +./install.sh +``` + +### Alias : + +When you load vim, you have 1 error with vim-colorschemes, its totally normal, because your vimrc use theme but you dont have load this theme. + +Edit your bashrc or zshrc and copie/paste this ligne at the end : +``` +vim ~/.zshrc or vim ~/.bashrc +alias vimscode="~/.vim/vimscode.sh" +``` + +### Install Plugins : + +Launch `vim` and run `:PluginInstall` + +## Documentation + +### Short-cute VimsCode : + +This short-cute are totally switchable in .vimrc. + +``` +"F2" Shows a vim note +"F3" Shows the tree structure +"F4" Shows the history of changes made +"F5" Shows a terminal at the bottom +"F6" Allows scrolling in the terminal +"F7" Brings up a help site for vim and terminal +"F8" created a new vim tab +"F9" navigate between vim tabs +"c-s" vertical split of the window +"F10" "F10" close vimscode +``` + +* Shortcut in visual mode, when you highlight a word, do a duckduckgo search, on press "g". +* You can change the hight of window with mouse. + +Finally you can run vimscode with this alias : +``` +vimscode -e "file" # for ESP ide +vimscode -a "file" # for Arduino ide +vimscode -p "file" # for platform.io ide +vimscode # help vimscode +``` + +If you want change theme of vimscode, you can just change this line : +``` +colorscheme space-vim-dark +colorscheme cool +colorscheme elda +colorscheme space-vim-dark +colorscheme black_angus +``` +And other theme : [Theme](https://github.com/flazz/vim-colorschemes/tree/master/colors) + + +### More Doc : + +[Documentation](https://projets.cohabit.fr/redmine/projects/accueil/wiki/Documentation_IDE_Vim) + +## Update + +For update it's very simple you juste have to pull and do some mv: + +``` +cd ~/.vim +chmod +x update-vimscode +./update-vimscode +``` + +## Troubleshooting + +For troubleshooting and common problems see [TROUBLESHOOTING](https://git.cohabit.fr/bastien/VimsCode/wiki/Troubleshooting). + diff --git a/README.md b/README.md index eef0560..8b82dda 100644 --- a/README.md +++ b/README.md @@ -1,63 +1,62 @@ -## Table of Contents +## Sommaire -- [Why VimsCode](#why-vimscode) -- [About](#about) -- [Quick Start](#quick-start) +- [Pourquoi VimsCode](#pourquoi-vimscode) +- [A propose](#a-propos) +- [Installation](#installation) - [Documentation](#documentation) -- [Update](#update) -- [Troubleshooting](#troubleshooting) +- [Mise à jour](#mise-a-jour) -## Why VimsCode +## Pourquoi VimsCode -### VimsCode, it's beautiful : +### VimsCode, C'est magnifique : -To write or edit computer code, program an arduino etc... we use IDE (integrated development environment) -Many very complete graphic software exist to do that like VScode from microsoft or Atom. +Pour écrire ou éditer du code informatique, programmer un arduino etc... on utilise des IDE (environnement de développement intégré) +Bien des logiciels graphiques très complets existent pour faire ça comme VScode de microsoft ou Atom. -So why not use them ? +Alors pourquoi pas les utiliser ? Ils ont des inconvénients -**drawbacks :** +**Inconvénients :** -* They are resource intensive, lots of RAM (~1.3 GB, about 18,000 times more than the Apollo 11 mission that sent the first men to the moon :/ ) -* They are quite difficult to debug because of the large abstraction layers that make them up -* They don't work without a graphical system (through ssh, on a server or a Raspberry Pi) -* It is sometimes difficult to make them do something simple if it was not planned by the developers -* Its frequent updates sometimes impose changes in working habits (new interfaces, new default configuration, new paths etc.) +* Ils sont gourmands en ressources, beaucoup de RAM (~1,3 Go, soit environ 18 000 fois plus que la mission Apollo 11 qui a envoyé les premiers hommes sur la lune :/ ) +* Ils ont assez difficiles à déboguer du fait des grandes couches d'abstraction qui les composent +* Ils ne fonctionnent pas sans système graphique (à travers ssh, sur un serveur ou une Raspberry Pi) +* Il est difficile parfois de leur faire faire une chose simple si elle n'a pas été prévue par ses développeurs +* Ses mises à jour fréquentes imposent parfois des changements dans les habitudes de travail (nouvelles interfaces, nouvelle configuration par défaut, nouveaux chemins etc.) -So which solution? We suggest you use one of the historical command line text editors (vi, Vim) to make your own IDE :) +Alors quelle solution ? Nous vous proposons d'utiliser un des éditeurs de texte historiques en ligne de commande (vi, Vim) pour vous faire votre propre IDE :) **Advantages :** -* Lightweight, ~15Kb which is 4.6 x less than Apollo 11 and 83000 times less than VSCODE!!! -* Configurable, you can configure everything in text files from already shared and popular configurations -* Stable, it only evolves without breaking the ergonomic continuity (always the same commands and shortcuts since 1991 for vim and 1976 for vi :) same for the configurations which remain valid since the beginning...) -* Usable through SSH on servers or very light computers (Raspberry Pi, etc.) -* Rock solid, crashes must exist, but I've never even heard of them -## About +* Léger, ~15Ko soit 4,6 x moins qu'Apollo 11 et 83000 fois moins que VSCODE!!! +* Configurable, on peut tout configurer dans des fichiers textes à partir de configurations déjà très partagées et répendues +* Stabilité, il ne fait qu'évoluer sans rompre la continuité ergonomique (toujours les mêmes commandes et raccourcis depuis 1991 pour vim et 1976 pour vi :) de même pour les configurations qui restent valides depuis le début...) +* Utilisable à travers SSH sur des serveurs ou des ordis très légers (Raspberry Pi, etc.) +* Rock solide, les plantages doivent exister, mais je n'en ai jamais même entendu parler -VimsCode is an IDE with vim for beginner or expert : +## A propos de VimsCode -* VimsCode use arduino-cli, idf-esp and platform.io-cli for remplace VScode only in terminal -* Very easy to use -* Very easy to install +VimsCode est un IDE avec vim pour les débutant ou les expert : + +* VimsCode utilise arduino-cli, idf-esp et platform.io-cli pour remplacer VScode uniquement dans le terminal +* Très facile à utliser +* Très facile à installer ![Example-picture](/pictures/image.png) -## Quick Start +## Installation ### Introduction : -Installation requires : +Prérequis : ``` sudo apt update sudo apt install git elinks ``` -### Set up VimsCode : +### Installation de VimsCode : - -After clone don't forgot to rename "vimrc-conf" -> ".vimrc" : +Après le clone, lancer juste le script d'installation ``` cd Vimscode @@ -67,49 +66,41 @@ chmod +x install.sh ### Alias : -When you load vim, you have 1 error with vim-colorschemes, its totally normal, because your vimrc use theme but you dont have load this theme. +Quand vous chargez vim pour la première fois apres l'installation, ce dernier vous mettra plusieurs erreurs car vous n'avez pas encore installer les greffons nécessaire à son bon fonctionnement. -Edit your bashrc or zshrc and copie/paste this ligne at the end : +Editer votre bashrc ou zshrc pour ajouter l'alias VimsCode : ``` vim ~/.zshrc or vim ~/.bashrc alias vimscode="~/.vim/vimscode.sh" ``` -### Install Plugins : +### Installations des Greffons : -Launch `vim` and run `:PluginInstall` +Lancer `vim` et taper la commande `:PluginInstall` ## Documentation -### Short-cute VimsCode : +### Raccourcis VimsCode : -This short-cute are totally switchable in .vimrc. +Tous les raccourcis VimsCode sont totalement configurable dans le fichier .vimrc dans votre /home : ``` -"F2" Shows a vim note -"F3" Shows the tree structure -"F4" Shows the history of changes made -"F5" Shows a terminal at the bottom -"F6" Allows scrolling in the terminal -"F7" Brings up a help site for vim and terminal -"F8" created a new vim tab -"F9" navigate between vim tabs -"c-s" vertical split of the window -"F10" "F10" close vimscode +"Ctrl+l" Montre tout les raccourcis VimsCode et quelques raccourcis Vim ``` -* Shortcut in visual mode, when you highlight a word, do a duckduckgo search, on press "g". -* You can change the hight of window with mouse. +* Le raccourcis en mode visuel vous permet de faire des chercher internet sur le mot sélection en appuyant sur "g". +* Vous pouvez utiliser la souris dans VimsCode, pour changer des éléments ou autres... -Finally you can run vimscode with this alias : +Pour finir vous pouvez lancer VimsCode avec ces alias ou juste si vous préferez, vous pouvez le lancer juste avec vim mais vous n'aurez pas l'interface VimsCode de déclencher : ``` -vimscode -e "file" # for ESP ide -vimscode -a "file" # for Arduino ide -vimscode -p "file" # for platform.io ide -vimscode # help vimscode +vimscode -e "fichier" # pour ESP ide +vimscode -a "fichier" # pour Arduino ide +vimscode -p "fichier" # pour platform.io ide +vimscode # aide vimscode +vim # sans affichage de VimsCode ``` -If you want change theme of vimscode, you can just change this line : +Si vous voulez changer de theme VimsCode, vous pouvez changer cette ligne : ``` colorscheme space-vim-dark colorscheme cool @@ -117,23 +108,19 @@ colorscheme elda colorscheme space-vim-dark colorscheme black_angus ``` -And other theme : [Theme](https://github.com/flazz/vim-colorschemes/tree/master/colors) +Et pour voir d'autres thèmes : [Theme](https://github.com/flazz/vim-colorschemes/tree/master/colors) -### More Doc : +### Plus de documentation : [Documentation](https://projets.cohabit.fr/redmine/projects/accueil/wiki/Documentation_IDE_Vim) -## Update +## Mise à jour -For update it's very simple you juste have to pull and do some mv: +Pour mettre à jour VimsCode, taper simple ces commandes : ``` cd ~/.vim chmod +x update-vimscode ./update-vimscode ``` - -## Troubleshooting - -For troubleshooting and common problems see [TROUBLESHOOTING](https://git.cohabit.fr/bastien/VimsCode/wiki/Troubleshooting). diff --git a/vimrc-conf b/vimrc-conf index 994bead..880eeda 100644 --- a/vimrc-conf +++ b/vimrc-conf @@ -5,18 +5,21 @@ set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' -"Plugins installés depuis Vim Awesome +"Plugins installés depuis Vim Awesome avec le gestionnaire Vundle Plugin 'preservim/nerdtree' -Plugin 'junegunn/fzf.vim' +Plugin 'mbbill/undotree' Plugin 'jeffkreeftmeijer/vim-numbertoggle' -Plugin 'sheerun/vim-polyglot' -Plugin 'rip-rip/clang_complete' Plugin 'jodosha/vim-devnotes' Plugin 'joshdick/onedark.vim' -Plugin 'mbbill/undotree' Plugin 'flazz/vim-colorschemes' Plugin 'ervandew/supertab' -Plugin 'itspriddle/vim-shellcheck' +Plugin 'tpope/vim-fugitive' +Plugin 'jiangmiao/auto-pairs' +Plugin 'tpope/vim-commentary' +Plugin 'vim-airline/vim-airline' +Plugin 'vim-airline/vim-airline-themes' +Plugin 'liuchengxu/vim-which-key' +Plugin 'mhinz/vim-startify' call vundle#end() " required filetype plugin indent on " required @@ -25,13 +28,73 @@ filetype plugin indent on " required syntax on set smartindent set shiftround -set cindent set wildmenu set cursorline set ignorecase set hlsearch +set autowrite set mouse=a -set termwinsize=10x150 " Permet de réguler la taille du terminal + +" Configuration du terminal extensible +function! OpenResizableTerminals(size) + let size_arg = a:size != '' ? '++rows=' . a:size : '' + execute 'bot term ' . size_arg +endfunction +nnoremap :call OpenResizableTerminals(input('Taille du terminal : ', '10')) + +" Configurer Airline +set laststatus=2 +let g:airline_powerline_fonts = 1 +let g:airline_theme='onedark' + +" Stocker le nom d'utilisateur dans une variable +let g:username = substitute(system('whoami'), '\n', '', '') + +" Fonction pour mapper les modes +function! Mode() + let mode = mode() + if mode ==# 'n' + return 'NORMAL' + elseif mode ==# 'i' + return 'INSERT' + elseif mode ==# 'v' + return 'VISUAL' + elseif mode ==# "\" + return 'VISUAL BLOCK' + elseif mode ==# 'V' + return 'VISUAL LINE' + elseif mode ==# 'R' + return 'REPLACE' + else + return mode() + endif +endfunction + +" Configurer les sections personnalisées dans la barre d'état +let g:airline_section_a = '%<%{Mode()}' +let g:airline_section_b = '%#StatusLine#' . g:username . ' | %f' +let g:airline_section_c = '%#StatusLineNC#%{strftime("%H:%M")}' + +" Configurer les symboles de séparation +let g:airline_left_sep = '' +let g:airline_right_sep = '' +let g:airline_left_alt_sep = '' +let g:airline_right_alt_sep = '' + +" Configurer les couleurs +hi StatusLine guifg=#ebdbb2 guibg=#3c3836 gui=NONE ctermfg=180 ctermbg=237 cterm=NONE +hi StatusLineNC guifg=#928374 guibg=#3c3836 gui=NONE ctermfg=146 ctermbg=237 cterm=NONE +hi User1 guifg=#282828 guibg=#98971a gui=NONE ctermfg=234 ctermbg=142 cterm=NONE +hi User2 guifg=#928374 guibg=NONE gui=NONE ctermfg=146 ctermbg=NONE cterm=NONE +hi User3 guifg=#d5c4a1 guibg=#3c3836 gui=NONE ctermfg=223 ctermbg=237 cterm=NONE +hi User4 guifg=#1d2021 guibg=NONE gui=NONE ctermfg=234 ctermbg=NONE cterm=NONE +hi User5 guifg=#689d6a guibg=NONE gui=NONE ctermfg=108 ctermbg=NONE cterm=NONE +hi User6 guifg=#fabd2f guibg=NONE gui=NONE ctermfg=214 ctermbg=NONE cterm=NONE + +" Activer auto-pairs +let g:AutoPairsFlyMode = 1 +let g:AutoPairsShortcutBackInsert = '' +au FileType * let b:AutoPairs = AutoPairsDefine({'(':')', '[':']', '{':'}', '"':'"', "'":"'", '`':'`'}) "Numérotation avec numbertoggle set number relativenumber @@ -39,45 +102,109 @@ set number relativenumber "Theme vim colorscheme space-vim-dark -"Language vim -let g:polyglot_enabled = ['sh', 'git', 'blade','scss','html5'] +"Permet la sauvegarde automatique de l'historique... +set undofile +set undodir=~/.vim/ "Raccourci vertical split -nmap :vsplit +nnoremap :vsp "Raccourci Note -nmap :call DevNotes() +nmap :call DevNotes() "Raccourci NerdTree -nnoremap :NERDTreeToggle +nnoremap :NERDTreeToggle "Raccourci historique -nnoremap :UndotreeToggle +nnoremap :UndotreeToggle:wincmd p "Raccourci terminal -nnoremap :bot term tnoremap N "Raccourci vers une recherche duckduckgo -vmap g : !firefox "https://duckduckgo.com/?q=&t=newext&atb=v372-6&ia=web" >& /dev/null +vmap g : !firefox "https://duckduckgo.com/?q=&t=newext&atb=v372-6&ia=web" >& /dev/null "Raccourci vers aide vim -nmap :!elinks https://agreugr.eu +nmap :!elinks https://agreugr.eu "Raccourci onglet -nmap :tabnew -nmap :tabnext +nnoremap :call OpenFileInNewTab() +nmap :tabnext -"Fermeture de vimscode -tnoremap -nnoremap :NERDTreeToggle > :x +" Sauvegarde et Fermeture de vimscode +function! SaveAndQuit() + wa + qall! +endfunction + +nnoremap :call SaveAndQuit() "Raccourci plugin installer -nmap œ :PluginList +nmap ² :PluginList "Raccourci au lancement de vim -au VimEnter *.cpp :NERDTreeFocus -au VimEnter *.cpp :bot term +au VimEnter *.cpp :NERDTreeFocus +au VimEnter *.cpp :call OpenResizableTerminals(input('Taille du terminal : ', '10')) -au VimEnter *.ino :NERDTreeFocus -au VimEnter *.ino :bot term +au VimEnter *.ino :NERDTreeFocus +au VimEnter *.ino :call OpenResizableTerminals(input('Taille du terminal : ', '10')) + +" Fonction pour la création d'un nouvel onglet +function! OpenFileInNewTab() + let user_choice = input("Voulez-vous ouvrir un fichier existant ? (o/n): ") + if user_choice == 'o' + let file_name = input("Choisir un fichier à ouvrir : ", '', 'file') + if filereadable(file_name) + execute "tabnew " . fnameescape(file_name) + else + echo "Le fichier spécifié n'existe pas : " . file_name + endif + elseif user_choice == 't' + execute "tabnew " + elseif user_choice == 'n' + let new_file = input("Nouveau nom de fichier : ") + execute "tabnew " . new_file + else + echo "\nChoix invalide. Veuillez saisir 'o' pour ouvrir un fichier existant, ou 'n' pour créer un fichier." + endif +endfunction + +" Configuration de la page d'accueil vim +let g:startify_lists = [ + \ {'type': 'files', 'header': ['Fichiers récents']}, + \ ] +let g:startify_custom_header = + \ startify#center(split(system('figlet -w 100 VIMSCODE'), '\n')) + +" Configuration WhichKey +call which_key#register('', "g:which_key_map") +nnoremap :WhichKey '' +set timeoutlen=20 +let g:which_key_map = { + \ 'name' : 'Raccourcis VimsCode' , + \ '' : ['w' , 'fait apparaitre une note'] , + \ '' : ['c' , 'fait apparaitre l arborescence'] , + \ '' : ['s' , 'historique de modification'] , + \ '' : ['v' , 'fait apparaitre un terminal'] , + \ '' : ['v' , 'scroll dans le terminal'] , + \ '' : ['h' , 'fait apparaitre un site aide'] , + \ '' : ['j' , 'créer une nouvel fenetre'] , + \ '' : ['l' , 'change de fenetre'] , + \ '' : ['5<' , 'ferme VimsCode'] , + \ 'Ctrl-s' : [':resize +5' , 'divise en deux vim'] , + \ '²' : ['5>' , 'affiche les greffons'] , + \ } +let g:which_key_map.o = { + \ 'name' : 'Raccourcis Vim' , + \ 'Ctrl-w-w' : ['w' , 'other-window'] , + \ 'Ctrl-w-c' : ['c' , 'delete-window'] , + \ 'Ctrl-w-s' : ['s' , 'split-window-below'] , + \ 'Ctrl-w-v' : ['v' , 'split-window-right'] , + \ 'Ctrl-w-h' : ['h' , 'window-left'] , + \ 'Ctrl-w-j' : ['j' , 'window-below'] , + \ 'Ctrl-w-l' : ['l' , 'window-right'] , + \ 'Ctrl-w-k' : ['k' , 'window-up'] , + \ ':resize +5' : [':resize +5' , 'expand-window-below'] , + \ ':resize -5' : [':resize -5' , 'expand-window-up'] , + \ 'Ctrl-w-=' : ['=' , 'balance-window'] , + \ }