Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

VimL

Remove syntax highlighting from inactive buffers

1
2
3
4
5
6
7
augroup BgHighlight
    autocmd!
    highlight InactiveWindow ctermfg=gray
    
    autocmd WinLeave,BufNewFile,BufRead * call matchadd('InactiveWindow', '.*', 5)
    autocmd WinEnter,BufEnter * call clearmatches()
augroup END
https://snipt.net/embed/df9a1b7747b04b24ae309ed2f94bcd70/
https://snipt.net/raw/df9a1b7747b04b24ae309ed2f94bcd70/
df9a1b7747b04b24ae309ed2f94bcd70
vim
VimL
8
2016-12-03T17:28:27
True
False
False
/api/public/snipt/23324/
highlight-active-window
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>augroup BgHighlight </span><span id="L-2"><a name="L-2"></a> autocmd<span class="p">!</span> </span><span id="L-3"><a name="L-3"></a> <span class="nb">highlight</span> InactiveWindow ctermfg<span class="p">=</span>gray </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a> autocmd <span class="nb">WinLeave</span><span class="p">,</span><span class="nb">BufNewFile</span><span class="p">,</span><span class="nb">BufRead</span> * <span class="k">call</span> matchadd<span class="p">(</span><span class="s1">&#39;InactiveWindow&#39;</span><span class="p">,</span> <span class="s1">&#39;.*&#39;</span><span class="p">,</span> <span class="m">5</span><span class="p">)</span> </span><span id="L-6"><a name="L-6"></a> autocmd <span class="nb">WinEnter</span><span class="p">,</span><span class="nb">BufEnter</span> * <span class="k">call</span> clearmatches<span class="p">()</span> </span><span id="L-7"><a name="L-7"></a>augroup END </span></pre></div> </td></tr></table>
active, highlight, vim

JavaScript

Highlight all div elements on page

javascript:var%20eL=document.getElementsByTagName('div');for(i=0;i%3CeL.length;i++)%7Bvoid(eL%5Bi%5D.style.border='solid%201px%20red')%7D
https://snipt.net/embed/421403ebcd22826355affd469c29f583/
https://snipt.net/raw/421403ebcd22826355affd469c29f583/
421403ebcd22826355affd469c29f583
js
JavaScript
1
2016-12-03T14:23:46
True
False
False
/api/public/snipt/14513/
highlight-all-div-elements-on-page-using-a-specified-colour
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">javascript</span><span class="o">:</span><span class="kd">var</span><span class="o">%</span><span class="mi">20</span><span class="nx">eL</span><span class="o">=</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="s1">&#39;div&#39;</span><span class="p">);</span><span class="k">for</span><span class="p">(</span><span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="nx">i</span><span class="o">%</span><span class="mi">3</span><span class="nx">CeL</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span><span class="nx">i</span><span class="o">++</span><span class="p">)</span><span class="o">%</span><span class="mi">7</span><span class="nx">Bvoid</span><span class="p">(</span><span class="nx">eL</span><span class="o">%</span><span class="mi">5</span><span class="nx">Bi</span><span class="o">%</span><span class="mi">5</span><span class="nx">D</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">border</span><span class="o">=</span><span class="s1">&#39;solid%201px%20red&#39;</span><span class="p">)</span><span class="o">%</span><span class="mi">7</span><span class="nx">D</span> </span></pre></div> </td></tr></table>
bookmarklet, display, div, dom, element, favelet, highlight, javascript, js
Copyrighted, illegal, or inappropriate content? Email [email protected].