Vim:如何在“$ vim file.tgz"之后创建文件? [英] Vim: How can I create a file after "$ vim file.tgz"?

查看:30
本文介绍了Vim:如何在“$ vim file.tgz"之后创建文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个压缩包的文件,不显式打开/解压它,而是直接使用 Vim.这可能吗?

I want to create a file to tarball, without explicitly opening/extracting it but directly by using Vim. Is that possible?

$ vim file.tgz
:e someNewfile
:w!    # how can I create here a file?

推荐答案

Vim 使用名为 tar.vim 的 vimscript 处理 tar 和派生文件(包括 .tgz).你可以通过在 vim 中输入 :help tar 来查看 tar.vim 的文档.根据该文档:

Vim handles tar and derived files (including .tgz) using a vimscript called tar.vim. You can see tar.vim's documentation by typing :help tar<CR> inside vim. According to that documentation:

当你编辑一个 *.tar 文件时,这个插件会处理显示一个内容页面.通过将光标移动到文件顶部来选择要编辑的文件所需的文件,然后点击 键.编辑后还可以写入文件.目前,您可能无法通过插件在 tar 存档中创建新文件.

When one edits a *.tar file, this plugin will handle displaying a contents page. Select a file to edit by moving the cursor atop the desired file, then hit the <return> key. After editing, one may also write to the file. Currently, one may not make a new file in tar archives via the plugin.

因此您可以编辑已经在 tar 中的文件,但目前您无法使用 vim 的 vanilla 设置添加新文件.

So you can edit a file which is already in the tar, but you cannot currently add new files using a vanilla setup of vim.

这篇关于Vim:如何在“$ vim file.tgz"之后创建文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆