Created
May 29, 2009 06:22
-
-
Save thinca/119811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 077af6f393ea55fb9df2030e85b8f1634e778459 Mon Sep 17 00:00:00 2001 | |
From: thinca <thinca@gmail.com> | |
Date: Fri, 29 May 2009 14:56:13 +0900 | |
Subject: [PATCH 1/2] Fix the way to check the extension of zip. | |
Because extension is case insensitive. | |
--- | |
vim/dot.vim/autoload/ku/file.vim | 4 ++-- | |
1 files changed, 2 insertions(+), 2 deletions(-) | |
diff --git a/vim/dot.vim/autoload/ku/file.vim b/vim/dot.vim/autoload/ku/file.vim | |
index 93c41e9..0ee366d 100644 | |
--- a/vim/dot.vim/autoload/ku/file.vim | |
+++ b/vim/dot.vim/autoload/ku/file.vim | |
@@ -145,7 +145,7 @@ endfunction | |
function! s:archive_basename(path) "{{{2 | |
" FIXME: Same as s:archive_type() | |
- return matchstr(a:path, '\C^.\{-}\ze\(\.zip\)\?$') | |
+ return matchstr(a:path, '\c^.\{-}\ze\(\.zip\)\?$') | |
endfunction | |
@@ -158,7 +158,7 @@ function! s:archive_type(path) "{{{2 | |
" FIXME: Support "recursive archives", but how? | |
" Is it a file with a standard extension, not a directory? | |
- if a:path =~# '\.zip$' && filereadable(a:path) | |
+ if a:path =~? '\.zip$' && filereadable(a:path) | |
return s:ARCHIVE_TYPE_ZIP | |
else | |
return s:ARCHIVE_TYPE_INVALID | |
-- | |
1.6.3.1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 4e897419108ee9277f6de6dec471413360dc66f9 Mon Sep 17 00:00:00 2001 | |
From: thinca <thinca@gmail.com> | |
Date: Fri, 29 May 2009 15:01:56 +0900 | |
Subject: [PATCH 2/2] Improve the way to list files in zip archive. | |
The zipinfo mode was used instead of -l option. | |
--- | |
vim/dot.vim/autoload/ku/file.vim | 28 ++-------------------------- | |
1 files changed, 2 insertions(+), 26 deletions(-) | |
diff --git a/vim/dot.vim/autoload/ku/file.vim b/vim/dot.vim/autoload/ku/file.vim | |
index 0ee366d..e70e256 100644 | |
--- a/vim/dot.vim/autoload/ku/file.vim | |
+++ b/vim/dot.vim/autoload/ku/file.vim | |
@@ -182,38 +182,14 @@ endfunction | |
function! s:command_unzip_list(archive_path) "{{{2 | |
- let output = s:command_unzip('-l', '--', shellescape(a:archive_path)) | |
+ let output = s:command_unzip('-Z', '-1', '--', shellescape(a:archive_path)) | |
if v:shell_error != 0 " FIXME: test | |
echoerr 'ku: file: Failed to list the content of a zip archive:' | |
echoerr '--' output | |
return [] | |
endif | |
- " FIXME: Is this parsing good enough? | |
- " | |
- " $ unzip -l vim-ku-0.2.3.zip | |
- " Archive: foo.zip | |
- " Length Date Time Name | |
- " -------- ---- ---- ---- | |
- " 60535 05-22-09 22:09 vim-ku-0.2.3/autoload/ku.vim | |
- " 49435 05-22-09 22:09 vim-ku-0.2.3/doc/ku.txt | |
- " 1582 05-22-09 22:09 vim-ku-0.2.3/plugin/ku.vim | |
- " 2449 05-22-09 22:09 vim-ku-0.2.3/syntax/ku.vim | |
- " 3731 05-22-09 02:02 vim-ku-0.2.3/autoload/ku/buffer.vim | |
- " 4079 05-16-09 01:48 vim-ku-0.2.3/doc/ku-buffer.txt | |
- " 4718 05-22-09 02:02 vim-ku-0.2.3/autoload/ku/file.vim | |
- " 4985 05-22-09 00:57 vim-ku-0.2.3/doc/ku-file.txt | |
- " 3310 05-22-09 02:02 vim-ku-0.2.3/autoload/ku/history.vim | |
- " 3895 05-16-09 01:48 vim-ku-0.2.3/doc/ku-history.txt | |
- " 2893 05-22-09 22:09 vim-ku-0.2.3/autoload/ku/source.vim | |
- " 3722 05-22-09 22:09 vim-ku-0.2.3/doc/ku-source.txt | |
- " -------- ------- | |
- " 145334 12 files | |
- let lines = split(output, '\n') | |
- call map(lines, | |
- \ 'matchstr(v:val, ''^\s*\d\+\s\+[0-9-]\+\s\+[0-9:]\+\s\+\zs.*$'')') | |
- call filter(lines, 'v:val != ""') | |
- return lines " ['vim-ku-0.2.3/autoload/ku.vim', ...] | |
+ return split(output, '\n') " ['vim-ku-0.2.3/autoload/ku.vim', ...] | |
endfunction | |
-- | |
1.6.3.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment