Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Oct 2, 2019
1 parent b0bc2eb commit 630df9c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 50 deletions.
4 changes: 2 additions & 2 deletions b/2012/02/find-rails-partial-references-in-vim/index.html
Expand Up @@ -81,8 +81,8 @@ <h1 class="article-title">Find Rails partial references in Vim</h1>
<li><code>:GrepPartial</code> finds references to the current partial you’re editing.</li>
<li><code>:GrepPartial accounts/show</code> find references to the accounts/show partial.</li>
</ul>
<p>The function uses Fugitive if you have it installed, and if you do then you’ll want to install git with the PCRE library. Homebrew users can install git with PCRE by running:</p>
<pre><code>brew install git --with-pcre</code></pre>
<p>This function doesn’t depend on any plugins. But if you’ve installed Fugitive or the Ack plugins, then the function uses them.</p>


</article>

Expand Down
2 changes: 1 addition & 1 deletion b/2012/02/modern-grep/index.html
Expand Up @@ -58,7 +58,7 @@ <h1 class="article-title">Modern grep</h1>
<p>grep reigned as the preeminent text search tool for a long time. Yet grep’s overly unopinionated
approach to defaults and maintaining backwards compatibility allowed new tools — namely; ack,
the silver searcher, and ripgrep — to encroach on its territory.</p>
<p>grep is ubiquitous. Unix-like systems come with grep installed and you can install grep on Windows. I search with ripgrep on my computer because I can install it once and use its features day-to-day. But when I work on remote systems, it’s more efficient to search with grep.</p>
<p>grep is ubiquitous. Unix-like systems come with grep installed and you can install grep on Windows. I search with ripgrep on my computer because I can install it once and use its features day-to-day. But when I work on remote systems, it’s more efficient to search with grep. It’s worth knowing how to use grep and how to improve it.</p>
<p>With some grep know-how, we can make grep faster and behave like these modern search tools.</p>
<h2 id="exclude-directories">Exclude directories</h2>
<p>grep can exclude directories that it searches, increasing its speed substantially. The following excludes the .git directory from the grep search:</p>
Expand Down
60 changes: 15 additions & 45 deletions b/2012/02/tidying-up-with-the-power-of-g/index.html
Expand Up @@ -20,7 +20,7 @@
ga('create', 'UA-8462120-1', 'travisjeffery.com');
ga('send', 'pageview');
</script>
<title>Tidying up with the power of :g</title>
<title></title>
</head>
<body>
<div class="container-fluid container">
Expand Down Expand Up @@ -51,50 +51,20 @@ <h1 class="logo no-gutters col-xs-12 col-sm-8">

<article class="col-xs-12 no-gutters">
<header>
<h1 class="article-title">Tidying up with the power of :g</h1>
<h1 class="article-title"></h1>
</header>

<p>Vim’s :g takes two inputs: a pattern and an operation, and it runs that operation on
each line that matches the pattern in the current file. :g is a tool whose usage isn’t imposed on
you, nor even readily apparent, so its usefulness depends on your
creativity.</p>
<p>For example, I like to use :g to group related lines that are currently
scattered across a file.</p>
<p>Here’s an example:</p>
<pre><code class="hljs vim">Bundle <span class="hljs-string">'git@github.com:travisjeffery/IndexedSearch.git'</span>
<span class="hljs-comment">" Bundle 'https://github.com/Shougo/neocomplcache.git'</span>
Bundle <span class="hljs-string">'https://github.com/tpope/vim-fugitive.git'</span>
Bundle <span class="hljs-string">'https://github.com/travisjeffery/vim-help'</span>
<span class="hljs-comment">" Bundle 'https://github.com/Lokaltog/vim-powerline.git'</span>
<span class="hljs-comment">" Bundle 'https://github.com/jiangmiao/auto-pairs.git'</span>
Bundle <span class="hljs-string">'https://github.com/tpope/vim-ragtag.git'</span>
Bundle <span class="hljs-string">'git@github.com:travisjeffery/vim-rails.git'</span>
<span class="hljs-comment">" Bundle 'git@github.com:travisjeffery/vim-rails-fork.git'</span>
Bundle <span class="hljs-string">'https://github.com/tpope/vim-repeat.git'</span>
Bundle <span class="hljs-string">'https://github.com/kien/ctrlp.vim.git'</span>
Bundle <span class="hljs-string">'git@github.com:travisjeffery/vim-unimpaired.git'</span>
<span class="hljs-comment">" Bundle 'https://github.com/thinca/vim-poslist.git'</span></code></pre>

<p>The lines that I care about are the commented out lines. In one fell swoop I can group those lines
and put them at the top by running the following:</p>
<pre><code class="hljs"><span class="hljs-symbol">:g/^<span class="hljs-string">"/m 0</span></span></code></pre>

<p>The result with our lines grouped together:</p>
<pre><code class="hljs vim"><span class="hljs-comment">" Bundle 'https://github.com/thinca/vim-poslist.git'</span>
<span class="hljs-comment">" Bundle 'git@github.com:travisjeffery/vim-rails-fork.git'</span>
<span class="hljs-comment">" Bundle 'https://github.com/jiangmiao/auto-pairs.git'</span>
<span class="hljs-comment">" Bundle 'https://github.com/Lokaltog/vim-powerline.git'</span>
<span class="hljs-comment">" Bundle 'https://github.com/Shougo/neocomplcache.git'</span>
Bundle <span class="hljs-string">'git@github.com:travisjeffery/IndexedSearch.git'</span>
Bundle <span class="hljs-string">'https://github.com/tpope/vim-fugitive.git'</span>
Bundle <span class="hljs-string">'https://github.com/travisjeffery/vim-help'</span>
Bundle <span class="hljs-string">'https://github.com/tpope/vim-ragtag.git'</span>
Bundle <span class="hljs-string">'git@github.com:travisjeffery/vim-rails.git'</span>
Bundle <span class="hljs-string">'https://github.com/tpope/vim-repeat.git'</span>
Bundle <span class="hljs-string">'https://github.com/kien/ctrlp.vim.git'</span>
Bundle <span class="hljs-string">'git@github.com:travisjeffery/vim-unimpaired.git'</span></code></pre>

<p>:g is one of the most underrated features in Vim. You can read more about it by running <code>:h :g</code>.</p>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<meta http-equiv="refresh" content="0;url=/b/2012/02/vim-and-the-power-of-g/index.html">
<link rel="canonical" href="/b/2012/02/vim-and-the-power-of-g/index.html">
<script>window.location.replace('/b/2012/02/vim-and-the-power-of-g/index.html');</script>
</head>
<body>This page has been moved to <a href="/b/2012/02/vim-and-the-power-of-g/index.html">/b/2012/02/vim-and-the-power-of-g/index.html</a></body>
</html>


</article>
Expand All @@ -105,8 +75,8 @@ <h1 class="article-title">Tidying up with the power of :g</h1>
<p>
Share: <a href="https://twitter.com/share" class="twitter-share-button"{count} data-via="travisjeffery" data-size="large">Tweet about this article</a><br>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
Written: February 17th, 2012<br>
Tags: vim<br>
Written: <br>
Tags: <br>
<a href="/#recent">Read more posts &#8230;</a>
</p>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -294,7 +294,7 @@ <h3 class="section-header no-gutters col-xs-12" id="vim"><span style="background
</li>
<li>
<span class="list-title col-xs-9"><strong>
<a href="b/2012/02/tidying-up-with-the-power-of-g">Tidying up with the power of :g</a>
<a href="b/2012/02/vim-and-the-power-of-g">Vim and the power of :g</a>
</strong></span><span class="list-date col-xs-3 push-xs-left pull-xs-right">17-02-12</span>
</li>
<li>
Expand Down
2 changes: 1 addition & 1 deletion rss.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[travis jeffery]]></title><description><![CDATA[travis jeffery]]></description><link>https://travisjeffery.com</link><generator>metalsmith-feed</generator><lastBuildDate>Wed, 02 Oct 2019 03:43:11 GMT</lastBuildDate><atom:link href="https://travisjeffery.com/rss.xml" rel="self" type="application/rss+xml"/><author><![CDATA[Travis Jeffery]]></author><item><title><![CDATA[Keep passwords and secrets out of your logs with Go]]></title><description><![CDATA[<!DOCTYPE html>
<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[travis jeffery]]></title><description><![CDATA[travis jeffery]]></description><link>https://travisjeffery.com</link><generator>metalsmith-feed</generator><lastBuildDate>Wed, 02 Oct 2019 10:45:02 GMT</lastBuildDate><atom:link href="https://travisjeffery.com/rss.xml" rel="self" type="application/rss+xml"/><author><![CDATA[Travis Jeffery]]></author><item><title><![CDATA[Keep passwords and secrets out of your logs with Go]]></title><description><![CDATA[<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
Expand Down

0 comments on commit 630df9c

Please sign in to comment.