Skip to content

Instantly share code, notes, and snippets.

@nickjones
Created January 13, 2012 17:29
Show Gist options
  • Save nickjones/1607649 to your computer and use it in GitHub Desktop.
Save nickjones/1607649 to your computer and use it in GitHub Desktop.
Vim syntax to html example (my .vimrc)
<!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>~/.vimrc</title>
<meta name="Generator" content="Vim/7.3">
<meta name="plugin-version" content="vim7.3_v8">
<meta name="syntax" content="vim">
<meta name="settings" content="number_lines,use_css,expand_tabs">
<style type="text/css">
<!--
pre { font-family: monospace; color: #eeeeee; background-color: #000000; }
body { font-family: monospace; color: #eeeeee; background-color: #000000; }
.lnr { color: #ddeeff; background-color: #222222; }
.Constant { color: #339999; }
.String { color: #66ff00; }
.Identifier { color: #ffcc00; }
.Special { color: #33aa00; }
.Normal { color: #eeeeee; background-color: #000000; }
.Type { color: #aaaa77; }
.Comment { color: #9933cc; font-style: italic; }
.PreProc { color: #aaffff; }
.Statement { color: #ff6600; }
-->
</style>
</head>
<body>
<pre>
<span class="lnr"> 1 </span><span class="Statement">set</span> <span class="PreProc">nocompatible</span> <span class="Comment">&quot; Vim mode, not Vi</span>
<span class="lnr"> 2 </span><span class="Statement">syntax</span> <span class="Type">on</span>
<span class="lnr"> 3 </span><span class="Statement">filetype</span> <span class="Type">plugin</span> <span class="Type">indent</span> <span class="Type">on</span>
<span class="lnr"> 4 </span><span class="Statement">call</span> pathogen#<span class="Normal">infect</span><span class="Special">()</span> <span class="Comment">&quot; Load up Tim Pope's stuff</span>
<span class="lnr"> 5 </span><span class="Statement">color</span> vividchalk
<span class="lnr"> 6 </span><span class="Statement">augroup</span> myfiletypes
<span class="lnr"> 7 </span> <span class="Statement">autocmd</span>!
<span class="lnr"> 8 </span> <span class="Statement">autocmd</span> <span class="Type">FileType</span> ruby,eruby,yaml,html,js,css <span class="Statement">setlocal</span> <span class="PreProc">autoindent</span> <span class="PreProc">expandtab</span> <span class="PreProc">shiftwidth</span>=2 <span class="PreProc">softtabstop</span>=2
<span class="lnr"> 9 </span><span class="Statement">augroup</span> END
<span class="lnr">10 </span><span class="Statement">set</span> <span class="PreProc">nu</span>
<span class="lnr">11 </span><span class="Statement">set</span> <span class="PreProc">history</span>=1000 <span class="Comment">&quot; Default is only 20</span>
<span class="lnr">12 </span><span class="Statement">set</span> <span class="PreProc">spell</span> <span class="Comment">&quot; Enable spell checking</span>
<span class="lnr">13 </span><span class="Statement">if</span> <span class="Identifier">has</span><span class="Special">(</span><span class="String">&quot;gui_running&quot;</span><span class="Special">)</span>
<span class="lnr">14 </span> <span class="Statement">set</span> <span class="PreProc">cursorline</span> <span class="Comment">&quot; Highlight the current line</span>
<span class="lnr">15 </span> <span class="Statement">hi</span> cursorline <span class="Type">guibg</span>=<span class="Constant">#333333</span>
<span class="lnr">16 </span> <span class="Statement">hi</span> CursorColumn <span class="Type">guibg</span>=<span class="Constant">#333333</span>
<span class="lnr">17 </span><span class="Statement">else</span>
<span class="lnr">18 </span><span class="Comment"> &quot; Fix up the colors for bad spelling in Vim mode with Rxvt colors and</span>
<span class="lnr">19 </span><span class="Comment"> &quot; vividchalk.</span>
<span class="lnr">20 </span> <span class="Statement">hi</span> SpellBad <span class="Type">ctermbg</span>=black <span class="Type">cterm</span>=<span class="PreProc">bold</span>,<span class="PreProc">underline</span>
<span class="lnr">21 </span><span class="Statement">endif</span>
<span class="lnr">22 </span><span class="Statement">set</span> <span class="PreProc">wildmenu</span> <span class="Comment">&quot; Show list instead of just completing</span>
<span class="lnr">23 </span><span class="Statement">set</span> <span class="PreProc">wildmode</span>=list<span class="Statement">:</span>longest<span class="Statement">,</span>full <span class="Comment">&quot; command &lt;Tab&gt; completion</span>
<span class="lnr">24 </span>
<span class="lnr">25 </span><span class="Comment">&quot; Patch systemverilog.vim to match filenames</span>
<span class="lnr">26 </span><span class="Statement">augroup</span> filetypedetect
<span class="lnr">27 </span> <span class="Statement">au</span> <span class="Type">BufNewFile</span>,<span class="Type">BufRead</span> *.sv <span class="Statement">setf</span> systemverilog
<span class="lnr">28 </span><span class="Statement">augroup</span> END
<span class="lnr">29 </span>
<span class="lnr">30 </span><span class="Comment">&quot; Execute open rspec buffer</span>
<span class="lnr">31 </span><span class="Comment">&quot; Thanks to Ian Smith-Heisters</span>
<span class="lnr">32 </span><span class="Statement">function</span>! RunSpec<span class="Special">(</span>args<span class="Special">)</span>
<span class="lnr">33 </span> <span class="Statement">if</span> <span class="Identifier">exists</span><span class="Special">(</span><span class="String">&quot;b:rails_root&quot;</span><span class="Special">)</span> <span class="Statement">&amp;&amp;</span> <span class="Identifier">filereadable</span><span class="Special">(</span>b:rails_root <span class="Statement">.</span> <span class="String">&quot;/script/spec&quot;</span><span class="Special">)</span>
<span class="lnr">34 </span> <span class="Statement">let</span> spec <span class="Statement">=</span> b:rails_root <span class="Statement">.</span> <span class="String">&quot;/script/spec&quot;</span>
<span class="lnr">35 </span> <span class="Statement">else</span>
<span class="lnr">36 </span> <span class="Statement">let</span> spec <span class="Statement">=</span> <span class="String">&quot;spec&quot;</span>
<span class="lnr">37 </span> <span class="Statement">end</span>
<span class="lnr">38 </span> <span class="Statement">let</span> cmd <span class="Statement">=</span> <span class="String">&quot;:! &quot;</span> <span class="Statement">.</span> spec <span class="Statement">.</span> <span class="String">&quot; % -cfn &quot;</span> <span class="Statement">.</span> <span class="Identifier">a:args</span>
<span class="lnr">39 </span> <span class="Statement">execute</span> cmd
<span class="lnr">40 </span><span class="Statement">endfunction</span>
<span class="lnr">41 </span>
<span class="lnr">42 </span><span class="Comment">&quot; Mappings</span>
<span class="lnr">43 </span><span class="Comment">&quot; run one rspec example or describe block based on cursor position</span>
<span class="lnr">44 </span><span class="Statement">map</span> !s :call RunSpec(&quot;-l &quot; . <span class="Special">&lt;</span><span class="Special">C-r</span><span class="Special">&gt;</span>=line('.')<span class="Special">&lt;</span><span class="Special">CR</span><span class="Special">&gt;</span>)<span class="Special">&lt;</span><span class="Special">CR</span><span class="Special">&gt;</span>
<span class="lnr">45 </span><span class="Comment">&quot; run full rspec file</span>
<span class="lnr">46 </span><span class="Statement">map</span> !S :call RunSpec(&quot;&quot;)<span class="Special">&lt;</span><span class="Special">CR</span><span class="Special">&gt;</span>
</pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment