dblume commited on 2023-02-12 20:43:38
Showing 4 changed files, with 24 additions and 9 deletions.
... | ... |
@@ -162,10 +162,19 @@ command Show :call GitShow() |
162 | 162 |
function! GitDiff() |
163 | 163 |
let l:fname = expand('%:.') |
164 | 164 |
let l:buf = winbufnr(0) |
165 |
- exec ':tabnew | r! git show HEAD:$(git rev-parse --show-prefix)' . l:fname |
|
165 |
+ let l:commit = 'HEAD' |
|
166 |
+ |
|
167 |
+ " If the buffer is not different then repo, then diff HEAD vs file's previous commit |
|
168 |
+ let l:o = system("git status --porcelain | grep " . l:fname) |
|
169 |
+ if v:shell_error != 0 |
|
170 |
+ let l:commit = system('git log -2 --pretty=format:"%h" -- ' . l:fname . ' | tail -n 1') |
|
171 |
+ endif |
|
172 |
+ |
|
173 |
+ " Bug if l:filename includes ".." |
|
174 |
+ exec ':tabnew | r! git show ' . l:commit . ':$(git rev-parse --show-prefix)' . l:fname |
|
166 | 175 |
setl buftype=nofile |
167 | 176 |
0d_ |
168 |
- exec 'silent :file git show HEAD:' . l:fname |
|
177 |
+ exec 'silent :file git show '.l:commit.':' . l:fname |
|
169 | 178 |
exec 'vert sb '.l:buf |
170 | 179 |
windo diffthis |
171 | 180 |
setl buftype=nofile |
... | ... |
@@ -174,6 +183,14 @@ function! GitDiff() |
174 | 183 |
endfunction |
175 | 184 |
command Diff :call GitDiff() |
176 | 185 |
|
186 |
+function! GitLog() |
|
187 |
+ let l:fname = expand('%:t') |
|
188 |
+ exec 'tabnew | r! git log1 -- ' . shellescape(expand('%')) |
|
189 |
+ setl buftype=nofile |
|
190 |
+ exec 'silent :file git log1 ' . l:fname |
|
191 |
+endfunction |
|
192 |
+command Log :call GitLog() |
|
193 |
+ |
|
177 | 194 |
" pastetoggle |
178 | 195 |
nmap <leader>p :set invpaste paste?<cr> |
179 | 196 |
|
... | ... |
@@ -6,8 +6,8 @@ in new user home directories. |
6 | 6 |
### Getting the project |
7 | 7 |
|
8 | 8 |
You can get a copy of this project by clicking on the |
9 |
-[ZIP](http://git.dlma.com/dotfiles.git/zipball/main) |
|
10 |
-or [TAR](http://git.dlma.com/dotfiles.git/tarball/main) buttons |
|
9 |
+[ZIP](https://git.dlma.com/dotfiles.git/zipball/main) |
|
10 |
+or [TAR](https://git.dlma.com/dotfiles.git/tarball/main) buttons |
|
11 | 11 |
near the top right of the GitList web page. |
12 | 12 |
|
13 | 13 |
With an account, you can clone from the origin with: |
... | ... |
@@ -20,7 +20,7 @@ If you're not cloning the repo, then run the following: |
20 | 20 |
|
21 | 21 |
~$ mkdir dotfiles |
22 | 22 |
~$ cd dotfiles |
23 |
- dotfiles$ curl -L http://git.dlma.com/dotfiles.git/tarball/main > dotfiles.tar |
|
23 |
+ dotfiles$ curl -L https://git.dlma.com/dotfiles.git/tarball/main > dotfiles.tar |
|
24 | 24 |
dotfiles$ tar -xvf dotfiles.tar |
25 | 25 |
dotfiles$ rm dotfiles.tar |
26 | 26 |
|
... | ... |
@@ -84,5 +84,5 @@ pinned to a version, `pip install` requirements.in instead of requirements.txt. |
84 | 84 |
|
85 | 85 |
### License |
86 | 86 |
|
87 |
-This software uses the [MIT license](http://git.dlma.com/dotfiles.git/blob/main/LICENSE.txt). |
|
87 |
+This software uses the [MIT license](https://git.dlma.com/dotfiles.git/blob/main/LICENSE.txt). |
|
88 | 88 |
|
89 | 89 |