diff options
| -rw-r--r-- | configs/windows/var_USERPROFILE__vimrc | 551 | ||||
| -rw-r--r-- | configs/wsl/home_.bashrc | 173 | ||||
| -rw-r--r-- | configs/wsl/home_.screenrc | 74 | ||||
| -rw-r--r-- | configswslhome_.bashrc | 173 | ||||
| -rw-r--r-- | configswslhome_.screenrc | 74 | ||||
| -rw-r--r-- | files-config.txt | 7 | ||||
| -rw-r--r-- | path-mapping.json | 12 | ||||
| -rw-r--r-- | scripts/sync-to-project.ps1 | 62 |
8 files changed, 1095 insertions, 31 deletions
diff --git a/configs/windows/var_USERPROFILE__vimrc b/configs/windows/var_USERPROFILE__vimrc new file mode 100644 index 0000000..b9caa86 --- /dev/null +++ b/configs/windows/var_USERPROFILE__vimrc @@ -0,0 +1,551 @@ +" ============================================================================== +" Configuration VIM pour Erwin +" ============================================================================== +" Fichier : C:\Users\Erwin\_vimrc copy +" Chemin réel : D:\Users\Erwin\_vimrc (via junction point) +" Dernière mise à jour : 2025 +" +" Structure : +" 1. En-tête et configuration de base VIM +" 2. Configuration Pathogen +" 3. Configuration des types de fichiers et syntaxe +" 4. Options générales (encoding, tabs, search, etc.) +" 5. Interface utilisateur (curseur, police, cloche) +" 6. Raccourcis personnalisés (leader, navigation) +" 7. Plugins configuration (via fichiers séparés si nécessaire) +" 8. Fonctions personnalisées +" 9. Autocompletion par type de fichier +" 10. Configurations spécifiques Windows +" ============================================================================== + +" ============================================================================== +" 1. CONFIGURATION DE BASE VIM +" ============================================================================== + +" Désactiver la compatibilité avec vi (nécessaire pour toutes les fonctionnalités) +set nocompatible +set nocp + +" Charger les configurations d'exemple et Windows +source $VIMRUNTIME/vimrc_example.vim +source $VIMRUNTIME/mswin.vim +behave mswin + +" ============================================================================== +" 2. CONFIGURATION PATHOGEN +" ============================================================================== +" Pathogen permet de charger les plugins depuis le dossier bundle/ +" Les plugins doivent être installés dans : D:\Users\Erwin\vimfiles\bundle\ +" Pathogen se trouve dans : D:\Users\Erwin\vimfiles\autoload\pathogen.vim +" +" Configuration : charger uniquement les plugins depuis vimfiles\bundle\ +" (même emplacement que ce _vimrc) + +" ============================================================================== +" ACTIVATION DES MODULES VIMOUTLINER (AVANT PATHOGEN) +" ============================================================================== +" IMPORTANT : Cette variable doit être définie AVANT execute pathogen#infect() +" pour que les modules VimOutliner (checkbox, tags, etc.) soient chargés +" Format : "module1:module2:module3" +" Modules disponibles : checkbox, tags, smart_paste, math, newhoist, format, clock +if !exists('g:vo_modules_load') + let g:vo_modules_load = "checkbox:tags:smart_paste" +endif + +" ============================================================================== +" CONFIGURATION MINIBUFEXPLORER (AVANT PATHOGEN) +" ============================================================================== +" IMPORTANT : Cette variable doit être définie AVANT le chargement du plugin +" pour empêcher MiniBufExplorer de créer des liens de surlignage par défaut +" Cela permet de définir nos propres couleurs personnalisées +let g:did_minibufexplorer_syntax_inits = 1 + +execute pathogen#infect('bundle/{}') + +" ============================================================================== +" 3. CONFIGURATION DES TYPES DE FICHIERS ET SYNTAXE +" ============================================================================== + +" Activer la détection automatique des types de fichiers +filetype plugin indent on + +" Activer la coloration syntaxique +syntax on + +" Charger tous les fichiers de détection de type de fichier +runtime! ftdetect\*.vim + +" ============================================================================== +" 3.1. CONFIGURATION VIMOUTLINER +" ============================================================================== +" VimOutliner gère les fichiers .otl (outline files) +" Plugin installé dans : D:\Users\Erwin\vimfiles\bundle\vimoutliner-master\ +" Configuration séparée dans : D:\Users\Erwin\vimoutlinerrc +" +" IMPORTANT : maplocalleader doit être défini AVANT le chargement de vimoutliner +" (c'est fait dans la section 6, mais on le vérifie ici) +" +" IMPORTANT : g:vo_modules_load doit être défini AVANT le chargement pour activer +" les plugins (checkbox, tags, smart_paste, etc.) +" Cette variable est définie dans vimoutlinerrc, mais on peut aussi la définir ici +" si nécessaire AVANT execute pathogen#infect() +" +" Vimoutliner charge automatiquement ses plugins via Pathogen +" Le fichier vimoutlinerrc est chargé automatiquement par le plugin s'il existe dans $HOME + +" Charger la configuration vimoutliner personnalisée après Pathogen +" Note : VimOutliner cherche automatiquement vimoutlinerrc dans plusieurs emplacements : +" - .vimoutlinerrc (avec point) dans $HOME +" - vimoutlinerrc (sans point) dans $HOME, $HOME/.vimoutliner, ou $HOME/.vim +" - vimoutlinerrc dans le répertoire du plugin +" Le fichier est chargé automatiquement par le plugin, pas besoin de le sourcer ici + +" ============================================================================== +" 4. OPTIONS GÉNÉRALES +" ============================================================================== + +" ---- Encodage ---- +" Configuration de l'encodage pour supporter UTF-8 +set encoding=utf-8 +set termencoding=utf-8 +set fileencoding=utf-8 + +" ---- Tabulations et indentation ---- +" Configuration par défaut : tabstop=4, shiftwidth=4 +set shiftwidth=4 +set tabstop=4 +" Note : Pour les fichiers .otl, vimoutliner configure tabstop=1 + +" ---- Recherche ---- +" Recherche intelligente : si on utilise des majuscules, recherche sensible à la casse +" Si uniquement minuscules, recherche insensible à la casse +set smartcase +set ignorecase + +" ---- Cloche système ---- +" Désactiver le bip et utiliser un flash visuel à la place +set visualbell + +" ---- Variables d'environnement ---- +" Configuration du répertoire temporaire pour diff (évite erreur E97) +" Sur Windows, utiliser un chemin valide ou laisser la variable système +let $TMP=expand('$TEMP') . '\vimtmp' + +" ============================================================================== +" 5. INTERFACE UTILISATEUR +" ============================================================================== + +" ---- Police de caractères ---- +" Définir la police pour l'interface graphique VIM +set guifont=Consolas:h10:cANSI + +" ---- Configuration du curseur ---- +" Définir les couleurs et le style du curseur +highlight Cursor guifg=black guibg=green +highlight iCursor guifg=white guibg=steelblue +highlight CursorLine guifg=red guibg=blue + +" Configuration du style du curseur selon le mode +set guicursor=n-v-c:block-Cursor +set guicursor+=i:ver100-iCursor +set guicursor+=n-v-c:blinkon0 +set guicursor+=i:blinkwait11 + +" ---- Numérotation des lignes ---- +" Afficher les numéros de ligne +set number +" Optionnel : afficher aussi les numéros relatifs +" set relativenumber + +" ---- Statusline ---- +" Toujours afficher la barre de statut (nécessaire pour airline/powerline) +set laststatus=2 + +" ---- Colorscheme par défaut ---- +" Définir un colorscheme par défaut (sera surchargé par vimoutliner pour les fichiers .otl) +" Vous pouvez changer ce colorscheme selon vos préférences +" colorscheme desert +colorscheme toshiro_light + +" ============================================================================== +" 6. RACCOURCIS PERSONNALISÉS +" ============================================================================== + +" ---- Définition des leaders ---- +" Définir les raccourcis de leader pour les commandes personnalisées +" IMPORTANT : maplocalleader doit être défini AVANT le chargement de vimoutliner +" car vimoutliner utilise maplocalleader pour ses raccourcis (,,c, ,,x, ,,d, etc.) +let maplocalleader=",," +let mapleader=",," + +" ---- Édition du vimrc ---- +" Ouvrir le fichier _vimrc dans une nouvelle fenêtre +nnoremap <leader>ev :vsp $MYVIMRC<CR> +" Recharger le fichier _vimrc +nnoremap <leader>sv :source $MYVIMRC<CR> + +" ---- Navigation entre fenêtres avec Alt ---- +" Utiliser Alt + flèches pour naviguer entre les fenêtres +nmap <silent> <A-Up> :wincmd k<CR> +nmap <silent> <A-Down> :wincmd j<CR> +nmap <silent> <A-Left> :wincmd h<CR> +nmap <silent> <A-Right> :wincmd l<CR> + +" ---- Navigation entre fenêtres avec Ctrl ---- +" Utiliser Ctrl + hjkl pour naviguer entre les fenêtres +nnoremap <C-h> <C-w>h +nnoremap <C-j> <C-w>j +nnoremap <C-k> <C-w>k +nnoremap <C-l> <C-w>l + +" ---- Escape avec jk ---- +" Utiliser jk comme raccourci pour Escape (plus rapide) +inoremap jk <esc> + +" ---- Copier/Coller vers le presse-papiers système ---- +" Copier vers le presse-papiers système (Ctrl+C) +vmap <C-c> "+y +" Couper vers le presse-papiers système (Ctrl+X) +vmap <C-x> "+c +" Coller depuis le presse-papiers système (Ctrl+V en mode visuel) +vmap <C-v> c<ESC>"+p +" Coller depuis le presse-papiers système (Ctrl+V en mode insertion) +imap <C-v> <ESC>"+pa + +" ---- Désactiver la recherche sur Escape ---- +" Désactiver le surlignage de recherche quand on appuie sur Escape +nnoremap <Esc> :noh<CR><Esc> + +" ---- Ouvrir un fichier à gauche ---- +" Ouvrir le fichier sous le curseur dans une nouvelle fenêtre à droite +" La nouvelle fenêtre fait 25% de la largeur totale, la fenêtre actuelle garde sa position +function! OpenFileInNewWindow() + " Sauvegarder le numéro de la fenêtre actuelle + let l:current_win = winnr() + + " Créer une nouvelle fenêtre verticale avec le même buffer (pour garder le curseur sur le fichier) + execute "rightbelow vsplit" + let l:new_win = winnr() + + " Utiliser gf dans la nouvelle fenêtre pour ouvrir le fichier sous le curseur + " gf utilise la logique native de Vim pour trouver les fichiers + normal! gf + + " Redimensionner la nouvelle fenêtre à 25% de la largeur totale + let l:new_width = float2nr(&columns * 0.25) + execute "vertical resize " . l:new_width + + " Le curseur est maintenant dans la nouvelle fenêtre avec le fichier ouvert +endfunction +nnoremap <silent> gF :call OpenFileInNewWindow()<CR> + +" ---- Largeur des fenêtres ---- +" Redimensionner la fenêtre courante à 100 caractères +nnoremap <C-w>1 <C-w>100<bar> +" Redimensionner la fenêtre courante à 120 caractères +nnoremap <C-w>2 <C-w>120<bar> +" Redimensionner la fenêtre courante à toute la largeur +nnoremap <C-w>3 <C-w><bar> + +" ---- Sélectionner le texte collé ---- +" Sélectionner le texte qui vient d'être collé +nnoremap gp `[v`] + +" ---- Mettre des guillemets autour d'une sélection ---- +" Mettre des guillemets doubles autour du mot sous le curseur +nnoremap <Leader>q" ciw""<Esc>P +" Mettre des guillemets simples autour du mot sous le curseur +nnoremap <Leader>q' ciw''<Esc>P + +" ---- Tlist (TagList) ---- +" Basculer l'affichage de la liste des tags avec F11 +nnoremap <F11> :TlistToggle<cr> + +" ---- Ouvrir le fichier courant dans un navigateur ---- +" Ouvrir le fichier courant dans Firefox +nnoremap <F12>f :exe ':silent !firefox %'<CR> +" Ouvrir le fichier courant dans Chromium +nnoremap <F12>c :exe ':silent !chromium-browser %'<CR> +" Ouvrir le fichier courant dans Opera +nnoremap <F12>o :exe ':silent !opera %'<CR> +" Ouvrir le fichier courant dans Internet Explorer +nnoremap <F12>e :exe ':silent !iexplore %'<CR> + +" ---- Zoom police de caractères ---- +" Augmenter la taille de la police (leader+) +nnoremap <leader>+ :silent! let &guifont = substitute( + \ &guifont, + \ ':h\zs\d\+', + \ '\=eval(submatch(0)+1)', + \ '')<CR> +" Diminuer la taille de la police (leader-) +nnoremap <leader>- :silent! let &guifont = substitute( + \ &guifont, + \ ':h\zs\d\+', + \ '\=eval(submatch(0)-1)', + \ '')<CR> + +" ---- Abréviations de date ---- +" Insérer la date actuelle (dt -> YYYY-MM-DD) +iabbrev dt <c-r>=strftime("%Y-%m-%d")<CR> +" Insérer la date et l'heure actuelles (dts -> YYYY-MM-DD@HH:MM:SS) +iabbrev dts <c-r>=strftime("%Y-%m-%d@%H:%M:%S")<CR> + +" ---- Chemin du fichier courant ---- +" Insérer le chemin complet du dossier du fichier courant (\fn) +inoremap \fn <C-R>=expand("%:p:h")<CR> + +" ============================================================================== +" 7. CONFIGURATION DES PLUGINS +" ============================================================================== + +" ---- UltiSnips ---- +" Configuration pour les snippets (modèles de code) +let g:UltiSnipsSnippetDirectories = ['~/.vim/UltiSnips', 'UltiSnips'] +let g:UltiSnipsExpandTrigger = "<tab>" +let g:UltiSnipsListSnippets = "<c-tab>" +let g:UltiSnipsJumpForwardTrigger = "<c-j>" +let g:UltiSnipsJumpBackwardTrigger = "<c-k>" +let g:UltiSnipsUsePythonVersion = 2 + +" ---- EasyMotion ---- +" Plugin de navigation rapide dans le fichier +let g:EasyMotion_do_mapping = 0 " Désactiver les mappings par défaut +let g:EasyMotion_startofline = 0 " Garder la colonne du curseur lors des mouvements JK + +" Activer la recherche insensible à la casse +let g:EasyMotion_smartcase = 1 + +" Mappings avec le leader : utiliser <leader><leader> pour toutes les commandes +" Bi-directional find motion : `<leader><leader>s{char}{label}` pour aller n'importe où +nmap <leader><leader>s <Plug>(easymotion-s) +" Navigation par mots +nmap <leader><leader>w <Plug>(easymotion-w) +nmap <leader><leader>b <Plug>(easymotion-b) +" Navigation par lignes +nmap <leader><leader>j <Plug>(easymotion-j) +nmap <leader><leader>k <Plug>(easymotion-k) +" Alternative : navigation par lignes avec leader simple +map <leader>j <Plug>(easymotion-j) +map <leader>k <Plug>(easymotion-k) + +" Personnalisation des couleurs EasyMotion +hi link EasyMotionTarget ErrorMsg +hi link EasyMotionShade Comment +hi link EasyMotionTarget2First MatchParen +hi link EasyMotionTarget2Second MatchParen +hi link EasyMotionMoveHL Search + +" ---- MiniBufExplorer (Minibuffer) ---- +" Affiche une liste des buffers ouverts dans une fenêtre séparée +let g:miniBufExplMapWindowNavVim = 1 " Navigation avec Ctrl+hjkl entre fenêtres +let g:miniBufExplMapWindowNavArrows = 1 " Navigation avec flèches +let g:miniBufExplMapCTabToBufs = 1 " Ctrl+Tab pour naviguer entre buffers +let g:miniBufExplModSelTarget = 1 " Améliore la sélection de buffer +let g:miniBufExplUseSingleClick = 1 " Un clic pour ouvrir un buffer +let g:miniBufExplMaxHeight = 1 " Hauteur minimale (1 ligne) + +" Raccourci pour ouvrir/fermer MiniBufExplorer +nnoremap <leader>mb :MBEToggle<CR> + +" ---- Personnalisation des couleurs MiniBufExplorer ---- +" La variable g:did_minibufexplorer_syntax_inits est définie AVANT Pathogen (ligne 52) +" pour empêcher le plugin de créer des liens par défaut +" Définir les couleurs personnalisées (sans liens) +" Buffer actif : surligné en vert (très visible) +hi MBEVisibleActiveNormal guifg=white guibg=#00ff00 ctermfg=white ctermbg=green gui=bold cterm=bold +hi MBEVisibleActiveChanged guifg=black guibg=#00ff00 ctermfg=black ctermbg=green gui=bold,italic cterm=bold,italic + +" Buffers modifiés : en jaune/orange pour attirer l'attention +hi MBEChanged guifg=black guibg=#ffaa00 ctermfg=black ctermbg=yellow gui=bold cterm=bold +hi MBEVisibleChanged guifg=black guibg=#ffaa00 ctermfg=black ctermbg=yellow gui=bold cterm=bold + +" Buffers normaux : en bleu clair pour une bonne lisibilité +hi MBENormal guifg=#0066cc guibg=#e6f2ff ctermfg=blue ctermbg=lightblue +hi MBEVisibleNormal guifg=#0066cc guibg=#e6f2ff ctermfg=blue ctermbg=lightblue + +" Fonction pour réappliquer les couleurs après chaque rafraîchissement de MiniBufExplorer +function! ReapplyMiniBufExplColors() + " Réappliquer les couleurs (le plugin peut les avoir écrasées) + hi MBEVisibleActiveNormal guifg=white guibg=#00ff00 ctermfg=white ctermbg=green gui=bold cterm=bold + hi MBEVisibleActiveChanged guifg=black guibg=#00ff00 ctermfg=black ctermbg=green gui=bold,italic cterm=bold,italic + hi MBEChanged guifg=black guibg=#ffaa00 ctermfg=black ctermbg=yellow gui=bold cterm=bold + hi MBEVisibleChanged guifg=black guibg=#ffaa00 ctermfg=black ctermbg=yellow gui=bold cterm=bold + hi MBENormal guifg=#0066cc guibg=#e6f2ff ctermfg=blue ctermbg=lightblue + hi MBEVisibleNormal guifg=#0066cc guibg=#e6f2ff ctermfg=blue ctermbg=lightblue +endfunction + +" Appliquer les couleurs après chaque rafraîchissement de MiniBufExplorer +autocmd BufEnter *-MiniBufExplorer-* call ReapplyMiniBufExplColors() +autocmd WinEnter * if &filetype == "" && bufname("%") =~ "-MiniBufExplorer-" | call ReapplyMiniBufExplColors() | endif + +" ---- vim-airline (Powerline pour Vim) ---- +" Barre de statut améliorée - alternative moderne à Powerline +" Ne nécessite pas Python, fonctionne directement avec Vim +" Pathogen charge automatiquement le plugin depuis bundle/vim-airline + +" Configuration minimale pour éviter les bugs +let g:airline#extensions#tabline#enabled = 0 " Désactiver la tabline (peut créer une fenêtre supplémentaire) +let g:airline#extensions#branch#enabled = 1 " Afficher la branche git si disponible +let g:airline#extensions#hunks#enabled = 0 " Désactiver les hunks git (peut causer des problèmes) + +" Thème simple +let g:airline_theme = 'dark' +let g:airline_powerline_fonts = 0 " Désactiver les symboles Powerline (évite les bugs d'affichage) + +" Simplifier les symboles pour éviter les problèmes d'affichage +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif +let g:airline_symbols.branch = 'branch:' +let g:airline_symbols.readonly = 'RO' +let g:airline_symbols.linenr = 'ln' +let g:airline_symbols.dirty = '*' + +" ---- UndoTree ---- +" Visualisation de l'arbre d'annulation (undo tree) +" Permet de naviguer dans l'historique des modifications +let g:undotree_SetFocusWhenToggle = 1 " Mettre le focus sur UndoTree quand on l'ouvre +let g:undotree_WindowLayout = 2 " Layout : arbre à gauche, diff à droite +let g:undotree_SplitWidth = 30 " Largeur de la fenêtre UndoTree +let g:undotree_DiffpanelHeight = 10 " Hauteur du panneau de différence +let g:undotree_DiffAutoOpen = 1 " Ouvrir automatiquement le panneau de différence +let g:undotree_TreeNodeShape = '◯' " Forme des nœuds de l'arbre +let g:undotree_HighlightChangedText = 1 " Surligner le texte modifié +let g:undotree_HighlightChangedWithSign = 1 " Afficher un signe pour les changements + +" Raccourci pour ouvrir/fermer UndoTree +nnoremap <leader>u :UndotreeToggle<CR> + +" ---- Calendar ---- +" Plugin calendrier avec intégration Google +let g:calendar_google_calendar = 1 +let g:calendar_google_task = 1 + +" ---- Personnalisation des couleurs ---- +" Commentaires en gris clair +highlight Comment guifg=#888888 ctermfg=gray +" Numéros de ligne en gris clair +highlight LineNr guifg=#cccccc ctermfg=252 + +" ---- Dictionary & Spelling ---- +" Configuration de la correction orthographique +highlight clear SpellBad +highlight SpellBad cterm=underline,bold ctermfg=red + +" ============================================================================== +" 8. FONCTIONS PERSONNALISÉES +" ============================================================================== + +" ---- Fonctions navigateur ---- +" Ajouter les navigateurs au PATH +let $PATH = $PATH . ';C:\Program Files (x86)\Internet Explorer' +let $PATH = $PATH . ';C:\Program Files (x86)\Mozilla Firefox' + +" Fonction pour ouvrir l'URL sous le curseur dans Internet Explorer +function! BrowserIE() + let line = getline(".") + exec ":silent !iexplore.exe ".line +endfunction + +" Fonction pour ouvrir l'URL sous le curseur dans Firefox +function! BrowserFF() + let line = getline(".") + exec ":silent !firefox.exe ".line +endfunction + +" Mappings pour les fonctions navigateur +map <Leader>w :call BrowserFF() &<CR> +map <Leader>ww :call BrowserIE() &<CR> + +" ---- Fonction MyDiff pour Windows ---- +" Configuration de diff pour Windows (évite les erreurs) +set diffexpr=MyDiff() + +function! MyDiff() + let opt = '-a --binary ' + if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif + if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif + let arg1 = v:fname_in + if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif + let arg2 = v:fname_new + if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif + let arg3 = v:fname_out + if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif + if $VIMRUNTIME =~ ' ' + if &sh =~ '\<cmd' + if empty(&shellxquote) + let l:shxq_sav = '' + set shellxquote& + endif + let cmd = '"' . $VIMRUNTIME . '\diff"' + else + let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' + endif + else + let cmd = $VIMRUNTIME . '\diff' + endif + silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 + if exists('l:shxq_sav') + let &shellxquote=l:shxq_sav + endif +endfunction + +" ---- Fonctions de zoom police (alternative) ---- +" Fonctions pour augmenter/diminuer la taille de la police +" Note : Les raccourcis <leader>+ et <leader>- sont déjà définis dans la section 6 + +function! AdjustFontSize(amount) + let fontname = substitute(&guifont, '^\(.* \)\([1-9][0-9]*\)$', '\1', '') + let cursize = substitute(&guifont, '^\(.* \)\([1-9][0-9]*\)$', '\2', '') + let newsize = cursize + a:amount + if (newsize >= 6) && (newsize <= 16) + let newfont = fontname . newsize + let &guifont = newfont + endif +endfunction + +function! LargerFont() + call AdjustFontSize(1) +endfunction +command! LargerFont call LargerFont() + +function! SmallerFont() + call AdjustFontSize(-1) +endfunction +command! SmallerFont call SmallerFont() + +" ============================================================================== +" 9. AUTOCOMPLETION PAR TYPE DE FICHIER +" ============================================================================== + +" Configuration de l'autocomplétion (omnifunc) pour chaque type de fichier +autocmd FileType python set omnifunc=pythoncomplete#Complete +autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS +autocmd FileType html set omnifunc=htmlcomplete#CompleteTags +autocmd FileType css set omnifunc=csscomplete#CompleteCSS +autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags +autocmd FileType php set omnifunc=phpcomplete#CompletePHP +autocmd FileType c set omnifunc=ccomplete#Complete +autocmd FileType votl set omnifunc=votlcomplete#Complete +autocmd FileType ps1 set omnifunc=poshcomplete#CompleteCommand + +" ============================================================================== +" 10. CONFIGURATIONS SPÉCIFIQUES WINDOWS +" ============================================================================== + +" ---- Configuration Python ---- +" Définir le chemin Python 3 pour VIM +set pythonthreehome="C:\Users\Erwin\AppData\Local\Programs\Python\Python310-32" +set pythonthreedll="C:\Users\Erwin\AppData\Local\Programs\Python\Python310-32\python310.dll" + +" ---- PoshComplete (PowerShell completion) ---- +" Configuration pour l'autocomplétion PowerShell (si le plugin est installé) +let g:PoshComplete_Port='1234' +" Note : Les chemins suivants doivent être ajustés selon votre installation +" set rtp+=C:\Users\pombette\.vim\bundle\poshcomplete-vim +" set rtp+=C:\Users\pombette\.vim\bundle\vimproc.vim\autoload + +" ============================================================================== +" FIN DE LA CONFIGURATION +" ============================================================================== diff --git a/configs/wsl/home_.bashrc b/configs/wsl/home_.bashrc new file mode 100644 index 0000000..e2c8cf7 --- /dev/null +++ b/configs/wsl/home_.bashrc @@ -0,0 +1,173 @@ +set -o vi +alias df="dfC -aT" +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + + +function prompt_nobat_dark { + local BLACK="\[\033[0;30m\]" + local GRAY="\[\033[1;30m\]" + local LT_GRAY="\[\033[0;37m\]" + local WHITE="\[\033[1;37m\]" + local NO_COLOUR="\[\033[0m\]" + local BLUE="\[\033[0;34m\]" + local LT_BLUE="\[\033[1;34m\]" + local GREEN="\[\033[0;32m\]" + local LT_GREEN="\[\033[1;32m\]" + local CYAN="\[\033[0;36m\]" + local LT_CYAN="\[\033[1;36m\]" + local BROWN="\[\033[0;33m\]" + local YELLOW="\[\033[1;33m\]" + local RED="\[\033[0;31m\]" + local LT_RED="\[\033[1;31m\]" + local PURPLE="\[\033[0;35m\]" + local LT_PURPLE="\[\033[1;35m\]" +### case $TERM in +### xterm*|rxvt*) +### TITLEBAR='\[\033]0;\u@\h:\w\007\]' +### ;; +### *) +### TITLEBAR="" +### ;; +### esac +PS1="$LT_GRAY\$?\ +$CYAN\$(date +%d)\ +$LT_BLUE\$(date +%H%M)\ +$CYAN\$(date +%S)\ +$BLACK:\ +$GREEN\u@\h\ +$BLACK:\ +$LT_BLUE\w\ +$BLACK\$ \ +$NO_COLOUR" +} + + + +prompt_nobat_dark + + + + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi +bind 'set bell-style none' +~/configure_dns_wsl.sh + +# Ajouter les entr├®es /etc/hosts au d├®marrage (WSL) +# Ne s'ex├®cute que lors de l'ouverture du premier screen (fen├¬tre 0) +if [ -n "$STY" ] && [ "$WINDOW" = "0" ]; then + [ -f /home/toshiro/.local/bin/persist_hosts_wsl.sh ] && /home/toshiro/.local/bin/persist_hosts_wsl.sh +fi diff --git a/configs/wsl/home_.screenrc b/configs/wsl/home_.screenrc new file mode 100644 index 0000000..c80ee21 --- /dev/null +++ b/configs/wsl/home_.screenrc @@ -0,0 +1,74 @@ +# added for cygwin on windows 2015-08-02@12:17:31 +shell -bash +# added the bash completion with tab + +# define a bigger scrollback, default is 100 lines +#defscrollback 1024 +#defscrollback 4096 +defscrollback 8192 +encoding UTF-8 +nethack on +#escape ^Ee + +# on Debian backspace should send char `177': +### bindkey -k kb stuff \177 +### bindkey -d -k kb stuff \010 +# bindkey -d KB stuff ^H + +# An alternative hardstatus to display a bar at the bottom listing the +# windownames and highlighting the current windowname in blue. (This is only +# enabled if there is no hardstatus setting for your terminal) +hardstatus on +hardstatus alwayslastline +red on blue: +hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %l %H %{..Y} %d.%m %c " +# red on green: +### hardstatus string "%{.gW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %d.%m %c " +red on black: +### hardstatus string "%{.kw}%-w%{.rW}%n %t%{-}%+w %=%{..Y} %H %{..Y} %d.%m %c " +termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' + +bind j focus down +bind k focus up +bind t focus top +bind b focus bottom + +bind g hardstatus ignore +bind G hardstatus alwayslastline + +bind K kill + +terminfo * k1=\EOP +terminfo * k2=\EOQ +terminfo * k3=\EOR +terminfo * k4=\EOS +terminfo * k5=\E[15~ +terminfo * k6=\E[17~ +terminfo * k7=\E[18~ +terminfo * k8=\E[19~ +terminfo * k9=\E[20~ +terminfo * F1=\E[23~ +terminfo * F2=\E[24~ + + +# bindkey -k k1 screen +# bindkey -k k2 title +# bindkey -k k3 other +# #bindkey -k k4 prev +# #bindkey -k k5 next +# +# bindkey -k k5 resize +3 +# bindkey -k k6 resize -3 +# #bindkey -k k7 resize +3 +# bindkey -k k7 prev +# +# bindkey -k k8 split +# #bindkey -k k9 split +# bindkey -k k9 next +# bindkey -k k; focus +# +# bindkey -k F1 remove +# bindkey -k F2 only +# + +export HOME="/home/toshiro" diff --git a/configswslhome_.bashrc b/configswslhome_.bashrc new file mode 100644 index 0000000..8820077 --- /dev/null +++ b/configswslhome_.bashrc @@ -0,0 +1,173 @@ +set -o vi +alias df="dfC -aT" +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + + +function prompt_nobat_dark { + local BLACK="\[\033[0;30m\]" + local GRAY="\[\033[1;30m\]" + local LT_GRAY="\[\033[0;37m\]" + local WHITE="\[\033[1;37m\]" + local NO_COLOUR="\[\033[0m\]" + local BLUE="\[\033[0;34m\]" + local LT_BLUE="\[\033[1;34m\]" + local GREEN="\[\033[0;32m\]" + local LT_GREEN="\[\033[1;32m\]" + local CYAN="\[\033[0;36m\]" + local LT_CYAN="\[\033[1;36m\]" + local BROWN="\[\033[0;33m\]" + local YELLOW="\[\033[1;33m\]" + local RED="\[\033[0;31m\]" + local LT_RED="\[\033[1;31m\]" + local PURPLE="\[\033[0;35m\]" + local LT_PURPLE="\[\033[1;35m\]" +### case $TERM in +### xterm*|rxvt*) +### TITLEBAR='\[\033]0;\u@\h:\w\007\]' +### ;; +### *) +### TITLEBAR="" +### ;; +### esac +PS1="$LT_GRAY\$?\ +$CYAN\$(date +%d)\ +$LT_BLUE\$(date +%H%M)\ +$CYAN\$(date +%S)\ +$BLACK:\ +$GREEN\u@\h\ +$BLACK:\ +$LT_BLUE\w\ +$BLACK\$ \ +$NO_COLOUR" +} + + + +prompt_nobat_dark + + + + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi +bind 'set bell-style none' +~/configure_dns_wsl.sh + +# Ajouter les entrées /etc/hosts au démarrage (WSL) +# Ne s'exécute que lors de l'ouverture du premier screen (fenêtre 0) +if [ -n "$STY" ] && [ "$WINDOW" = "0" ]; then + [ -f /home/toshiro/.local/bin/persist_hosts_wsl.sh ] && /home/toshiro/.local/bin/persist_hosts_wsl.sh +fi diff --git a/configswslhome_.screenrc b/configswslhome_.screenrc new file mode 100644 index 0000000..cba6874 --- /dev/null +++ b/configswslhome_.screenrc @@ -0,0 +1,74 @@ +# added for cygwin on windows 2015-08-02@12:17:31 +shell -bash +# added the bash completion with tab + +# define a bigger scrollback, default is 100 lines +#defscrollback 1024 +#defscrollback 4096 +defscrollback 8192 +encoding UTF-8 +nethack on +#escape ^Ee + +# on Debian backspace should send char `177': +### bindkey -k kb stuff \177 +### bindkey -d -k kb stuff \010 +# bindkey -d KB stuff ^H + +# An alternative hardstatus to display a bar at the bottom listing the +# windownames and highlighting the current windowname in blue. (This is only +# enabled if there is no hardstatus setting for your terminal) +hardstatus on +hardstatus alwayslastline +red on blue: +hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %l %H %{..Y} %d.%m %c " +# red on green: +### hardstatus string "%{.gW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %d.%m %c " +red on black: +### hardstatus string "%{.kw}%-w%{.rW}%n %t%{-}%+w %=%{..Y} %H %{..Y} %d.%m %c " +termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' + +bind j focus down +bind k focus up +bind t focus top +bind b focus bottom + +bind g hardstatus ignore +bind G hardstatus alwayslastline + +bind K kill + +terminfo * k1=\EOP +terminfo * k2=\EOQ +terminfo * k3=\EOR +terminfo * k4=\EOS +terminfo * k5=\E[15~ +terminfo * k6=\E[17~ +terminfo * k7=\E[18~ +terminfo * k8=\E[19~ +terminfo * k9=\E[20~ +terminfo * F1=\E[23~ +terminfo * F2=\E[24~ + + +# bindkey -k k1 screen +# bindkey -k k2 title +# bindkey -k k3 other +# #bindkey -k k4 prev +# #bindkey -k k5 next +# +# bindkey -k k5 resize +3 +# bindkey -k k6 resize -3 +# #bindkey -k k7 resize +3 +# bindkey -k k7 prev +# +# bindkey -k k8 split +# #bindkey -k k9 split +# bindkey -k k9 next +# bindkey -k k; focus +# +# bindkey -k F1 remove +# bindkey -k F2 only +# + +export HOME="/home/toshiro" diff --git a/files-config.txt b/files-config.txt index a1c80cf..6e1bdc3 100644 --- a/files-config.txt +++ b/files-config.txt @@ -3,6 +3,9 @@ # Chemin: supporte les variables d'environnement Windows (%VAR%) et expansion WSL (~) # # Exemples: -# windows|%USERPROFILE%\.vimrc -# wsl|~/.bashrc +windows|%USERPROFILE%\_vimrc +windows|%APPDATA%\Code\User\settings.json +wsl|~/.bashrc +wsl|~/.bash_aliases +wsl|~/.screenrc diff --git a/path-mapping.json b/path-mapping.json index 05c07d5..95e99ea 100644 --- a/path-mapping.json +++ b/path-mapping.json @@ -1,5 +1,9 @@ -{ - "windows": {}, - "wsl": {} +{ + "windows": { + "%USERPROFILE%\\_vimrc": "configs\\windows\\var_USERPROFILE__vimrc" + }, + "wsl": { + "~/.bashrc": "configs\\wsl\\home_.bashrc", + "~/.screenrc": "configs\\wsl\\home_.screenrc" + } } - diff --git a/scripts/sync-to-project.ps1 b/scripts/sync-to-project.ps1 index 5c3fd9c..aef1249 100644 --- a/scripts/sync-to-project.ps1 +++ b/scripts/sync-to-project.ps1 @@ -90,24 +90,30 @@ function Get-ProjectPath { [string]$originalPath ) - # Nettoyer le chemin original pour créer un nom de fichier sûr - $safeName = $originalPath -replace '[\\/:*?"<>|]', '_' - $safeName = $safeName -replace '^%', '' -replace '%$', '' - $safeName = $safeName -replace '^~', 'home' + # Nettoyer chaque partie du chemin + $parts = $originalPath -split '[\\/]' + $safeParts = @() - # Si le chemin contient des séparateurs, préserver la structure - if ($originalPath -match '[\\/]') { - $parts = $originalPath -split '[\\/]' - $fileName = $parts[-1] - $parentDirs = $parts[0..($parts.Length - 2)] -join '_' - if ($parentDirs) { - $safeName = "${parentDirs}_${fileName}" - } else { - $safeName = $fileName + foreach ($part in $parts) { + # Nettoyer chaque partie : remplacer les caractères invalides et les variables + $safePart = $part -replace '[\\/:*?"<>|]', '_' + $safePart = $safePart -replace '^%', 'var_' -replace '%$', '' -replace '%', '_' + $safePart = $safePart -replace '^~', 'home' + + # Si la partie est vide après nettoyage, utiliser un nom par défaut + if ([string]::IsNullOrWhiteSpace($safePart)) { + $safePart = "root" } + + $safeParts += $safePart } - return Join-Path "configs" $system $safeName + # Rejoindre toutes les parties avec des underscores + $safeName = $safeParts -join '_' + + # Construire le chemin final + $basePath = Join-Path "configs" $system + return Join-Path $basePath $safeName } # Lire et traiter le fichier de configuration @@ -161,7 +167,7 @@ foreach ($line in $lines) { } } else { # Pour WSL, vérifier via wsl - $exists = wsl test -f "$resolvedPath" 2>$null + wsl test -f "$resolvedPath" 2>$null | Out-Null if ($LASTEXITCODE -ne 0) { Write-Warning "Fichier introuvable dans WSL: $resolvedPath (original: $originalPath)" $skippedCount++ @@ -182,16 +188,22 @@ foreach ($line in $lines) { if ($system -eq 'windows') { Copy-Item -Path $resolvedPath -Destination $projectPath -Force } else { - # Pour WSL, utiliser wsl pour copier - $wslSource = $resolvedPath - $wslDest = (wsl wslpath -a $projectPath) - wsl cp "$wslSource" "$wslDest" - if ($LASTEXITCODE -ne 0) { - # Fallback: utiliser PowerShell pour copier depuis WSL - $tempFile = [System.IO.Path]::GetTempFileName() - wsl cat "$wslSource" | Out-File -FilePath $tempFile -Encoding utf8 - Copy-Item -Path $tempFile -Destination $projectPath -Force - Remove-Item $tempFile + # Pour WSL, utiliser PowerShell pour copier depuis WSL + # Méthode plus fiable : lire le contenu depuis WSL et l'écrire avec PowerShell + try { + $content = wsl cat "$resolvedPath" 2>&1 + if ($LASTEXITCODE -eq 0) { + # Convertir le contenu en chaîne si c'est un tableau + if ($content -is [array]) { + $content = $content -join "`n" + } + Set-Content -Path $projectPath -Value $content -Encoding UTF8 -Force + } else { + throw "Erreur lors de la lecture du fichier WSL: $content" + } + } catch { + Write-Error "Impossible de copier le fichier WSL '$resolvedPath': $_" + throw } } |
