<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>语法高亮 &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/%e8%af%ad%e6%b3%95%e9%ab%98%e4%ba%ae/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Mon, 27 Apr 2020 18:05:12 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创] Protocol Buffers的Emacs语法高亮</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-protocol-buffers%e7%9a%84emacs%e8%af%ad%e6%b3%95%e9%ab%98%e4%ba%ae/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-protocol-buffers%e7%9a%84emacs%e8%af%ad%e6%b3%95%e9%ab%98%e4%ba%ae/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Thu, 13 Aug 2015 03:26:28 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[highlight]]></category>
		<category><![CDATA[Protocol Buffers]]></category>
		<category><![CDATA[语法高亮]]></category>
		<guid isPermaLink="false">http://www.codelast.com/?p=8519</guid>

					<description><![CDATA[<p>
让Emacs支持Protocol Buffers文件的语法高亮，很简单，首先下载<a href="https://raw.githubusercontent.com/dylanvaughn/emacs/master/lib/protobuf-mode.el" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">这个</span></a>文件：</p>
<pre class="brush:shell;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
wget https://raw.githubusercontent.com/dylanvaughn/emacs/master/lib/protobuf-mode.el
</pre>
<p><span id="more-8519"></span><br />
其次把它放到某个你常用的Emacs配置文件加载目录下，例如我放到了 home 目录下：</p>
<pre class="brush:shell;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
mv protobuf-mode.el ~/.protobuf-mode.el
</pre>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
然后在.emacs配置文件中配置：</p>
<pre class="brush:plain;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
(load-file &#34;~/.protobuf-mode.el&#34;)
(setq auto-mode-alist  (cons &#39;(&#34;.proto$&#34; . protobuf-mode) auto-mode-alist))
</pre>
<p>仅有第一句不够，第二句是让Emacs以 protobuf-mode&#160;打开所有.proto后缀的文件。</p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&#160;版权声明&#160;<span style="color: rgb(255, 0, 0);">➤➤</span>&#160;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&#160;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>

			<!--[syntaxhighlighter]-->
			<!--代码高亮，请勿编辑-->
			<script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shCore.js"></script><script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushShell.js"></script>
<script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushPlain.js"></script>

			<link type="text/css" rel="stylesheet" href="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/styles/shCoreCk.css" />
			<link type="text/css" rel="stylesheet" href="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/styles/shThemeCk.css" />
			<script type="text/javascript">
			SyntaxHighlighter.defaults['class-name']	= '';
			SyntaxHighlighter.defaults['smart-tabs']	= true;
			SyntaxHighlighter.defaults['tab-size']</script>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-protocol-buffers%e7%9a%84emacs%e8%af%ad%e6%b3%95%e9%ab%98%e4%ba%ae/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<p>
让Emacs支持Protocol Buffers文件的语法高亮，很简单，首先下载<a href="https://raw.githubusercontent.com/dylanvaughn/emacs/master/lib/protobuf-mode.el" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">这个</span></a>文件：</p>
<pre class="brush:shell;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
wget https://raw.githubusercontent.com/dylanvaughn/emacs/master/lib/protobuf-mode.el
</pre>
<p><span id="more-8519"></span><br />
其次把它放到某个你常用的Emacs配置文件加载目录下，例如我放到了 home 目录下：</p>
<pre class="brush:shell;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
mv protobuf-mode.el ~/.protobuf-mode.el
</pre>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
然后在.emacs配置文件中配置：</p>
<pre class="brush:plain;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
(load-file &quot;~/.protobuf-mode.el&quot;)
(setq auto-mode-alist  (cons &#39;(&quot;.proto$&quot; . protobuf-mode) auto-mode-alist))
</pre>
<p>仅有第一句不够，第二句是让Emacs以 protobuf-mode&nbsp;打开所有.proto后缀的文件。</p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>

			<!--[syntaxhighlighter]-->
			<!--代码高亮，请勿编辑-->
			<script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shCore.js"></script><script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushShell.js"></script>
<script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushPlain.js"></script>

			<link type="text/css" rel="stylesheet" href="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/styles/shCoreCk.css" />
			<link type="text/css" rel="stylesheet" href="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/styles/shThemeCk.css" />
			<script type="text/javascript">
			SyntaxHighlighter.defaults['class-name']	= '';
			SyntaxHighlighter.defaults['smart-tabs']	= true;
			SyntaxHighlighter.defaults['tab-size']		= 2;
			SyntaxHighlighter.defaults['gutter']		= true;
			SyntaxHighlighter.defaults['quick-code']	= true;
			SyntaxHighlighter.defaults['collapse'] 		= false;
			SyntaxHighlighter.defaults['auto-links']	= true;
			SyntaxHighlighter.defaults['toolbar']		= true;
			SyntaxHighlighter.all();
			</script>
			<!--[/syntaxhighlighter]-->]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-protocol-buffers%e7%9a%84emacs%e8%af%ad%e6%b3%95%e9%ab%98%e4%ba%ae/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] Mycli，替换原版MySQL命令行客户端的神器一枚</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mycli%ef%bc%8c%e6%9b%bf%e6%8d%a2%e5%8e%9f%e7%89%88mysql%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%ae%a2%e6%88%b7%e7%ab%af%e7%9a%84%e7%a5%9e%e5%99%a8%e4%b8%80%e6%9e%9a/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mycli%ef%bc%8c%e6%9b%bf%e6%8d%a2%e5%8e%9f%e7%89%88mysql%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%ae%a2%e6%88%b7%e7%ab%af%e7%9a%84%e7%a5%9e%e5%99%a8%e4%b8%80%e6%9e%9a/#comments</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Wed, 05 Aug 2015 17:00:01 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[综合]]></category>
		<category><![CDATA[Mycli]]></category>
		<category><![CDATA[MySQL命令行客户端]]></category>
		<category><![CDATA[自动完成]]></category>
		<category><![CDATA[语法高亮]]></category>
		<guid isPermaLink="false">http://www.codelast.com/?p=8513</guid>

					<description><![CDATA[<p>相比于使用原版的MySQL命令行客户端，<a href="http://mycli.net/" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122);">Mycli</span></a>这个用Python开发的命令行客户端软件就高级多了，它支持自动完成以及语法高亮功能，用起来看起来简直赏心悦目。<br />
<span id="more-8513"></span><br />
Mycli的Github项目地址是：<a href="https://github.com/dbcli/mycli" target="_blank" rel="noopener noreferrer">https://github.com/dbcli/mycli</a><br />
借用其官网上的几幅图，来说明用这个MySQL命令行客户端有多么酷：<br />
<img decoding="async" alt="Mycli demo" src="http://www.codelast.com/wp-content/uploads/2015/08/mycli_demo_1.png" style="width: 650px; height: 210px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
<img decoding="async" alt="Mycli demo" src="http://www.codelast.com/wp-content/uploads/2015/08/mycli_demo_2.gif" style="width: 725px; height: 525px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
在Ubuntu下安装这货很简单，如果你已经安装过了Python的包管理工具 easy_install 的话，直接一句命令就可以搞定：</p>
<pre class="brush:shell;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;" style="width: 828.90625px;">
sudo easy_install mycli
</pre>
<p>
由于Mycli的参数与原版MySQL客户端的参数几乎是一致的，所以，如果脚本中用到了原版MySQL客户端的话，迁移到Mycli成本会很低。</p>
<p>不知道大家注意到上面图里，右下方的&#160;<span style="color: rgb(255, 0, 0);">[F4] Emacs-mode</span>&#160;这个提示符没有？如果你按一下F4键，就会切换成&#160;<span style="color: rgb(255, 0, 0);">Vi-mode</span>，其实这是表明Mycli支持Emacs和Vi两种编辑模式。例如，大家试一下就会发现，在Emacs-mode下，按Ctrl+K可以剪切光标右边的代码，按Ctrl+Y可以粘贴刚剪切的代码（用过Emacs的同学都知道）；在Vi-mode下，按ECS进入命令模式后，再按dd可以剪切当前行，等等。<br />
对Emacs和Vi两种模式的支持，极大地方便了对其中一种编辑器爱到无法自拔的那些人。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
另外，当SELECT的字段太多，显示的内容比显示器的宽度还要大的时候，右边的一些字段会在当前这一屏里显示不出来，按右箭头即可滚动过去。</p>
<p>后记：<br />
如果运行的时候提示如下错误：</p>
<blockquote>
<p>
		pkg_resources.VersionConflict: (six 1.5.2 (/usr/lib/python2.7/dist-packages), Requirement.parse(&#39;six&#62;=1.9.0&#39;))</p>
</blockquote>
<p>那么可以尝试用pip安装1.9.0或以上版本的six包：</p>
<blockquote>
<p>
		sudo pip2 install --upgrade six&#62;=1.90</p>
</blockquote>
<p>我在一台机器上遇到这样的问题就是这样解决的。</p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-mycli%ef%bc%8c%e6%9b%bf%e6%8d%a2%e5%8e%9f%e7%89%88mysql%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%ae%a2%e6%88%b7%e7%ab%af%e7%9a%84%e7%a5%9e%e5%99%a8%e4%b8%80%e6%9e%9a/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>相比于使用原版的MySQL命令行客户端，<a href="http://mycli.net/" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122);">Mycli</span></a>这个用Python开发的命令行客户端软件就高级多了，它支持自动完成以及语法高亮功能，用起来看起来简直赏心悦目。<br />
<span id="more-8513"></span><br />
Mycli的Github项目地址是：<a href="https://github.com/dbcli/mycli" target="_blank" rel="noopener noreferrer">https://github.com/dbcli/mycli</a><br />
借用其官网上的几幅图，来说明用这个MySQL命令行客户端有多么酷：<br />
<img decoding="async" alt="Mycli demo" src="http://www.codelast.com/wp-content/uploads/2015/08/mycli_demo_1.png" style="width: 650px; height: 210px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
<img decoding="async" alt="Mycli demo" src="http://www.codelast.com/wp-content/uploads/2015/08/mycli_demo_2.gif" style="width: 725px; height: 525px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
在Ubuntu下安装这货很简单，如果你已经安装过了Python的包管理工具 easy_install 的话，直接一句命令就可以搞定：</p>
<pre class="brush:shell;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;" style="width: 828.90625px;">
sudo easy_install mycli
</pre>
<p>
由于Mycli的参数与原版MySQL客户端的参数几乎是一致的，所以，如果脚本中用到了原版MySQL客户端的话，迁移到Mycli成本会很低。</p>
<p>不知道大家注意到上面图里，右下方的&nbsp;<span style="color: rgb(255, 0, 0);">[F4] Emacs-mode</span>&nbsp;这个提示符没有？如果你按一下F4键，就会切换成&nbsp;<span style="color: rgb(255, 0, 0);">Vi-mode</span>，其实这是表明Mycli支持Emacs和Vi两种编辑模式。例如，大家试一下就会发现，在Emacs-mode下，按Ctrl+K可以剪切光标右边的代码，按Ctrl+Y可以粘贴刚剪切的代码（用过Emacs的同学都知道）；在Vi-mode下，按ECS进入命令模式后，再按dd可以剪切当前行，等等。<br />
对Emacs和Vi两种模式的支持，极大地方便了对其中一种编辑器爱到无法自拔的那些人。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">http://www.codelast.com/</span></a><br />
另外，当SELECT的字段太多，显示的内容比显示器的宽度还要大的时候，右边的一些字段会在当前这一屏里显示不出来，按右箭头即可滚动过去。</p>
<p>后记：<br />
如果运行的时候提示如下错误：</p>
<blockquote>
<p>
		pkg_resources.VersionConflict: (six 1.5.2 (/usr/lib/python2.7/dist-packages), Requirement.parse(&#39;six&gt;=1.9.0&#39;))</p>
</blockquote>
<p>那么可以尝试用pip安装1.9.0或以上版本的six包：</p>
<blockquote>
<p>
		sudo pip2 install --upgrade six&gt;=1.90</p>
</blockquote>
<p>我在一台机器上遇到这样的问题就是这样解决的。</p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>

			<!--[syntaxhighlighter]-->
			<!--代码高亮，请勿编辑-->
			<script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shCore.js"></script><script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushShell.js"></script>

			<link type="text/css" rel="stylesheet" href="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/styles/shCoreCk.css" />
			<link type="text/css" rel="stylesheet" href="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/styles/shThemeCk.css" />
			<script type="text/javascript">
			SyntaxHighlighter.defaults['class-name']	= '';
			SyntaxHighlighter.defaults['smart-tabs']	= true;
			SyntaxHighlighter.defaults['tab-size']		= 2;
			SyntaxHighlighter.defaults['gutter']		= true;
			SyntaxHighlighter.defaults['quick-code']	= true;
			SyntaxHighlighter.defaults['collapse'] 		= false;
			SyntaxHighlighter.defaults['auto-links']	= true;
			SyntaxHighlighter.defaults['toolbar']		= true;
			SyntaxHighlighter.all();
			</script>
			<!--[/syntaxhighlighter]-->]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mycli%ef%bc%8c%e6%9b%bf%e6%8d%a2%e5%8e%9f%e7%89%88mysql%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%ae%a2%e6%88%b7%e7%ab%af%e7%9a%84%e7%a5%9e%e5%99%a8%e4%b8%80%e6%9e%9a/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
