Vim https://yyhh.org/notebook/vim en Install Vim with Homebrew Python on OS X https://yyhh.org/blog/2012/05/install-vim-homebrew-python-os-x <span>Install Vim with Homebrew Python on OS X</span> <span><a title="View user profile." href="/user/huahai" lang="" about="/user/huahai" typeof="schema:Person" property="schema:name" datatype="">Huahai</a></span> <span>Wed, 05/16/2012 - 05:50</span> <div class="field field--name-field-notebook field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><div about="/notebook/vim" id="taxonomy-term-17" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/vim"> <div class="field field--name-name field--type-string field--label-hidden field__item">Vim</div> </a> <div class="content"> </div> </div> </div> <div class="field__item"><div about="/notebook/osx" id="taxonomy-term-37" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/osx"> <div class="field field--name-name field--type-string field--label-hidden field__item">OSX</div> </a> <div class="content"> </div> </div> </div> </div> <div class="field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="tex2jax_process"><p>For people that need full features of vim, the default installation of vim on Mac OS X is definitely not enough. For example, I need to <a href="http://yyhh.org/blog/2007/10/posting-blog-entry-drupal-within-vim">use vim to post to this blog</a>, which requires a version of vim with python support. I also prefer terminal version of vim to the GUI version, so <a href="http://code.google.com/p/macvim/">MacVim</a> is less desirable. </p> <p>One way to get what I want is to compile a version of vim with <a href="http://mxcl.github.com/homebrew/">homebrew</a>. Homebrew does not officially have a vim fomula, because that would be a duplicate of the system version. Fortunately, we can grab an unofficial formula at<br /><i><a href="https://raw.github.com/Homebrew/homebrew-dupes/master/vim.rb">https://raw.github.com/Homebrew/homebrew-dupes/master/vim.rb</a></i></p> <p>Also, you may want to install the latest homebrew python with the framework option: </p> <div class="codeblock"> brew install python --framework </div> <p>In order for vim to use the homebrew version of python (2.7.3) instead of the system one (an old 2.6), we need to change a line and add a line in the downloaded formula (vim.rb) file:</p> <div class="codeblock"> ...<br /> "--enable-pythoninterp=dynamic",<br /> "--with-python-config-dir=/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",<br /> ... </div> <p>Now install vim with the formula:</p> <div class="codeblock"> brew install ./vim.rb </div> <p>To check vim is using the correct version of python. Issue command in vim:</p> <div class="codeblock"> :python import sys; print sys.version </div> <p>If we get something like this:</p> <div class="codeblock"> 2.7.3 (default, May 15 2012, 20:51:34)<br /> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]<br /> Press ENTER or type command to continue </div> <p>we are done!</p> </div></div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=152&amp;2=comment_node_blog&amp;3=comment_node_blog" token="yTThkv7YLDDUEe8ulF9-aAD7PGz0pBc-WF1WU7Nma0U"></drupal-render-placeholder> </section> <strong class="node_view"></strong> Wed, 16 May 2012 04:50:40 +0000 Huahai 152 at https://yyhh.org Reference to Individual Email Message in Plain Text File https://yyhh.org/blog/2007/12/reference-individual-email-message-plain-text-file <span>Reference to Individual Email Message in Plain Text File</span> <span><a title="View user profile." href="/user/huahai" lang="" about="/user/huahai" typeof="schema:Person" property="schema:name" datatype="">Huahai</a></span> <span>Thu, 12/13/2007 - 22:40</span> <div class="field field--name-field-notebook field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><div about="/notebook/vim" id="taxonomy-term-17" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/vim"> <div class="field field--name-name field--type-string field--label-hidden field__item">Vim</div> </a> <div class="content"> </div> </div> </div> <div class="field__item"><div about="/notebook/linux" id="taxonomy-term-16" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/linux"> <div class="field field--name-name field--type-string field--label-hidden field__item">Linux</div> </a> <div class="content"> </div> </div> </div> <div class="field__item"><div about="/notebook/gtd" id="taxonomy-term-31" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/gtd"> <div class="field field--name-name field--type-string field--label-hidden field__item">GTD</div> </a> <div class="content"> </div> </div> </div> </div> <div class="field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="tex2jax_process"><p>A lot of people implement <a href="http://saw.themurdaughs.com/gtd-with-gmail-whitepaper">GTD methodology entirely with Gmail</a>. I don't feel comfortable doing that because gmail is not that secure. And I think depending on a network service is a bad idea for a GTD system. So I still download all my emails to my local computers. As <a href="http://yyhh.org/blog/2007/12/simple-gtd-list-solution-desktop-web-and-possibly-mobile">my plain text based GTD implementation</a> was taking shape, I realized that I needed to refer to individual email messages in my local mail folders, both in the "Projects/Next-Action" list and as reference materials. For example, in my list, there would be an item "think about Johon's request", and it should include a link to the email message containing John's request. Ideally, invoking this link should open up this email message in <em>kmail</em>, my email reader. Also, I would like the creation of such a link in my list to be semi-automatic. </p> <p>The first problem is to find the unique id for the email message. Although there's an Message-ID field in standard email format, kmail does not make it easy to use that field. It turns out that just using the unique filename of email messages is sufficient. Kmail by default uses <em>maildir</em> format to store emails, and maildir stores each message as an individual file with a unique name. This situation makes linking to email messages as easy as linking to files. Now the question is, how do I know what filename an individual email message is saved as?</p> <p>The answer is I don't know, kmail does not reveal that information. At least I don't know the filename when the email is first saved in my email folder. But, the good news is, I don't need to know the filename when the email is in my inbox. Because, as GTD methodology decrees, stuff in inbox should not be permanent, but is to be moved into either projects/next-action list or reference collection. Now, when I process my inbox, and move a message into my GTD email folder, I can figure out what name it is saved in. No, I am not suggesting using kmail's "save-as" method. That's still too much work, because I then have to open a file browser, choose a filename for the email to save as, and manually put a link to that file in my list. Besides, kmail can only "save-as" mbox format, and it sucks.</p> <p>What I now end up with is a neat solution. Basically, all I need to do, is to drag a message into my local GTD mail folder in kmail. And a link to the saved message will be automatically inserted into my plain-text project/next-action list or my reference file, depending on a dialog selection. This screen shot shows an email being dragged into GTD folder in kmail: <img src="http://i274.photobucket.com/albums/jj251/huahaiy/kmail-drag-gtd.png" /></p> <p>A dialog then shows up:<img src="http://i274.photobucket.com/albums/jj251/huahaiy/kmail-drag-gtd-dialog.png" />. </p> <p>After making a selection, a reference to the email message is inserted in vim, which looks like this:<br /></p><div class="codeblock">&lt;mail:~/Mail/GTD/cur/1197479411.14855.WSF8K:2,S&gt;</div> <p>This implementation depends on <a href="http://inotify-tools.sourceforge.net/">inotify-tools</a>, which utilizes newer Linux kernel's <em>inotify</em> capability. It watches GTD mail folder. When an email message is moved into this folder, a script records its filename, and inserts a link to the email in my project/next-action list. This solution also depends on <em>vim</em> with server mode support, so other program can send commands to it. I always start my projects/next-action editing session in server mode, with special server names, such as "active_projects":<br /></p><div class="codeblock">gvim --servername "active_projects" projects.taskpaper</div> <p> Finally, a vim plug-in <a href="http://www.vim.org/scripts/script.php?script_id=293">utl.vim</a> is needed to invoke any URL in plain text.</p> <p>All these components are glued together with a simple shell script <em>~/bin/email2gtd.sh</em>:<br /></p><div class="codeblock"> <font face="monospace"><br /><font color="#a0b0c0"><i>#!/bin/bash</i></font><br /><font color="#a0b0c0"><i># waiting for email message being dropped in GTD mail folder, then insert</i></font><br /><font color="#a0b0c0"><i># a reference to the email in one of the available vim server buffers,</i></font><br /><font color="#a0b0c0"><i># depending on user selection in dialog prompt</i></font><br /><font color="#a0b0c0"><i>#</i></font><br /><font color="#a0b0c0"><i># author: Huahai Yang, 12/13/2007 11:22:36 AM (PST)  </i></font><br /><font color="#a0b0c0"><i>#</i></font><br /><font color="#007020"><b>while</b></font> <font color="#5b3674"><i>email</i></font>=<font color="#1060a0">$(</font><font color="#70a0d0"><i>inotifywait -e moved_to ~/Mail/GTD/cur --format </i></font><font color="#408010">"</font><font color="#4070a0">%f</font><font color="#408010">"</font><font color="#1060a0">)</font><font color="#408010">;</font> <font color="#4c8f2f"><b>do</b></font> <p>  <font color="#a0b0c0"><i># the list of available vim servers</i></font><br />   <font color="#5b3674"><i>servers</i></font>=<font color="#408010">(</font> <font color="#1060a0">$(</font><font color="#70a0d0"><i>vim --serverlist</i></font><font color="#1060a0">)</font> <font color="#408010">)</font></p> <p>  <font color="#a0b0c0"><i># the number of available vim servers</i></font><br />   <font color="#5b3674"><i>num</i></font>=<font color="#1060a0">${#</font><font color="#1060a0">servers</font><font color="#1060a0">[</font>@<font color="#1060a0">]</font><font color="#1060a0">}</font></p> <p>  <font color="#4c8f2f"><b>if</b></font> <font color="#70a0d0"><i>[[</i></font> <font color="#1060a0">$num</font> <font color="#4c8f2f"><b>-eq</b></font> <font color="#40a070">0</font> <font color="#70a0d0"><i>]]</i></font><font color="#408010">;</font> <font color="#4c8f2f"><b>then</b></font><br />     kdialog --msgbox <font color="#408010">"</font><font color="#4070a0">There is no vim server running.</font><font color="#408010">"</font><br />   <font color="#4c8f2f"><b>else</b></font><br />     <font color="#a0b0c0"><i># construct dialog choices</i></font><br />     <font color="#5b3674"><i>choices</i></font>=<font color="#408010">""</font><br />     <font color="#007020"><b>for</b></font> id <font color="#007020"><b>in</b></font> <font color="#1060a0">$(</font><font color="#70a0d0"><i>seq </i></font><font color="#40a070">0</font><font color="#70a0d0"><i> </i></font><font color="#1060a0">$((</font><font color="#1060a0">$num</font><font color="#70a0d0"><i> - </i></font><font color="#40a070">1</font><font color="#1060a0">))</font><font color="#1060a0">)</font><font color="#408010">;</font> <font color="#4c8f2f"><b>do</b></font><br />       <font color="#5b3674"><i>choices</i></font>=<font color="#1060a0">${</font><font color="#1060a0">choices</font><font color="#1060a0">}</font><font color="#408010">"</font><font color="#4070a0"> </font><font color="#408010">"</font><font color="#1060a0">${</font><font color="#1060a0">servers</font><font color="#1060a0">[</font><font color="#1060a0">$id</font><font color="#1060a0">]</font><font color="#1060a0">}</font><font color="#408010">"</font><font color="#4070a0"> </font><font color="#408010">"</font><font color="#1060a0">${</font><font color="#1060a0">servers</font><font color="#1060a0">[</font><font color="#1060a0">$id</font><font color="#1060a0">]</font><font color="#1060a0">}</font><font color="#408010">"</font><font color="#4070a0"> off</font><font color="#408010">"</font><br />     <font color="#4c8f2f"><b>done</b></font></p> <p>    <font color="#5b3674"><i>server</i></font>=<font color="#1060a0">$(</font><font color="#70a0d0"><i>kdialog --title </i></font><font color="#408010">"</font><font color="#4070a0">Insert email reference</font><font color="#408010">"</font><font color="#70a0d0"><i> \</i></font><br /><font color="#70a0d0"><i>        --radiolist </i></font><font color="#408010">"</font><font color="#4070a0">Please select which vim server to insert into:</font><font color="#408010">"</font><font color="#70a0d0"><i> \</i></font><br /><font color="#70a0d0"><i>        </i></font><font color="#1060a0">$choices</font><font color="#1060a0">)</font></p> <p>    <font color="#a0b0c0"><i># insert the email reference to the end of the current line</i></font><br />     vim --servername <font color="#408010">"</font><font color="#1060a0">$server</font><font color="#408010">"</font> \<br />         --remote-send <font color="#408010">"</font><font color="#4070a0">&lt;ESC&gt;A&lt;mail:~/Mail/GTD/cur/</font><font color="#408010">"</font><font color="#1060a0">${</font><font color="#1060a0">email</font><font color="#1060a0">}</font><font color="#408010">"</font><font color="#4070a0">&gt;&lt;ESC&gt;</font><font color="#408010">"</font><br />   <font color="#4c8f2f"><b>fi</b></font><br /><font color="#4c8f2f"><b>done</b></font><br /></p></font> </div> <p>This script should run in the background. I personally run it from <em>~/.kde/Autostart</em> so it is automatically loaded when I log in. It watches the <em>~/Mail/GTD</em> folder I created in kmail, and insert a reference to an email to available vim server when the email is moved to the folder. </p> <p>Finally, I set up utl.vim plug-in so that it knows how to invoke a reference to email message. After installing utl.vim, I added the following function in my <em>.vimrc</em>, so that utl.vim can handle my "mail:" style URL:</p> <div class="codeblock"> <font face="monospace"><br /><font color="#a0b0c0"><i>" lauch kmail to handle reference to email message</i></font><br /><font color="#007020"><b>fu</b></font>! Utl_AddressScheme_mail<font color="#408010">(</font>auri<font color="#408010">)</font><br />   <font color="#007020"><b>exe</b></font> <font color="#4070a0">"!kmail --view "</font> <font color="#408010">.</font> UtlUri_unescape<font color="#408010">(</font> UtlUri_opaque<font color="#408010">(</font>a:auri<font color="#408010">)</font> <font color="#408010">)</font><br />   <font color="#007020"><b>return</b></font> <font color="#4070a0">''</font><br /><font color="#007020"><b>endfu</b></font><br /></font> </div> <p>Now when cursor is on an email link, hit <em>\gu</em> will open up the message in kmail.<a href="http://i274.photobucket.com/albums/jj251/huahaiy/gtd-email-reference.png"><img src="http://i274.photobucket.com/albums/jj251/huahaiy/gtd-email-reference.png" width="720" /></a></p> </div></div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=69&amp;2=comment_node_blog&amp;3=comment_node_blog" token="lJT5kKeln39os46v1KdycSqBSDznPWWSvHnhJphOBS8"></drupal-render-placeholder> </section> <strong class="node_view"></strong> Thu, 13 Dec 2007 22:40:50 +0000 Huahai 69 at https://yyhh.org Use Vim as Info Page Browser https://yyhh.org/blog/2007/11/use-vim-info-page-browser <span>Use Vim as Info Page Browser</span> <span><a title="View user profile." href="/user/huahai" lang="" about="/user/huahai" typeof="schema:Person" property="schema:name" datatype="">Huahai</a></span> <span>Thu, 11/29/2007 - 07:56</span> <div class="field field--name-field-notebook field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><div about="/notebook/vim" id="taxonomy-term-17" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/vim"> <div class="field field--name-name field--type-string field--label-hidden field__item">Vim</div> </a> <div class="content"> </div> </div> </div> <div class="field__item"><div about="/notebook/linux" id="taxonomy-term-16" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/linux"> <div class="field field--name-name field--type-string field--label-hidden field__item">Linux</div> </a> <div class="content"> </div> </div> </div> </div> <div class="field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="tex2jax_process"><p>In <a href="http://yyhh.org/blog/2007/11/use-vim-read-manual-page">this post</a>, I set up vim as a manual page viewer, using <a href="http://vim.sourceforge.net/scripts/script.php?script_id=489">ManPageView</a> plugin. It turned out that the same plugin can be used to view info pages as well. All one needs to to is to add ".i" suffix to the command that you are seeking help on. For example, ":Man sed.i" will show the info page for sed. With this information, we can set up vim as info page browser, just add these lines in <i>~/.bashrc</i>:</p> <div class="codeblock"> <code><br /> vinfo() {<br /> /usr/bin/vim -c "Man $@.i" -c 'silent! only' -c 'nmap q :q'<br /> }<br /> alias info='vinfo'<br /></code> </div> <p>Now open a terminal, type <em>info whatever</em> will show the info page of whatever you are seeking help on, if it exists, with nice syntax highlighting and easy to use key bindings. One caveat is that you would get an blank page if the info page does not exist, instead of getting the top level info directory as with the real info command. However, real info command doesn't have syntax highlighting and familiar key-bindings, so I stick with vim.</p> </div></div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=61&amp;2=comment_node_blog&amp;3=comment_node_blog" token="GSLbem0gl6N-sNGpiLl28nZerkmogopmMIVEX6p_mEM"></drupal-render-placeholder> </section> <strong class="node_view"></strong> Thu, 29 Nov 2007 07:56:06 +0000 Huahai 61 at https://yyhh.org Reverse/Forward Search with Latex-Suite in Vim https://yyhh.org/blog/2007/11/reverse-forward-search-latex-suite-vim <span>Reverse/Forward Search with Latex-Suite in Vim</span> <span><a title="View user profile." href="/user/huahai" lang="" about="/user/huahai" typeof="schema:Person" property="schema:name" datatype="">Huahai</a></span> <span>Thu, 11/22/2007 - 17:19</span> <div class="field field--name-field-notebook field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><div about="/notebook/vim" id="taxonomy-term-17" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/vim"> <div class="field field--name-name field--type-string field--label-hidden field__item">Vim</div> </a> <div class="content"> </div> </div> </div> <div class="field__item"><div about="/notebook/linux" id="taxonomy-term-16" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/linux"> <div class="field field--name-name field--type-string field--label-hidden field__item">Linux</div> </a> <div class="content"> </div> </div> </div> <div class="field__item"><div about="/notebook/latex" id="taxonomy-term-18" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/latex"> <div class="field field--name-name field--type-string field--label-hidden field__item">LaTeX</div> </a> <div class="content"> </div> </div> </div> </div> <div class="field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="tex2jax_process"><p>When editing a long Latex document, it is beneficial to be able to point from current location in DVI back to Tex, and vice visa. This is what called reverse/forward search between DVI and Latex. With <a href="http://vim-latex.sourceforge.net/">Latex-Suite in Vim</a>, this functionality is already implemented, and there's no need to specify "\usepackage scrltx" in the Tex file. However, it's not fully configured by default. Forward search with "\ls" works, but inverse search by "Ctrl-Left click" in xdiv is not enabled. To turn it on, edit <i>~/.vim/ftplugin/tex/texrc</i>, change the line "TexLet g:Tex_UseEditorSettingInDVIViewer = 0" to "TexLet g:Tex_UseEditorSettingInDVIViewer = 1".</p> </div></div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=60&amp;2=comment_node_blog&amp;3=comment_node_blog" token="rI8aai8OwEs1om8PIDJPJrPgdN5g2XSdPSAdvzWJxSI"></drupal-render-placeholder> </section> <strong class="node_view"></strong> Thu, 22 Nov 2007 17:19:37 +0000 Huahai 60 at https://yyhh.org Post syntax highlighted code in Drupal https://yyhh.org/blog/2007/11/post-syntax-highlighted-code-drupal <span>Post syntax highlighted code in Drupal</span> <span><a title="View user profile." href="/user/huahai" lang="" about="/user/huahai" typeof="schema:Person" property="schema:name" datatype="">Huahai</a></span> <span>Sat, 11/17/2007 - 10:45</span> <div class="field field--name-field-notebook field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><div about="/notebook/vim" id="taxonomy-term-17" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/vim"> <div class="field field--name-name field--type-string field--label-hidden field__item">Vim</div> </a> <div class="content"> </div> </div> </div> </div> <div class="field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="tex2jax_process"><p>You may have seen that I sometimes post code here. Wouldn't it be nice if all the code are syntax highlighted, like what we see in a text editor? Well, with the help of Vim, it's easy. Vim is bundled with a "2html" script, that can turn whatever shown in Vim into a HTML file, with all it's color and format. To invoke this command, simply issue ":so \$VIMRUNTIME/syntax/2html.vim" command in Vim to run the script, or more simply ":TOhtml". No, you don't have to type this many characters, autocompletion should do most of the typing for you. Vim will then open up a window that contains the newly converted HTML file. </p> <p>(Update: for newer version of vim, need to <code>:let g:html_use_css=0</code> first)</p> <p>If I want to post it to Drupal, I simply remove the unnecessary tags such as "html", "body" and "head", etc. and save the file. When I write the blog entry, I read back the file and insert it where I want it. Also, I enclose the code with <code></code></p> <div class="codeblock"> code here </div> <p><br /> so the default Drupal style sheet renders the code within a nice box and on a light gray background. </p> <p>This approach is much better than installing some syntax highlighting modules written in PHP on Drupal. Now the supported syntax highlighting file formats are practically unlimited, only bound by Vim's syntax highlighting repertoire, which includes pretty much every imaginable text file format. What's more, Vim's color theme applies here! So you can have all kinds of colorful code. Below are some examples. </p> <p>This is my <i>~/.vimrc</i>, displayed with xterm16 allblue color theme, which I use in terminal:</p> <div class="codeblock"> <font face="monospace"><br /><font color="#8787af">" vim behavior</font><br /><font color="#0087af">set</font> <font color="#8700d7">nocompatible</font> <p><font color="#8787af">" set 256 color scheme for terminial use</font><br /><font color="#0087af">set</font> <font color="#8700d7">term</font>=xterm-256color<br /><font color="#8787af">"colors desert256</font><br /><font color="#8787af">"let xterm16_brightness = 'default'     " Change if needed</font><br /><font color="#0087af">let</font> xterm16_colormap <font color="#0087af">=</font> <font color="#87afaf">'allblue'</font>       <font color="#8787af">" Change if needed </font><br /><font color="#8787af">"let xterm16_colormap = 'soft'       " Change if needed </font><br /><font color="#0087af">colors</font> xterm16<br /><font color="#8787af">"colors pyte</font></p> <p><font color="#8787af">" REQUIRED. This makes vim invoke latex-suite when you open a tex file.</font><br /><font color="#0087af">filetype</font> <font color="#87af87">plugin</font> <font color="#87af87">on</font></p> <p><font color="#8787af">"</font> <font color="#8700d7">IMPORTANT:</font><font color="#8787af"> win32 users will need to have 'shellslash' set so that latex</font><br /><font color="#8787af">" can be called correctly.</font><br /><font color="#0087af">set</font> <font color="#8700d7">shellslash</font></p> <p><font color="#8787af">"</font> <font color="#8700d7">IMPORTANT:</font><font color="#8787af"> grep will sometimes skip displaying the file name if you</font><br /><font color="#8787af">" search in a singe file. This will confuse latex-suite. Set your grep</font><br /><font color="#8787af">" program to alway generate a file-name.</font><br /><font color="#0087af">set</font> <font color="#8700d7">grepprg</font>=grep\ -nH\ \$*</p> <p><font color="#8787af">"</font> <font color="#8700d7">OPTIONAL:</font><font color="#8787af"> This enables automatic indentation as you type.</font><br /><font color="#0087af">filetype</font> <font color="#87af87">indent</font> <font color="#87af87">on</font></p> <p><font color="#8787af">"</font> <font color="#8700d7">TIP:</font><font color="#8787af"> if you write your \label's as \label{fig:something}, then if you</font><br /><font color="#8787af">" type in \ref{fig: and press &lt;C-n&gt; you will automatically cycle through</font><br /><font color="#8787af">" all the figure labels. Very useful!</font><br /><font color="#0087af">set</font> <font color="#8700d7">iskeyword</font>+=:</p> <p><font color="#8787af">" so .tex file will always be recognized as Latex.</font><br /><font color="#0087af">let</font> g:tex_flavor <font color="#0087af">=</font> <font color="#87afaf">"latex"</font></p> <p><font color="#8787af">" this is mostly a matter of taste. but LaTeX looks good with just a bit</font><br /><font color="#8787af">" of indentation.</font><br /><font color="#0087af">set</font> <font color="#8700d7">tabstop</font>=2<br /><font color="#0087af">set</font> <font color="#8700d7">shiftwidth</font>=2<br /><font color="#0087af">set</font> <font color="#8700d7">expandtab</font> </p> <p><font color="#0087af">set</font> <font color="#8700d7">autoindent</font><br /><font color="#0087af">set</font> <font color="#8700d7">smartindent</font></p> <p><font color="#8787af">" matching brackets</font><br /><font color="#0087af">set</font> <font color="#8700d7">showmatch</font></p> <p><font color="#8787af">" show cursor position</font><br /><font color="#0087af">set</font> <font color="#8700d7">ruler</font></p> <p><font color="#8787af">" minibufexpl setting</font><br /><font color="#0087af">let</font> BufExplMapWindowNavVim <font color="#0087af">=</font> <font color="#87afaf">1</font><br /><font color="#0087af">let</font> g:miniBufExplMapWindowNavArrows <font color="#0087af">=</font> <font color="#87afaf">1</font><br /><font color="#0087af">let</font> g:miniBufExplMapCTabSwitchBufs <font color="#0087af">=</font> <font color="#87afaf">1</font><br /><font color="#0087af">let</font> g:miniBufExplModSelTarget <font color="#0087af">=</font> <font color="#87afaf">1</font></p> <p><font color="#8787af">"set paste Mode On/Off</font><br /><font color="#0087af">map</font> <font color="#00af87">&lt;</font><font color="#00af87">F11</font><font color="#00af87">&gt;</font> :call Paste_on_off()<font color="#00af87">&lt;</font><font color="#00af87">CR</font><font color="#00af87">&gt;</font><br /><font color="#0087af">set</font> <font color="#8700d7">pastetoggle</font>=<font color="#00af87">&lt;</font><font color="#00af87">F11</font><font color="#00af87">&gt;</font><br /><font color="#0087af">let</font> paste_mode <font color="#0087af">=</font> <font color="#87afaf">0</font> <font color="#8787af">" 0 = normal, 1 = paste</font><br /><font color="#0087af">func</font>! Paste_on_off<font color="#0087af">()</font><br />   <font color="#0087af">if</font> g:paste_mode <font color="#0087af">==</font> <font color="#87afaf">0</font><br />     <font color="#0087af">set</font> <font color="#8700d7">paste</font><br />     <font color="#0087af">let</font> g:paste_mode <font color="#0087af">=</font> <font color="#87afaf">1</font><br />   <font color="#0087af">else</font><br />     <font color="#0087af">set</font> <font color="#8700d7">nopaste</font><br />     <font color="#0087af">let</font> g:paste_mode <font color="#0087af">=</font> <font color="#87afaf">0</font><br />   <font color="#0087af">endif</font><br />   <font color="#0087af">return</font><br /><font color="#0087af">endfunc</font></p> <p><font color="#8787af">" spell checking on/off</font><br /><font color="#0087af">map</font> <font color="#00af87">&lt;</font><font color="#00af87">F10</font><font color="#00af87">&gt;</font> :call Spell_on_off()<font color="#00af87">&lt;</font><font color="#00af87">CR</font><font color="#00af87">&gt;</font><br /><font color="#0087af">let</font> spell_mode <font color="#0087af">=</font> <font color="#87afaf">0</font><br /><font color="#0087af">func</font>! Spell_on_off<font color="#0087af">()</font><br />   <font color="#0087af">if</font> g:spell_mode <font color="#0087af">==</font> <font color="#87afaf">0</font><br />     <font color="#0087af">setlocal</font> <font color="#8700d7">spell</font> <font color="#8700d7">spelllang</font>=en_us<br />     <font color="#0087af">let</font> g:spell_mode <font color="#0087af">=</font> <font color="#87afaf">1</font><br />   <font color="#0087af">else</font> <br />     <font color="#0087af">setlocal</font> <font color="#8700d7">nospell</font><br />     <font color="#0087af">let</font> g:spell_mode <font color="#0087af">=</font> <font color="#87afaf">0</font><br />   <font color="#0087af">endif</font><br />   <font color="#0087af">return</font><br /><font color="#0087af">endfunc</font></p> <p><font color="#8787af">" post blog entry to my Drupal site</font><br /><font color="#8787af">" Use :e blog/nodeID_which_is_digits to open an existing entry for editting;</font><br /><font color="#8787af">"     For example :e blog/12</font><br /><font color="#8787af">" Use :e blog/anything_other_than_digits to open a new entry for editing</font><br /><font color="#8787af">"     For example :e blog/blah</font><br /><font color="#8787af">" Use :w to post it. </font><br /><font color="#8787af">" Use :w blog/anything to post a file as a new blog entry</font></p> <p><font color="#8787af">python &lt;&lt; EOF</font></p> <p>strUserName = <span><font color="#a8a8a8">'</font></span><font color="#87afaf">secret</font><span><font color="#a8a8a8">'</font></span><br /> strPassword = <span><font color="#a8a8a8">'</font></span><font color="#87afaf">secret</font><span><font color="#a8a8a8">'</font></span><br /> strDrupal = <span><font color="#a8a8a8">'</font></span><font color="#87afaf"><a href="http://yyhh.org">http://yyhh.org</a></font><span><font color="#a8a8a8">'</font></span></p> <p><font color="#8700d7">import</font> vim<br /><font color="#8700d7">import</font> xmlrpclib<br /><font color="#8700d7">import</font> re</p> <p><font color="#0087af">def</font> <font color="#00afaf">PostBlog</font>():</p> <p>  <font color="#8787af">#</font><br />   <font color="#8787af"># If first line contains a blog entry ID then edit existing post,</font><br />   <font color="#8787af"># otherwise write a new one.</font><br />   <font color="#8787af">#</font><br />   nFirstLine = 0<br />   strID = vim.current.buffer[0]<br />   <font color="#0087af">if</font> <font color="#0087af">not</font> re.match( <span><font color="#a8a8a8">'</font></span><font color="#87afaf">^\d+\$</font><span><font color="#a8a8a8">'</font></span>, strID):<br />     strID = <span><font color="#a8a8a8">''</font></span><br />   else:<br />     nFirstLine = 1</p> <p>  strTitle = vim.current.buffer[nFirstLine]<br />   strText = <span><font color="#a8a8a8">"</font></span><font color="#00af87">\n</font><span><font color="#a8a8a8">"</font></span>.join( vim.current.buffer[nFirstLine+1:])</p> <p>  oDrupal = xmlrpclib.ServerProxy( strDrupal + <span><font color="#a8a8a8">'</font></span><font color="#87afaf">/xmlrpc.php</font><span><font color="#a8a8a8">'</font></span>)</p> <p>  oPost = { <span><font color="#a8a8a8">'</font></span><font color="#87afaf">title</font><span><font color="#a8a8a8">'</font></span>: strTitle, <span><font color="#a8a8a8">'</font></span><font color="#87afaf">description</font><span><font color="#a8a8a8">'</font></span>: strText}</p> <p>  <font color="#0087af">if</font> strID == <span><font color="#a8a8a8">''</font></span>:<br />     strID = oDrupal.metaWeblog.newPost( <span><font color="#a8a8a8">'</font></span><font color="#87afaf">blog</font><span><font color="#a8a8a8">'</font></span>, strUserName, strPassword, oPost, True)<br />   else:<br />     bSuccess = oDrupal.metaWeblog.editPost( strID, strUserName, strPassword, oPost, True)</p> <p>  <font color="#0087af">print</font> <span><font color="#a8a8a8">"</font></span><font color="#87afaf">Posted entry %s</font><span><font color="#a8a8a8">"</font></span> % strID</p> <p>  <font color="#8787af">#</font><br />   <font color="#8787af"># Don't intend to write posts to disk so unmodify the buffer and</font><br />   <font color="#8787af"># allow easy quit from VIM.</font><br />   <font color="#8787af">#</font><br />   vim.command( <span><font color="#a8a8a8">'</font></span><font color="#87afaf">set nomodified</font><span><font color="#a8a8a8">'</font></span>)</p> <p><font color="#0087af">def</font> <font color="#00afaf">ReadBlog</font>( strID ):<br />   <br />   <font color="#8787af">#</font><br />   <font color="#8787af"># So html plugin is automatically enabled for editing the post </font><br />   <font color="#8787af"># with auto-completion and syntax highlighting</font><br />   <font color="#8787af">#</font><br />   vim.command(<span><font color="#a8a8a8">'</font></span><font color="#87afaf">setfiletype html</font><span><font color="#a8a8a8">'</font></span>)</p> <p>  <font color="#0087af">if</font> <font color="#0087af">not</font> strID.isdigit():<br />     <font color="#0087af">print</font> <span><font color="#a8a8a8">"</font></span><font color="#87afaf">New blog entry</font><span><font color="#a8a8a8">"</font></span><br />     <font color="#0087af">return</font></p> <p>  oDrupal = xmlrpclib.ServerProxy( strDrupal + <span><font color="#a8a8a8">'</font></span><font color="#87afaf">/xmlrpc.php</font><span><font color="#a8a8a8">'</font></span>)</p> <p>  oBlog = oDrupal.metaWeblog.getPost( strID, strUserName, strPassword )</p> <p>  vim.current.buffer[:] = []<br />   vim.current.buffer[0] = strID<br />   vim.current.buffer.append( oBlog[<span><font color="#a8a8a8">'</font></span><font color="#87afaf">title</font><span><font color="#a8a8a8">'</font></span>])<br />   vim.current.buffer.append( <span><font color="#a8a8a8">''</font></span>)<br />   <font color="#0087af">for</font> strLine <font color="#0087af">in</font> oBlog[<span><font color="#a8a8a8">'</font></span><font color="#87afaf">description</font><span><font color="#a8a8a8">'</font></span>].split(<span><font color="#a8a8a8">'</font></span><font color="#00af87">\n</font><span><font color="#a8a8a8">'</font></span>):<br />     vim.current.buffer.append( strLine)</p> <p><font color="#8787af">EOF</font></p> <p>:au BufWriteCmd blog/* <font color="#0087af">py</font> <span><font color="#a8a8a8">PostBlog</font></span><font color="#0087af">()</font> <br /> :au BufReadCmd blog/* <font color="#0087af">py</font> <span><font color="#a8a8a8">ReadBlog</font></span><font color="#0087af">(</font>vim<font color="#0087af">.</font>eval<font color="#0087af">(</font><font color="#87afaf">"expand('&lt;afile&gt;:t')"</font><font color="#0087af">))</font></p> <p><font color="#0087af">syntax</font> <font color="#87af87">on</font><br /></p></font></div> <p>On Drupal's side, I needed to enable full HTML input format, or these colorful HTML code will be removed by Drupal. Oh, another thing, do not use TinyMCE rich text editor to edit the post, because it will mess up the HTML code. Well, TinyMCE was installed here per Yunyao's request, I don't use it anyway, I <a href="http://yyhh.org/blog/2007/10/posting-blog-entry-drupal-within-vim">use vim to edit my post</a>:-)</p> </div></div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=56&amp;2=comment_node_blog&amp;3=comment_node_blog" token="_wkEha7YhFCRZxIRheZPT5LKSoczcB9zDWgvpH5izm8"></drupal-render-placeholder> </section> <strong class="node_view"></strong> Sat, 17 Nov 2007 10:45:52 +0000 Huahai 56 at https://yyhh.org Use Vim to read manual page https://yyhh.org/blog/2007/11/use-vim-read-manual-page <span>Use Vim to read manual page</span> <span><a title="View user profile." href="/user/huahai" lang="" about="/user/huahai" typeof="schema:Person" property="schema:name" datatype="">Huahai</a></span> <span>Fri, 11/09/2007 - 22:10</span> <div class="field field--name-field-notebook field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><div about="/notebook/vim" id="taxonomy-term-17" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/vim"> <div class="field field--name-name field--type-string field--label-hidden field__item">Vim</div> </a> <div class="content"> </div> </div> </div> <div class="field__item"><div about="/notebook/linux" id="taxonomy-term-16" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/linux"> <div class="field field--name-name field--type-string field--label-hidden field__item">Linux</div> </a> <div class="content"> </div> </div> </div> </div> <div class="field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="tex2jax_process"><p>Command line manual page is an indispensable tool for working with Linux system.If you forget how to use a command, just type <i>man</i> followed by the name of the command. One thing I don't like about the manual system on my Debian sid is that it uses <i>most</i> to display the manual. The key bindings of <i>most</i> feel awkward for me since I am used to <i>vim</i>. Of course, there are many &quot;vimers&quot; like me, and they've found ways to fix this. Actually, there are <a href="http://vim.sourceforge.net/tips/tip.php?tip_id=167">many different ways</a>, but I find the approach below works best for me. Basically, it involves creating a shell alias for <i>man</i>, so when <i>man</i> is used, shell invokes <i>vim</i> instead to read the manual. The following is added in <i>~/.bashrc</i>: </p> <div class="codeblock"> <code> # use vim as man's pager, rely on ManPageView plugin<br /> vman() {<br /> /usr/bin/whatis "$@" > /dev/null<br /> if [ $? -eq 0 ]; then<br /> /usr/bin/vim -c "Man $@" -c 'silent! only' -c 'nmap q :q<cr>'<br /> else<br /> /usr/bin/man "$@"<br /> fi<br /> }<br /> alias man='vman'<br /> </code> </div> <p>This script relies on <a href="http://vim.sourceforge.net/scripts/script.php?script_id=489">ManPageView</a> plugin. However, I found the bundled syntax highlighting for this plug-in does not work as I expected, so I just deleted <i>~/.vim/syntax/man.vim</i>. It works because <i>vim</i> 7.0 has manual page syntax highlighting already built-in.</p> </div></div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=50&amp;2=comment_node_blog&amp;3=comment_node_blog" token="Sn_0puZfRPUWb46qV15uLvxib6sMzqFh_Qzc8_Tqu0U"></drupal-render-placeholder> </section> <strong class="node_view"></strong> Fri, 09 Nov 2007 22:10:01 +0000 Huahai 50 at https://yyhh.org Posting blog entry to Drupal from within Vim https://yyhh.org/blog/2007/10/posting-blog-entry-drupal-within-vim <span>Posting blog entry to Drupal from within Vim</span> <span><a title="View user profile." href="/user/huahai" lang="" about="/user/huahai" typeof="schema:Person" property="schema:name" datatype="">Huahai</a></span> <span>Sat, 10/27/2007 - 22:52</span> <div class="field field--name-field-notebook field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><div about="/notebook/vim" id="taxonomy-term-17" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/vim"> <div class="field field--name-name field--type-string field--label-hidden field__item">Vim</div> </a> <div class="content"> </div> </div> </div> <div class="field__item"><div about="/notebook/python" id="taxonomy-term-34" class="taxonomy-term vocabulary-notebook"> <a href="/notebook/python"> <div class="field field--name-name field--type-string field--label-hidden field__item">Python</div> </a> <div class="content"> </div> </div> </div> </div> <div class="field field--name-body field--type-text-with-summary field--label-hidden field__item"><div class="tex2jax_process"><p>Some people may wonder why would anyone want to do this? Well, there are at least two benefits. One, I can write posts <i>offline</i> with my favorite editor, whenever I feel like it. Then post them from within vim once I got an Internet connection. Two, I get to use niceties of vim such as spellchecker, autocompletion and syntax highlighting for html code. I found this solution on <a href="http://www.petersblog.org/node/876">Peter Wilkinson's Blog</a>. I did a few minor changes to make <a href="http://www.petersblog.org/node/876">his script</a> to work with the latest version of python. A step further, I combined it with <a href="http://www.petersblog.org/node/907">his another post</a>, now I can even use the regular vim syntax to read/post blog entry just like a regular file, e.g. <i>:e blog/4</i> to edit blog entry number 4, <i>:w</i> to post the edited version. Very cool. See the following <i>.vimrc</i> code for details:</p> <div class="codeblock"> <font face="monospace"><br /><span><font color="#786000">" post blog entry to my Drupal site</font></span><br /><span><font color="#786000">" Use :e blog/nodeID_which_is_digits to open an existing entry for editting;</font></span><br /><span><font color="#786000">"     For example :e blog/12</font></span><br /><span><font color="#786000">" Use :e blog/anything_other_than_digits to open a new entry for editing</font></span><br /><span><font color="#786000">"     For example :e blog/blah</font></span><br /><span><font color="#786000">" Use :w to post it. </font></span><br /><span><font color="#786000">" Use :w blog/anything to post a file as a new blog entry</font></span> <p><span><font color="#786000">python &lt;&lt; EOF</font></span></p> <p>strUserName = <span><font color="#000000">'</font></span><span><font color="#077807">your_username</font></span><span><font color="#000000">'</font></span><br /> strPassword = <span><font color="#000000">'</font></span><span><font color="#077807">your_password</font></span><span><font color="#000000">'</font></span><br /> strDrupal = <span><font color="#000000">'</font></span><span><font color="#077807"><a href="http://your.domain.name">http://your.domain.name</a></font></span><span><font color="#000000">'</font></span></p> <p><span><font color="#800090">import</font></span> vim<br /><span><font color="#800090">import</font></span> xmlrpclib<br /><span><font color="#800090">import</font></span> re</p> <p><span><font color="#1f3f81"><b>def</b></font></span> <span><font color="#007080">PostBlog</font></span>():</p> <p>  <span><font color="#786000">#</font></span><br />   <span><font color="#786000"># If first line contains a blog entry ID then edit existing post,</font></span><br />   <span><font color="#786000"># otherwise write a new one.</font></span><br />   <span><font color="#786000">#</font></span><br />   nFirstLine = 0<br />   strID = vim.current.buffer[0]<br />   <span><font color="#1f3f81"><b>if</b></font></span> <span><font color="#1f3f81"><b>not</b></font></span> re.match( <span><font color="#000000">'</font></span><span><font color="#077807">^\d+$</font></span><span><font color="#000000">'</font></span>, strID):<br />     strID = <span><font color="#000000">''</font></span><br />   else:<br />     nFirstLine = 1</p> <p>  strTitle = vim.current.buffer[nFirstLine]<br />   strText = <span><font color="#000000">"</font></span><span><font color="#912f11">\n</font></span><span><font color="#000000">"</font></span>.join( vim.current.buffer[nFirstLine+1:])</p> <p>  oDrupal = xmlrpclib.ServerProxy( strDrupal + <span><font color="#000000">'</font></span><span><font color="#077807">/xmlrpc.php</font></span><span><font color="#000000">'</font></span>)</p> <p>  oPost = { <span><font color="#000000">'</font></span><span><font color="#077807">title</font></span><span><font color="#000000">'</font></span>: strTitle, <span><font color="#000000">'</font></span><span><font color="#077807">description</font></span><span><font color="#000000">'</font></span>: strText}</p> <p>  <span><font color="#1f3f81"><b>if</b></font></span> strID == <span><font color="#000000">''</font></span>:<br />     strID = oDrupal.metaWeblog.newPost( <span><font color="#000000">'</font></span><span><font color="#077807">blog</font></span><span><font color="#000000">'</font></span>, strUserName, strPassword, oPost, True)<br />   else:<br />     bSuccess = oDrupal.metaWeblog.editPost( strID, strUserName, strPassword, oPost, True)</p> <p>  <span><font color="#1f3f81"><b>print</b></font></span> <span><font color="#000000">"</font></span><span><font color="#077807">Posted entry %s</font></span><span><font color="#000000">"</font></span> % strID</p> <p>  <span><font color="#786000">#</font></span><br />   <span><font color="#786000"># Don't intend to write posts to disk so unmodify the buffer and</font></span><br />   <span><font color="#786000"># allow easy quit from VIM.</font></span><br />   <span><font color="#786000">#</font></span><br />   vim.command( <span><font color="#000000">'</font></span><span><font color="#077807">set nomodified</font></span><span><font color="#000000">'</font></span>)</p> <p><span><font color="#1f3f81"><b>def</b></font></span> <span><font color="#007080">ReadBlog</font></span>( strID ):<br />   <br />   <span><font color="#786000">#</font></span><br />   <span><font color="#786000"># So html plugin is automatically enabled for editing the post </font></span><br />   <span><font color="#786000"># with auto-completion and syntax highlighting</font></span><br />   <span><font color="#786000">#</font></span><br />   vim.command(<span><font color="#000000">'</font></span><span><font color="#077807">setfiletype html</font></span><span><font color="#000000">'</font></span>)</p> <p>  <span><font color="#1f3f81"><b>if</b></font></span> <span><font color="#1f3f81"><b>not</b></font></span> strID.isdigit():<br />     <span><font color="#1f3f81"><b>print</b></font></span> <span><font color="#000000">"</font></span><span><font color="#077807">New blog entry</font></span><span><font color="#000000">"</font></span><br />     <span><font color="#1f3f81"><b>return</b></font></span></p> <p>  oDrupal = xmlrpclib.ServerProxy( strDrupal + <span><font color="#000000">'</font></span><span><font color="#077807">/xmlrpc.php</font></span><span><font color="#000000">'</font></span>)</p> <p>  oBlog = oDrupal.metaWeblog.getPost( strID, strUserName, strPassword )</p> <p>  vim.current.buffer[:] = []<br />   vim.current.buffer[0] = strID<br />   vim.current.buffer.append( oBlog[<span><font color="#000000">'</font></span><span><font color="#077807">title</font></span><span><font color="#000000">'</font></span>])<br />   vim.current.buffer.append( <span><font color="#000000">''</font></span>)<br />   <span><font color="#1f3f81"><b>for</b></font></span> strLine <span><font color="#1f3f81"><b>in</b></font></span> oBlog[<span><font color="#000000">'</font></span><span><font color="#077807">description</font></span><span><font color="#000000">'</font></span>].split(<span><font color="#000000">'</font></span><span><font color="#912f11">\n</font></span><span><font color="#000000">'</font></span>):<br />     vim.current.buffer.append( strLine)</p> <p><span><font color="#786000">EOF</font></span></p> <p>:au BufWriteCmd blog/* <span><font color="#1f3f81"><b>py</b></font></span> <span><font color="#000000">PostBlog</font></span><span><font color="#1f3f81"><b>()</b></font></span> <br /> :au BufReadCmd blog/* <span><font color="#1f3f81"><b>py</b></font></span> <span><font color="#000000">ReadBlog</font></span><span><font color="#1f3f81"><b>(</b></font></span>vim<span><font color="#1f3f81"><b>.</b></font></span>eval<span><font color="#1f3f81"><b>(</b></font></span><span><font color="#077807">"expand('&lt;afile&gt;:t')"</font></span><span><font color="#1f3f81"><b>))</b></font></span></p> <p><span><font color="#1f3f81"><b>syntax</b></font></span> <span><font color="#912f11"><b>on</b></font></span><br /></p></font> </div> </div></div> <ul class="links inline"><li class="comment-add"><a href="/blog/2007/10/posting-blog-entry-drupal-within-vim#comment-form" title="Share your thoughts and opinions." hreflang="und">Add new comment</a></li></ul><section> <a id="comment-115"></a> <article data-comment-user-id="0" class="js-comment comment"> <mark class="hidden" data-comment-timestamp="1372362305"></mark> <footer class="attribution"> <article typeof="schema:Person" about="/user/0"> <div class="field field--name-user-picture field--type-image field--label-hidden field__item"> <img src="/sites/default/files/styles/thumbnail/public/default_images/default-user-image.png?itok=hWWOuuKw" width="100" height="100" alt="Profile picture for user Anonymous" title="Anonymous user" typeof="foaf:Image" /> </div> </article> <div class="comment-submitted"> <p class="commenter-name"> <span lang="" typeof="schema:Person" property="schema:name" datatype="">Johnebyne</span> </p> <p class="comment-time"> Thu, 06/27/2013 - 20:45 </p> </div> </footer> <div class="comment-text"> <div class="comment-arrow"></div> <h3><a href="/comment/115#comment-115" class="permalink" rel="bookmark" hreflang="en">Hello world</a></h3> <div class="content"> <div class="field field--name-comment-body field--type-text-long field--label-hidden field__item"><div class="tex2jax_process"><p>Hi</p> </div></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=115&amp;1=default&amp;2=en&amp;3=" token="jZgWP5B60O-wq10YW1fqm4gvGFWF61Kxc9xfx-LjpuM"></drupal-render-placeholder> </div> </div> </article> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=4&amp;2=comment_node_blog&amp;3=comment_node_blog" token="aWoqhMRM_W4-PFgmeNxGC5yMCwlaRUI3hm-YPQtqV-E"></drupal-render-placeholder> </section> <strong class="node_view"></strong> Sat, 27 Oct 2007 21:52:47 +0000 Huahai 4 at https://yyhh.org