tarPlugin.vim 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. " tarPlugin.vim -- a Vim plugin for browsing tarfiles
  2. " Original was copyright (c) 2002, Michael C. Toren <mct@toren.net>
  3. " Modified by Charles E. Campbell
  4. " Distributed under the GNU General Public License.
  5. "
  6. " Updates are available from <http://michael.toren.net/code/>. If you
  7. " find this script useful, or have suggestions for improvements, please
  8. " let me know.
  9. " Also look there for further comments and documentation.
  10. "
  11. " This part only sets the autocommands. The functions are in autoload/tar.vim.
  12. " ---------------------------------------------------------------------
  13. " Load Once: {{{1
  14. if &cp || exists("g:loaded_tarPlugin")
  15. finish
  16. endif
  17. let g:loaded_tarPlugin = "v32"
  18. let s:keepcpo = &cpo
  19. set cpo&vim
  20. " ---------------------------------------------------------------------
  21. " Public Interface: {{{1
  22. augroup tar
  23. au!
  24. au BufReadCmd tarfile::* call tar#Read(expand("<amatch>"), 1)
  25. au FileReadCmd tarfile::* call tar#Read(expand("<amatch>"), 0)
  26. au BufWriteCmd tarfile::* call tar#Write(expand("<amatch>"))
  27. au FileWriteCmd tarfile::* call tar#Write(expand("<amatch>"))
  28. if has("unix")
  29. au BufReadCmd tarfile::*/* call tar#Read(expand("<amatch>"), 1)
  30. au FileReadCmd tarfile::*/* call tar#Read(expand("<amatch>"), 0)
  31. au BufWriteCmd tarfile::*/* call tar#Write(expand("<amatch>"))
  32. au FileWriteCmd tarfile::*/* call tar#Write(expand("<amatch>"))
  33. endif
  34. au BufReadCmd *.tar.gz call tar#Browse(expand("<amatch>"))
  35. au BufReadCmd *.tar call tar#Browse(expand("<amatch>"))
  36. au BufReadCmd *.lrp call tar#Browse(expand("<amatch>"))
  37. au BufReadCmd *.tar.bz2 call tar#Browse(expand("<amatch>"))
  38. au BufReadCmd *.tar.Z call tar#Browse(expand("<amatch>"))
  39. au BufReadCmd *.tbz call tar#Browse(expand("<amatch>"))
  40. au BufReadCmd *.tgz call tar#Browse(expand("<amatch>"))
  41. au BufReadCmd *.tar.lzma call tar#Browse(expand("<amatch>"))
  42. au BufReadCmd *.tar.xz call tar#Browse(expand("<amatch>"))
  43. au BufReadCmd *.txz call tar#Browse(expand("<amatch>"))
  44. au BufReadCmd *.tar.zst call tar#Browse(expand("<amatch>"))
  45. au BufReadCmd *.tzs call tar#Browse(expand("<amatch>"))
  46. augroup END
  47. com! -nargs=? -complete=file Vimuntar call tar#Vimuntar(<q-args>)
  48. " ---------------------------------------------------------------------
  49. " Restoration And Modelines: {{{1
  50. " vim: fdm=marker
  51. let &cpo= s:keepcpo
  52. unlet s:keepcpo