Vim:如何在“$ vim file.tgz"之后创建文件?

编程入门 行业动态 更新时间:2024-10-11 23:23:01
本文介绍了Vim:如何在“$ vim file.tgz"之后创建文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我想创建一个压缩包的文件,不显式打开/解压它,而是直接使用 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屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 10:08:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1407707.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   如何在   vim   Vim   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!