Quantcast
Channel: Vimタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 5608

#vim でコンソールのテキストをHTML化する ( :TOhtml ) ( 色や行番号も保存される )

$
0
0

いつもの画面

image

:TOhtmlを入力

な、なんじゃこりゃー!

image

保存

:wで元のファイル名 + .html で保存されるっぽい。

HTML

い、色や行番号も保存されているだと…?

image

HTML source

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>/private/tmp/html.html</title>
<meta name="Generator" content="Vim/8.1">
<meta name="plugin-version" content="vim8.1_v1">
<meta name="syntax" content="none">
<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #ffffff; background-color: #000000; }
body { font-family: monospace; color: #ffffff; background-color: #000000; }
* { font-size: 1em; }
.LineNr { color: #ffff00; }
-->
</style>

<script type='text/javascript'>
<!--

/* function to open any folds containing a jumped-to line before jumping to it */
function JumpToLine()
{
  var lineNum;
  lineNum = window.location.hash;
  lineNum = lineNum.substr(1); /* strip off '#' */

  if (lineNum.indexOf('L') == -1) {
    lineNum = 'L'+lineNum;
  }
  var lineElem = document.getElementById(lineNum);
  /* Always jump to new location even if the line was hidden inside a fold, or
   * we corrected the raw number to a line ID.
   */
  if (lineElem) {
    lineElem.scrollIntoView(true);
  }
  return true;
}
if ('onhashchange' in window) {
  window.onhashchange = JumpToLine;
}

-->
</script>
</head>
<body onload='JumpToLine();'>
<pre id='vimCodeElement'>
<span id="L1" class="LineNr">1 </span>
<span id="L2" class="LineNr">2 </span>Yes
<span id="L3" class="LineNr">3 </span>
<span id="L4" class="LineNr">4 </span>Oh
<span id="L5" class="LineNr">5 </span>
<span id="L6" class="LineNr">6 </span>yes
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->

ref

Vimテクニックバイブル~作業効率をカイゼンする150の技 | Vimサポーターズ | 工学 | Kindleストア | Amazon

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/1684


Viewing all articles
Browse latest Browse all 5608

Trending Articles