zigford.org/vim-tip-edit-macro.html
2020-07-21 06:49:32 +10:00

87 lines
2.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="main.css" type="text/css" />
<link rel="stylesheet" href="blog.css" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="Subscribe to this page..." href="feed.rss" />
<title>Vim tips, macro's</title>
</head><body>
<div id="divbodyholder">
<div class="headerholder"><div class="header">
<div id="title">
<h1 class="nomargin"><a class="ablack" href="http://zigford.org/index.html">zigford.org</a></h1>
<div id="description"><a href="about.html">About</a><a href="links.html"> | Links</a><a href="scripts.html"> | Scripts</a><br>Sharing linux/windows scripts and tips</br></div>
</div></div></div>
<div id="divbody"><div class="content">
<!-- entry begin -->
<h3><a class="ablack" href="vim-tip-edit-macro.html">
Vim tips, macro's
</a></h3>
<!-- bashblog_timestamp: #201809020715.09# -->
<div class="subtitle">September 02, 2018 &mdash;
Jesse Harris
</div>
<!-- text begin -->
<p>Google it and you will find a couple of methods to edit vim macros. Here is
the method I like and will continue to use.</p>
<hr />
<p><em>The following will paste a register to a new line, you edit the line and then
yank the content back to the register</em></p>
<ol>
<li>Go to a new line</li>
<li>In normal mode enter <code>"qp</code> where q is the register</li>
<li>Edit the line (use Ctrl+V Ctrl+M to add a return)</li>
<li>Type <code>"qyy</code> to yank the line into register q</li>
</ol>
<p>Here are some key combo's you would have to type in for insert mode operations</p>
<ul>
<li>Enter: <code>Ctrl+v Ctrl+m</code></li>
<li>Escape: <code>Ctrl+v Ctrl+[</code></li>
</ul>
<p>You can also add a macro into your vimrc with the following vimscript</p>
<pre><code> let @q='oAn inserted macro^['
</code></pre>
<p>With this, the macro stored in the q register will use o to open a new line in insert
mode, type 'An inserted macro' and then go back to normal mode.</p>
<p>If you have any comments or feedback, please <a href="mailto:jesse@zigford.org">email</a> me
and let me know if you will allow your feedback to be posted here.</p>
<p>Tags: <a href='tag_vim-tips.html'>vim-tips</a>, <a href='tag_vim.html'>vim</a>, <a href='tag_vim-macros.html'>vim-macros</a></p>
<!-- text end -->
<!-- entry end -->
</div>
<div id="footer">&copy <a href="http://twitter.com/zigford_org">Jesse Harris</a> &mdash; <a href="mailto:jesse&#64;zigford&#46;org">jesse&#64;zigford&#46;org</a><br/>
Generated with <a href="https://github.com/cfenollosa/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>
</div></div>
</body></html>