💾 Archived View for gmi.noulin.net › gitRepositories › systemSetup › file › dotfiles › .vim › plugin… captured on 2024-08-25 at 00:52:43. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
dirdiff.vim (30620B)
1 " -*- vim -*- 2 " FILE: "/home/wlee/.vim/plugin/DirDiff.vim" {{{ 3 " LAST MODIFICATION: "Wed, 11 Apr 2012 15:49:03 -0500 (wlee)" 4 " HEADER MAINTAINED BY: N/A 5 " VERSION: 1.1.5 6 " (C) 2001-2015 by William Lee, <wl1012@yahoo.com> 7 " }}} 8 9 " Public Interface: 10 command! -nargs=* -complete=dir DirDiff call <SID>DirDiff (<f-args>) 11 command! -nargs=0 DirDiffOpen call <SID>DirDiffOpen () 12 command! -nargs=0 DirDiffNext call <SID>DirDiffNext () 13 command! -nargs=0 DirDiffPrev call <SID>DirDiffPrev () 14 command! -nargs=0 DirDiffUpdate call <SID>DirDiffUpdate () 15 command! -nargs=0 DirDiffQuit call <SID>DirDiffQuit () 16 17 " The following comamnds can be used in the Vim diff mode: 18 " 19 " \dg - Diff get: maps to :diffget<CR> 20 " \dp - Diff put: maps to :diffput<CR> 21 " \dj - Diff next: (think j for down) 22 " \dk - Diff previous: (think k for up) 23 24 if !exists("g:DirDiffEnableMappings") 25 let g:DirDiffEnableMappings = 0 26 endif 27 28 if g:DirDiffEnableMappings 29 nnoremap <unique> <Leader>dg :diffget<CR> 30 nnoremap <unique> <Leader>dp :diffput<CR> 31 nnoremap <unique> <Leader>dj :DirDiffNext<CR> 32 nnoremap <unique> <Leader>dk :DirDiffPrev<CR> 33 endif 34 35 " Global Maps: 36 37 " Default Variables. You can override these in your global variables 38 " settings. 39 " 40 " For DirDiffExcludes and DirDiffIgnore, separate different patterns with a 41 " ',' (comma and no space!). 42 " 43 " eg. in your .vimrc file: let g:DirDiffExcludes = "CVS,*.class,*.o" 44 " let g:DirDiffIgnore = "Id:" 45 " " ignore white space in diff 46 " let g:DirDiffAddArgs = "-w" 47 " 48 " You can set the pattern that diff excludes. Defaults to the CVS directory 49 if !exists("g:DirDiffExcludes") 50 let g:DirDiffExcludes = "" 51 endif 52 " This is the -I argument of the diff, ignore the lines of differences that 53 " matches the pattern 54 if !exists("g:DirDiffIgnore") 55 let g:DirDiffIgnore = "" 56 endif 57 if !exists("g:DirDiffSort") 58 let g:DirDiffSort = 1 59 endif 60 if !exists("g:DirDiffWindowSize") 61 let g:DirDiffWindowSize = 14 62 endif 63 if !exists("g:DirDiffInteractive") 64 let g:DirDiffInteractive = 0 65 endif 66 if !exists("g:DirDiffIgnoreCase") 67 let g:DirDiffIgnoreCase = 0 68 endif 69 " Additional arguments 70 if !exists("g:DirDiffAddArgs") 71 let g:DirDiffAddArgs = "" 72 endif 73 " Support for i18n (dynamically figure out the diff text) 74 " Defaults to off 75 if !exists("g:DirDiffDynamicDiffText") 76 let g:DirDiffDynamicDiffText = 0 77 endif 78 79 " String used for the English equivalent "Files " 80 if !exists("g:DirDiffTextFiles") 81 let g:DirDiffTextFiles = "Files " 82 endif 83 84 " String used for the English equivalent " and " 85 if !exists("g:DirDiffTextAnd") 86 let g:DirDiffTextAnd = " and " 87 endif 88 89 " String used for the English equivalent " differ") 90 if !exists("g:DirDiffTextDiffer") 91 let g:DirDiffTextDiffer = " differ" 92 endif 93 94 " String used for the English equivalent "Only in ") 95 if !exists("g:DirDiffTextOnlyIn") 96 let g:DirDiffTextOnlyIn = "Only in " 97 endif 98 99 " String used for the English equivalent ": ") 100 if !exists("g:DirDiffTextOnlyInCenter") 101 let g:DirDiffTextOnlyInCenter = ": " 102 endif 103 104 " Set some script specific variables: 105 " 106 let s:DirDiffFirstDiffLine = 6 107 let s:DirDiffALine = 1 108 let s:DirDiffBLine = 2 109 110 " -- Variables used in various utilities 111 if has("unix") 112 let s:DirDiffCopyCmd = "cp" 113 let s:DirDiffCopyFlags = "" 114 let s:DirDiffCopyDirCmd = "cp" 115 let s:DirDiffCopyDirFlags = "-rf" 116 let s:DirDiffCopyInteractiveFlag = "-i" 117 118 let s:DirDiffDeleteCmd = "rm" 119 let s:DirDiffDeleteFlags = "" 120 let s:DirDiffDeleteInteractiveFlag = "-i" 121 122 let s:DirDiffDeleteDirCmd = "rm" 123 let s:DirDiffDeleteDirFlags = "-rf" 124 125 let s:sep = "/" 126 127 let s:DirDiffMakeDirCmd = "!mkdir " 128 129 elseif has("win32") 130 let s:DirDiffCopyCmd = "copy" 131 let s:DirDiffCopyFlags = "" 132 let s:DirDiffCopyDirCmd = "xcopy" 133 let s:DirDiffCopyDirFlags = "/e /i /q" 134 let s:DirDiffCopyInteractiveFlag = "/-y" 135 136 let s:DirDiffDeleteCmd = "del" 137 let s:DirDiffDeleteFlags = "/s /q" 138 let s:DirDiffDeleteInteractiveFlag = "/p" 139 " Windows is somewhat stupid since "del" can only remove the files, not 140 " the directory. The command "rd" would remove files recursively, but it 141 " doesn't really work on a file (!). where is the deltree command??? 142 143 let s:DirDiffDeleteDirCmd = "rd" 144 " rd is by default prompting, we need to handle this in a different way 145 let s:DirDiffDeleteDirFlags = "/s" 146 let s:DirDiffDeleteDirQuietFlag = "/q" 147 148 let s:sep = "\\" 149 150 let s:DirDiffMakeDirCmd = "!mkdir " 151 else 152 " Platforms not supported 153 let s:DirDiffCopyCmd = "" 154 let s:DirDiffCopyFlags = "" 155 let s:DirDiffDeleteCmd = "" 156 let s:DirDiffDeleteFlags = "" 157 let s:sep = "" 158 endif 159 160 161 function! <SID>DirDiff(srcA, srcB) 162 " Setup 163 let DirDiffAbsSrcA = fnamemodify(expand(a:srcA, ":p"), ":p") 164 let DirDiffAbsSrcB = fnamemodify(expand(a:srcB, ":p"), ":p") 165 166 " Check for an internationalized version of diff ? 167 call <SID>GetDiffStrings() 168 169 " Remove the trailing \ or / 170 let DirDiffAbsSrcA = substitute(DirDiffAbsSrcA, '\\$\|/