打印最多第 100 列

发布于 2025-01-02 20:09:21 字数 396 浏览 2 评论 0原文

我写东西的方式看起来像这样 - 我在 Vim 中设置了一个 colorcolumn 为 100。将打印并进入手册的实际内容进入文本那是在第 100 栏之前,我的笔记、评论……不应该看到的东西,或者与当前版本无关的东西在第 100 栏之后。

这是一个非常简单而有效的系统。

所以,这是我的问题...如何打印(转换为 PDF)第 100 列之前的所有内容,而忽略其后的任何内容?

我正在考虑一个系统:移动所有内容到一个临时文件中,删除第 100 列之后的所有内容,打印剩余的内容 ...但是有没有一种方法可以使它非常快,比如将其放入一个命令/函数中,所以我不'不必经历五个不同的步骤 道路?

欢迎所有建设性想法......

My way of writing stuff looks something like this - I have a colorcolumn in Vim set on 100. The actual stuff that will get printed and go in the manual goes into the text that is before the 100th column, and my notes, comments, ... stuff that should not be seen, or that isn't relevant to the current version goes afterwards the 100th column.

It is an amazingly simple and effective system.

So, here's my question ... how can I print (into PDF) everything up to 100th column, disregarding anything after it?

I was thinking of a system: move everything into a temporary file, delete everything after the 100th column, print the remaining stuff ... but is there a way to make this really quick, like put it into one command/function, so I don't have to step through five different steps along the way?

All constructive ideas welcomed ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小瓶盖 2025-01-09 20:09:21

如果您有 pdf 打印机(例如安装了 cups-pdf),您可以执行以下操作:

  1. :set pdev=pdfENTER
  2. :设置 printoptions=paper:A4,syntax:y,wrap:yENTER
  3. :%s:^\(.\{100\}\).*:\1:回车
  4. :硬拷贝回车< /kbd>
  5. u

我将由您来创建一个函数/命令。

Well if you have a pdf printer (e.g. cups-pdf installed you can do something like:

  1. :set pdev=pdfENTER
  2. :set printoptions=paper:A4,syntax:y,wrap:yENTER
  3. :%s:^\(.\{100\}\).*:\1:ENTER
  4. :hardcopyENTER
  5. u

I'm leaving it to you to create a function/command from it.

时光匆匆的小流年 2025-01-09 20:09:21

你的意思是vim吗?

:%s/.*/\=getline('.')[:100]/

Do you mean vim?

:%s/.*/\=getline('.')[:100]/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文