1 Star 0 Fork 0

codebeautiful/beautifulcode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.html 58.03 KB
一键复制 编辑 原始数据 按行查看 历史
codebeautiful 提交于 2016-12-19 13:29 . Site updated: 2016-12-19 13:29:43
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076
<!DOCTYPE HTML>
<html lang="CN">
<head>
<meta charset="UTF-8">
<title>Blog</title>
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<meta name="author" content="zt.cfvli">
<meta property="og:type" content="website">
<meta property="og:title" content="Blog">
<meta property="og:url" content="http://ttytc.com/index.html">
<meta property="og:site_name" content="Blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Blog">
<link rel="alternative" href="/atom.xml" title="Blog" type="application/atom+xml">
<link rel="icon" href="/img/favicon.ico">
<link rel="apple-touch-icon" href="/img/jacman.jpg">
<link rel="apple-touch-icon-precomposed" href="/img/jacman.jpg">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<header>
<div>
<div id="imglogo">
<a href="/"><img src="/img/logo.png" alt="Blog" title="Blog"/></a>
</div>
<div id="textlogo">
<h1 class="site-name"><a href="/" title="Blog">Blog</a></h1>
<h2 class="blog-motto"></h2>
</div>
<div class="navbar"><a class="navbutton navmobile" href="#" title="Menu">
</a></div>
<nav class="animated">
<ul>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/archives">Archives</a></li>
<li><a href="/about">About</a></li>
<li>
<form class="search" action="//google.com/search" method="get" accept-charset="utf-8">
<label>Search</label>
<input type="search" id="search" name="q" autocomplete="off" maxlength="20" placeholder="Search" />
<input type="hidden" name="q" value="site:ttytc.com">
</form>
</li>
</ul>
</nav>
</div>
</header>
<div id="container">
<div id="main">
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/12/17/ios界面布局元素学习/" title="ios界面布局元素学习" itemprop="url">ios界面布局元素学习</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-12-17T10:37:39.000Z" itemprop="datePublished"> Published 2016-12-17</time>
</p>
</header>
<div class="article-content">
<h1 id="ios界面布局元素学习"><a href="#ios界面布局元素学习" class="headerlink" title="ios界面布局元素学习"></a>ios界面布局元素学习</h1><h3 id="状态栏和导航栏的高度"><a href="#状态栏和导航栏的高度" class="headerlink" title="状态栏和导航栏的高度"></a>状态栏和导航栏的高度</h3><pre><code>20 44
</code></pre>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/ios-ui/">ios ui</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/12/16/Xcode 快捷键/" title="XCode 快捷键" itemprop="url">XCode 快捷键</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-12-16T05:11:43.000Z" itemprop="datePublished"> Published 2016-12-16</time>
</p>
</header>
<div class="article-content">
<p>xcode 快捷键</p>
<ul>
<li>cmd + 1 工程导航器</li>
<li>cmd + 0 显示/隐藏导航面板</li>
<li>cmd + opt + 0 显示/隐藏实用工具面板</li>
<li>cmd + Shift + F 搜索导航器</li>
<li>ctrl + 6 文件栏跳转</li>
<li>cmd + shift + O 快速打开</li>
<li>ctrl + cmd + Up/Down .h .m文件快速切换</li>
<li>cmd + r 运行</li>
<li>cmd + . 停止</li>
<li>cmd + shift + k 清楚工程</li>
<li>cmd + b 构建应用程序</li>
<li>cmd + shift + 0 文档和参考</li>
<li>cmd + shift + j 展示当前你在工程导航器中打开的文件</li>
<li>F6 单步调试</li>
<li>F7 调入</li>
<li>F8 继续</li>
<li>ctrl + F 向右一个字符</li>
<li>ctrl + B 向左一个字符</li>
<li>ctrl + P 前一行</li>
<li>ctrl + N 后一行</li>
<li>ctrl + A 去行首</li>
<li>ctrl + E 到行尾</li>
<li>ctrl + T 调换光标两边的字符</li>
<li>ctrl + D 删除光标右侧字符</li>
<li>ctrl + K 删除本行剩余的字符</li>
<li>cmd + F 搜索</li>
<li>cmd + G 搜索下一处</li>
<li>Shift + Cmd + G 搜索上一处</li>
<li>ctrl + 6 快速查看当前class的方法</li>
<li>cmd+shift+Y 打开调试窗口</li>
<li>cmd+Y 调试运行程序</li>
<li>cmd+option+P 继续</li>
<li>cmd+shift+O 跳过</li>
<li>cmd+shift+I 进入</li>
<li>cmd+shift+T 跳出</li>
<li>option + cmd +[ 代码上移</li>
<li>option + cmd +] 代码下移</li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/XCode/">XCode</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/12/14/Objective c常用方法/" title="Objective-c 常用类型转换" itemprop="url">Objective-c 常用类型转换</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-12-14T05:11:43.000Z" itemprop="datePublished"> Published 2016-12-14</time>
</p>
</header>
<div class="article-content">
<h1 id="NSData-转-NSString"><a href="#NSData-转-NSString" class="headerlink" title="NSData 转 NSString"></a>NSData 转 NSString</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">NSData *data = nil;</div><div class="line">NSString* newStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];</div></pre></td></tr></table></figure>
<h1 id="NSString-转-NSDictionary"><a href="#NSString-转-NSDictionary" class="headerlink" title="NSString 转 NSDictionary"></a>NSString 转 NSDictionary</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">NSString *string = nil;</div><div class="line">NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];</div><div class="line">id json = [NSJSONSerialization JSONObjectWithData:data options: 0 error:nil];</div><div class="line">NSString *test = [json objectForKey:@&quot;ID&quot;];</div></pre></td></tr></table></figure>
<h1 id="NSString-字符串拼接"><a href="#NSString-字符串拼接" class="headerlink" title="NSString 字符串拼接"></a>NSString 字符串拼接</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">NSString *string;</div><div class="line">NSString *string1, string2;</div><div class="line">string = [NSString initWithFormat:@&quot;%@,%@&quot;, string1, string2];</div><div class="line"></div><div class="line">string = [string1 stringByAppendingString:string2];</div><div class="line"></div><div class="line">string = [string1 stringByAppendingFormat:@&quot;%@,%@&quot;, string1, string2];</div></pre></td></tr></table></figure>
<h1 id="主线程"><a href="#主线程" class="headerlink" title="主线程"></a>主线程</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[[NSThread currentThread] isMainThread];</div></pre></td></tr></table></figure>
<h1 id="objectiv-c-判断对象的类型"><a href="#objectiv-c-判断对象的类型" class="headerlink" title="objectiv-c 判断对象的类型"></a>objectiv-c 判断对象的类型</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">BOOL test = [obj isKindOfClass:[SomeClass class]];</div><div class="line">// (BOOL)isKindOfClass:(Class)aClass</div></pre></td></tr></table></figure>
<h1 id="主线程中执行方法"><a href="#主线程中执行方法" class="headerlink" title="主线程中执行方法"></a>主线程中执行方法</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">dispatch_async(dispatch_get_main_queue(), ^&#123;</div><div class="line"></div><div class="line"> &#125;);</div><div class="line">dispatch_async(dispatch_get_global_queue(0, 0), ^&#123;</div><div class="line"></div><div class="line"> &#125;);</div><div class="line">// dispatch_get_global_queue(0, 0) 第一个参数是处理程序块队列的优先级,分为高低和默认, 0 默认 2 高 -2 低</div></pre></td></tr></table></figure>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/Objective-c-NSString-NSData/">Objective-c NSString NSData</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/11/30/laravel5 优化/" title="laravel 5 优化记录" itemprop="url">laravel 5 优化记录</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-11-30T02:07:21.000Z" itemprop="datePublished"> Published 2016-11-30</time>
</p>
</header>
<div class="article-content">
<ul>
<li>配置信息缓存</li>
<li>路由缓存</li>
<li>类映射加载优化</li>
<li>自动加载优化</li>
<li>使用Memecached来存储会话</li>
<li>使用专业缓存驱动器</li>
<li>数据库请求优化</li>
<li>为数据集写缓存逻辑</li>
<li>使用即时编辑器</li>
<li>前端资源合并</li>
</ul>
<h3 id="缓存处理"><a href="#缓存处理" class="headerlink" title="缓存处理"></a>缓存处理</h3><p>添加缓存(配置)</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">php artisan config:cache</div></pre></td></tr></table></figure>
<p>清除缓存</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">php artisan config:clear</div></pre></td></tr></table></figure>
<p>添加路由缓存</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">php artisan route:cache</div></pre></td></tr></table></figure>
<p>清楚</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">php artisan route:clear</div></pre></td></tr></table></figure>
<h3 id="类映射加载优化"><a href="#类映射加载优化" class="headerlink" title="类映射加载优化"></a>类映射加载优化</h3><blockquote>
<p>optimize 命令把常用加载的类合并到一个文件里,通过减少文件的加载,提高效率</p>
</blockquote>
<p>添加</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">php artisan optimize --force</div></pre></td></tr></table></figure>
<blockquote>
<p>生成 bootstrap/cache/compiled.php, bootstrap/cache/services.json 文件<br> 可以修改 config/compile.php 文件来添加要合并的类。<br> 在 production 环境中,参数 –force 不需要指定,文件就会自动生成。</p>
</blockquote>
<p>清除</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">php artisan clear-compiled</div></pre></td></tr></table></figure>
<blockquote>
<p>此命令要运行在 php artisan config:cache 后,因为 optimize 命令是根据配置信息(如:config/app.php 文件的 providers 数组)来生成文件的。</p>
</blockquote>
<h3 id="自动加载优化"><a href="#自动加载优化" class="headerlink" title="自动加载优化"></a>自动加载优化</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">composer dumpautoload -o</div></pre></td></tr></table></figure>
<blockquote>
<p><em>php artisan optimize –force</em> 命令里已经做了这个操作。</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">php artisan config:clear</div><div class="line">php artisan route:clear</div><div class="line">php artisan clear-compiled</div><div class="line">php artisan config:cache</div><div class="line">php artisan route:cache</div><div class="line">php artisan optimize </div><div class="line"><span class="comment"># composer dumpautoload -o</span></div></pre></td></tr></table></figure>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/laravel-web-优化/">laravel web 优化</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/11/28/emqtt dashboard用户名更改/" title="emqtt dashboard用户名更改" itemprop="url">emqtt dashboard用户名更改</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-11-28T05:11:43.000Z" itemprop="datePublished"> Published 2016-11-28</time>
</p>
</header>
<div class="article-content">
<p>./bin/emqttd_ctl commands:</p>
<p>admins add <admin> <password><br>admins del <admin><br>admins passwd <admin> <password></password></admin></admin></password></admin></p>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/emqtt/">emqtt</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/11/28/unix 下随机数填充 u盘/" title="/dev/urandom 真随机数" itemprop="url">/dev/urandom 真随机数</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-11-28T05:11:43.000Z" itemprop="datePublished"> Published 2016-11-28</time>
</p>
</header>
<div class="article-content">
<h1 id="随机数文件"><a href="#随机数文件" class="headerlink" title="随机数文件"></a>随机数文件</h1><ol>
<li>/dev/random 阻塞</li>
<li>/dev/urandom 非阻塞</li>
</ol>
<h1 id="Mac-下完全重写磁盘数据"><a href="#Mac-下完全重写磁盘数据" class="headerlink" title="Mac 下完全重写磁盘数据"></a>Mac 下完全重写磁盘数据</h1><ul>
<li>diskutil list</li>
<li>sudo dd if=/dev/urandom of=/dev/rdisk2</li>
</ul>
<h1 id="随机数生产"><a href="#随机数生产" class="headerlink" title="随机数生产"></a>随机数生产</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">cat /dev/urandom | od -x | tr <span class="_">-d</span> <span class="string">' '</span> | head -n 1</div></pre></td></tr></table></figure>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/11/28/Mac 下制作ubuntu安装盘/" title="Mac os 系统下制作ubuntu安装u盘" itemprop="url">Mac os 系统下制作ubuntu安装u盘</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-11-28T05:11:43.000Z" itemprop="datePublished"> Published 2016-11-28</time>
</p>
</header>
<div class="article-content">
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line"><span class="comment"># 制作Mac下可以使用的dmg文件</span></div><div class="line">hdiutil convert -format UDRW -o ubuntu.iso ubuntu-16.04.1-desktop-amd64.iso</div><div class="line"><span class="comment"># 修改文件名</span></div><div class="line">mv ubuntu.iso.dmg ubuntu.iso</div><div class="line"><span class="comment"># 找到制作的u盘</span></div><div class="line">diskutil list</div><div class="line"><span class="comment"># 推出该磁盘</span></div><div class="line">diskutil unmountDisk /dev/disk2</div><div class="line"><span class="comment"># 制作ubuntu系统盘</span></div><div class="line">sudo dd <span class="keyword">if</span>=./ubuntu.iso of=/dev/rdisk2 bs=1m</div></pre></td></tr></table></figure>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/ubuntu-MacOS-系统盘-u盘/">ubuntu MacOS 系统盘 u盘</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/11/28/vim 命令总结/" title="vim 命令使用总结" itemprop="url">vim 命令使用总结</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-11-28T05:11:43.000Z" itemprop="datePublished"> Published 2016-11-28</time>
</p>
</header>
<div class="article-content">
<h2 id="命令模式下,d-D-操作总结"><a href="#命令模式下,d-D-操作总结" class="headerlink" title="命令模式下,d(D) 操作总结"></a>命令模式下,d(D) 操作总结</h2><ol>
<li>删除当前光标下的整个单词: daw</li>
<li>删除当前光标到单词首:db</li>
<li>删除当前光标到单词尾:dw</li>
<li>删除当前光标所在位置到行首:d^ | d0(包括空格,tab)</li>
<li>删除当前光标到行尾:d$ | D</li>
<li>删除到下一句的开始:d)</li>
<li>删除到下一段的开始:d}</li>
<li>删除从文本中出现 “text” 字符的位置:d/text<br>9.</li>
</ol>
<h2 id="移动命令(非常用)"><a href="#移动命令(非常用)" class="headerlink" title="移动命令(非常用)"></a>移动命令(非常用)</h2><ol>
<li>光标移动屏幕顶行 H</li>
<li>光标移动屏幕中央 M</li>
<li>光标移动屏幕底部 L</li>
<li>查询当前行信息和当前文件信息 C-g</li>
<li>将第 # 行滚至屏幕顶部 #z</li>
</ol>
<h2 id="进入和退出-vim-命令"><a href="#进入和退出-vim-命令" class="headerlink" title="进入和退出 vim 命令"></a>进入和退出 vim 命令</h2><h3 id="进入命令"><a href="#进入命令" class="headerlink" title="进入命令"></a>进入命令</h3><ol>
<li>打开文件,光标置于第一行 vim filename</li>
<li>打开文件,光标置于 n 行 vim +n filename</li>
<li>打开文件,光标置于最后一行 vim + filename</li>
<li>打开文件,将光标置于与 pattern 第一个匹配的地方vim +/pattern filename</li>
<li>打开文件,并恢复上次崩溃的文件 vim -r filename</li>
<li>打开文件前,先执行指定的命令 vim -c cmd file</li>
</ol>
<p>-R 以只读的方式打开文件,但可强制保存<br>-M 以只读方式打开文件,但是不可强制保存<br>vim –remote file : 用已有的vim进程打开指定的文件</p>
<h3 id="退出命令"><a href="#退出命令" class="headerlink" title="退出命令"></a>退出命令</h3><ol>
<li>ZZ</li>
<li>:q!</li>
<li>:wq</li>
</ol>
<h2 id="文档操作"><a href="#文档操作" class="headerlink" title="文档操作"></a>文档操作</h2><ol>
<li>:e file –关闭当前编辑的文件,并开启新的文件。 如果对当前文件的修改未保存,vi会警告。</li>
<li>:e! file –放弃对当前文件的修改,编辑新的文件。</li>
<li>:e+file – 开始新的文件,并从文件尾开始编辑。</li>
<li>:e+n file – 开始新的文件,并从第n行开始编辑。</li>
<li>:enew –编译一个未命名的新文档。(CTRL-W n)</li>
<li>:e – 重新加载当前文档。</li>
<li>:e! – 重新加载当前文档,并丢弃已做的改动。</li>
<li>:e#或ctrl+^ – 回到刚才编辑的文件,很实用。</li>
<li>:f或ctrl+g – 显示文档名,是否修改,和光标位置。</li>
<li>:f filename – 改变编辑的文件名,这时再保存相当于另存为。</li>
<li>gf – 打开以光标所在字符串为文件名的文件。</li>
<li>:w – 保存修改。</li>
<li>:n1,n2w filename – 选择性保存从某n1行到另n2行的内容。</li>
<li>:wq – 保存并退出。</li>
<li>ZZ – 保存并退出。</li>
<li>:x – 保存并退出。</li>
<li>:q[uit] ——退出当前窗口。(CTRL-W q或CTRL-W CTRL-Q)</li>
<li>:saveas newfilename – 另存为</li>
<li>:browse e – 会打开一个文件浏览器让你选择要编辑的文件。 如果是终端中,则会打开netrw的文件浏览窗口; 如果是gvim,则会打开一个图形界面的浏览窗口。 实际上:browse后可以跟任何编辑文档的命令,如sp等。 用browse打开的起始目录可以由browsedir来设置:</li>
<li>:set browsedir=last – 用上次访问过的目录(默认);</li>
<li>:set browsedir=buffer – 用当前文件所在目录;</li>
<li>:set browsedir=current – 用当前工作目录;</li>
<li>:Sex – 水平分割一个窗口,浏览文件系统;</li>
<li>:Vex – 垂直分割一个窗口,浏览文件系统;</li>
</ol>
<h2 id="特别的移动命令"><a href="#特别的移动命令" class="headerlink" title="特别的移动命令"></a>特别的移动命令</h2><ol>
<li><ul>
<li>/ Enter : 把光标移动至下一行第一个非空白字符</li>
</ul>
</li>
<li><ul>
<li>把光标移至上一行第一个非空白字符</li>
</ul>
</li>
</ol>
<h3 id="g-命令使用总结"><a href="#g-命令使用总结" class="headerlink" title="g 命令使用总结"></a>g 命令使用总结</h3><blockquote>
<p>ge 后移一个单词,光标停在上一个单词末尾 <br><br>gE 反向转移到上一个 WORD 的结尾处 <br><br>gv 重新选择上次的可视区域 <br><br>gd 转到当前函数里当前光标所在的单词的定义 <br><br>gD 转到当前文件的光标所在单词的定义 <br><br>gf 开始编辑当前光标所在的名字对应的文件 <br><br>gF 开始编辑光标所在的文件名并跳转到文件名后的 <br><br>gJ 连接行,不插入空格 <br><br>ga 打印光标所在处的字符的 ascii 值 <br><br> g8 显示光标所在的 UTF-8 字符的十六进制字节码 <br><br>gg 光标移动到第 N 行,缺省是第一行 <br></p>
</blockquote>
<h2 id="插入模式"><a href="#插入模式" class="headerlink" title="插入模式"></a>插入模式</h2><ol>
<li>进入替换模式,直到按下 esc R</li>
</ol>
<blockquote>
<p>^V 按下^V后即可进行矩形的选择</p>
<blockquote>
<ol>
<li>aw 选择单词 <br></li>
<li>iw 内部单词(无空格) <br></li>
<li>as 选择句子 <br></li>
<li>is 选择句子(无空格) <br></li>
<li>ap 选择段落 <br></li>
<li>ip 选择段落(无空格) <br></li>
<li>D 删除到行尾 <br></li>
<li>x,y 删除与复制包含高亮区 <br></li>
<li>I 编辑相同列,可添加注释</li>
</ol>
</blockquote>
<p>c-[[ | esc esc</p>
</blockquote>
<p><br><br>fx 向右跳到本行字符x处(x可以是任何字符)<br>Fx 向左跳到本行字符x处(x可以是任何字符)</p>
<p>tx 和fx相同,区别是跳到字符x前<br>Tx 和Fx相同,区别是跳到字符x后</p>
<h2 id="标记"><a href="#标记" class="headerlink" title="标记"></a>标记</h2><p>使用标记可以快速移动。到达标记后,可以用Ctrl+o返回原来的位置。 Ctrl+o和Ctrl+i 很像浏览器上的 后退 和 前进 。</p>
<p>m{a-z}: 标记光标所在位置,局部标记,只用于当前文件。<br>m{A-Z}: 标记光标所在位置,全局标记。标记之后,退出Vim, 重新启动,标记仍然有效。<br><code>{a-z}: 移动到标记位置。
&#39;{a-z}: 移动到标记行的行首。</code>{0-9}:回到上[2-10]次关闭vim时最后离开的位置。<br><code>: 移动到上次编辑的位置。&#39;&#39;也可以,不过</code>精确到列,而’’精确到行 。如果想跳转到更老的位置,可以按C-o,跳转到更新的位置用C-i。<br><code>&quot;: 移动到上次离开的地方。</code>.: 移动到最后改动的地方。<br>:marks 显示所有标记。<br>:delmarks a b – 删除标记a和b。<br>:delmarks a-c – 删除标记a、b和c。<br>:delmarks a c-f – 删除标记a、c、d、e、f。<br>:delmarks! – 删除当前缓冲区的所有标记。<br>:help mark-motions 查看更多关于mark的知识。</p>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/quick-key/">quick key</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/11/28/emacs quick key /" title="emacs 快捷键" itemprop="url">emacs 快捷键</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-11-28T05:11:43.000Z" itemprop="datePublished"> Published 2016-11-28</time>
</p>
</header>
<div class="article-content">
<h1 id="emacs-快捷键"><a href="#emacs-快捷键" class="headerlink" title="emacs 快捷键"></a>emacs 快捷键</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div><div class="line">135</div><div class="line">136</div><div class="line">137</div><div class="line">138</div><div class="line">139</div><div class="line">140</div><div class="line">141</div><div class="line">142</div><div class="line">143</div><div class="line">144</div><div class="line">145</div><div class="line">146</div><div class="line">147</div><div class="line">148</div><div class="line">149</div><div class="line">150</div><div class="line">151</div><div class="line">152</div><div class="line">153</div><div class="line">154</div><div class="line">155</div><div class="line">156</div><div class="line">157</div><div class="line">158</div><div class="line">159</div><div class="line">160</div><div class="line">161</div><div class="line">162</div><div class="line">163</div><div class="line">164</div><div class="line">165</div><div class="line">166</div><div class="line">167</div><div class="line">168</div><div class="line">169</div><div class="line">170</div><div class="line">171</div><div class="line">172</div><div class="line">173</div><div class="line">174</div><div class="line">175</div><div class="line">176</div><div class="line">177</div><div class="line">178</div><div class="line">179</div><div class="line">180</div><div class="line">181</div><div class="line">182</div><div class="line">183</div><div class="line">184</div><div class="line">185</div><div class="line">186</div><div class="line">187</div><div class="line">188</div><div class="line">189</div><div class="line">190</div><div class="line">191</div><div class="line">192</div><div class="line">193</div><div class="line">194</div><div class="line">195</div><div class="line">196</div><div class="line">197</div><div class="line">198</div><div class="line">199</div><div class="line">200</div><div class="line">201</div><div class="line">202</div><div class="line">203</div><div class="line">204</div><div class="line">205</div><div class="line">206</div><div class="line">207</div><div class="line">208</div><div class="line">209</div><div class="line">210</div><div class="line">211</div><div class="line">212</div><div class="line">213</div><div class="line">214</div><div class="line">215</div><div class="line">216</div><div class="line">217</div><div class="line">218</div><div class="line">219</div><div class="line">220</div><div class="line">221</div><div class="line">222</div><div class="line">223</div><div class="line">224</div><div class="line">225</div><div class="line">226</div><div class="line">227</div><div class="line">228</div><div class="line">229</div><div class="line">230</div><div class="line">231</div><div class="line">232</div><div class="line">233</div><div class="line">234</div><div class="line">235</div><div class="line">236</div><div class="line">237</div><div class="line">238</div><div class="line">239</div><div class="line">240</div><div class="line">241</div><div class="line">242</div><div class="line">243</div><div class="line">244</div><div class="line">245</div><div class="line">246</div><div class="line">247</div><div class="line">248</div><div class="line">249</div><div class="line">250</div><div class="line">251</div><div class="line">252</div></pre></td><td class="code"><pre><div class="line">基本快捷键(Basic)</div><div class="line">C-x C-f &quot;find&quot;文件, 即在缓冲区打开/新建一个文件</div><div class="line">C-x C-s 保存文件</div><div class="line">C-x C-w 使用其他文件名另存为文件</div><div class="line">C-x C-v 关闭当前缓冲区文件并打开新文件</div><div class="line">C-x i 在当前光标处插入文件</div><div class="line">C-x b 新建/切换缓冲区</div><div class="line">C-x C-b 显示缓冲区列表</div><div class="line">C-x k 关闭当前缓冲区</div><div class="line">C-z 挂起emacs</div><div class="line">C-x C-c 关闭emacs</div><div class="line"></div><div class="line">光标移动基本快捷键(Basic Movement)</div><div class="line">C-f 后一个字符</div><div class="line">C-b 前一个字符</div><div class="line">C-p 上一行</div><div class="line">C-n 下一行</div><div class="line">M-f 后一个单词</div><div class="line">M-b 前一个单词</div><div class="line">C-a 行首</div><div class="line">C-e 行尾</div><div class="line">C-v 向下翻一页</div><div class="line">M-v 向上翻一页</div><div class="line">M-&lt; 到文件开头</div><div class="line">M-&gt; 到文件末尾</div><div class="line"></div><div class="line">编辑(Editint)</div><div class="line">M-n 重复执行后一个命令n次</div><div class="line">C-u 重复执行后一个命令4次</div><div class="line">C-u n 重复执行后一个命令n次</div><div class="line">C-d 删除(delete)后一个字符</div><div class="line">M-d 删除后一个单词</div><div class="line">Del 删除前一个字符</div><div class="line">M-Del 删除前一个单词</div><div class="line">C-k 移除(kill)一行</div><div class="line"></div><div class="line">C-Space 设置开始标记 (例如标记区域)</div><div class="line">C-@ 功能同上, 用于C-Space被操作系统拦截的情况</div><div class="line">C-w 移除(kill)标记区域的内容</div><div class="line">M-w 复制标记区域的内容</div><div class="line">C-y 召回(yank)复制/移除的区域/行</div><div class="line">M-y 召回更早的内容 (在kill缓冲区内循环)</div><div class="line">C-x C-x 交换光标和标记</div><div class="line"></div><div class="line">C-t 交换两个字符的位置</div><div class="line">M-t 交换两个单词的位置</div><div class="line">C-x C-t 交换两行的位置</div><div class="line">M-u 使从光标位置到单词结尾处的字母变成大写</div><div class="line">M-l 与M-u相反</div><div class="line">M-c 使从光标位置开始的单词的首字母变为大写</div><div class="line"></div><div class="line">重要快捷键(Important)</div><div class="line">C-g 停止当前运行/输入的命令</div><div class="line">C-x u 撤销前一个命令</div><div class="line">M-x revert-buffer RETURN (照着这个输入)撤销上次存盘后所有改动</div><div class="line">M-x recover-file RETURN 从自动存盘文件恢复</div><div class="line">M-x recover-session RETURN 如果你编辑了几个文件, 用这个恢复</div><div class="line"></div><div class="line">在线帮助(Online-Help)</div><div class="line">C-h c 显示快捷键绑定的命令</div><div class="line">C-h k 显示快捷键绑定的命令和它的作用</div><div class="line">C-h l 显示最后100个键入的内容</div><div class="line">C-h w 显示命令被绑定到哪些快捷键上</div><div class="line">C-h f 显示函数的功能</div><div class="line">C-h v 显示变量的含义和值</div><div class="line">C-h b 显示当前缓冲区所有可用的快捷键</div><div class="line">C-h t 打开emacs教程</div><div class="line">C-h i 打开info阅读器</div><div class="line">C-h C-f 显示emacs FAQ</div><div class="line">C-h p 显示本机Elisp包的信息</div><div class="line"></div><div class="line">搜索/替换(Seach/Replace)</div><div class="line">C-s 向后搜索</div><div class="line">C-r 向前搜索</div><div class="line">C-g 回到搜索开始前的位置(如果你仍然在搜索模式中)</div><div class="line">M-% 询问并替换(query replace)</div><div class="line"></div><div class="line">Space或y 替换当前匹配</div><div class="line">Del或n 不要替换当前匹配</div><div class="line">. 仅仅替换当前匹配并退出(替换)</div><div class="line">, 替换并暂停(按Space或y继续)</div><div class="line">! 替换以下所有匹配</div><div class="line">^ 回到上一个匹配位置</div><div class="line">RETURN或q 退出替换</div><div class="line"></div><div class="line">使用正则表达式(Regular expression)搜索/替换</div><div class="line">可在正则表达式中使用的符号:</div><div class="line">^ 行首</div><div class="line">$ 行尾</div><div class="line">. 单个字符</div><div class="line">.* 任意多个(包括没有)字符</div><div class="line">\&lt; 单词开头</div><div class="line">\&gt; 单词结尾</div><div class="line">[] 括号中的任意一个字符(例如[a-z]表示所有的小写字母)</div><div class="line"></div><div class="line">M C-s RETURN 使用正则表达式向后搜索</div><div class="line">M C-r RETURN 使用正则表达式向前搜索</div><div class="line">C-s 增量搜索</div><div class="line">C-s 重复增量搜索</div><div class="line">C-r 向前增量搜索</div><div class="line">C-r 重复向前增量搜索</div><div class="line">M-x query-replace-regexp 使用正则表达式搜索并替换</div><div class="line"></div><div class="line">窗口命令(Window Commands)</div><div class="line">C-x 2 水平分割窗格</div><div class="line">C-x 3 垂直分割窗格</div><div class="line">C-x o 切换至其他窗格</div><div class="line">C-x 0 关闭窗格</div><div class="line">C-x 1 关闭除了光标所在窗格外所有窗格</div><div class="line">C-x ^ 扩大窗格</div><div class="line">M-x shrink-window 缩小窗格</div><div class="line">M C-v 滚动其他窗格内容</div><div class="line">C-x 4 f 在其他窗格中打开文件</div><div class="line">C-x 4 0 关闭当前缓冲区和窗格</div><div class="line">C-x 5 2 新建窗口(frame)</div><div class="line">C-x 5 f 在新窗口中打开文件</div><div class="line">C-x 5 o 切换至其他窗口</div><div class="line">C-x 5 0 关闭当前窗口</div><div class="line"></div><div class="line">书签命令(Bookmark commands)</div><div class="line">C-x r m 在光标当前位置创建书签</div><div class="line">C-x r b 转到书签</div><div class="line">M-x bookmark-rename 重命名书签</div><div class="line">M-x bookmark-delete 删除书签</div><div class="line">M-x bookmark-save 保存书签</div><div class="line">C-x r l 列出书签清单</div><div class="line"></div><div class="line">d 标记等待删除</div><div class="line">Del 取消删除标记</div><div class="line">x 删除被标记的书签</div><div class="line">r 重命名</div><div class="line">s 保存列表内所有书签</div><div class="line">f 转到当前书签指向的位置</div><div class="line">m 标记在多窗口中打开</div><div class="line">v 显示被标记的书签(或者光标当前位置的书签)</div><div class="line">t 切换是否显示路径列表</div><div class="line">w 显示当前文件路径</div><div class="line">q 退出书签列表</div><div class="line"></div><div class="line">M-x bookmark-write 将所有书签导出至指定文件</div><div class="line">M-x bookmark-load 从指定文件导入书签</div><div class="line"></div><div class="line">Shell</div><div class="line">M-x shell 打开shell模式</div><div class="line">C-c C-c 类似unix里的C-c(停止正在运行的程序)</div><div class="line">C-d 删除光标后一个字符</div><div class="line">C-c C-d 发送EOF</div><div class="line">C-c C-z 挂起程序(unix下的C-z)</div><div class="line">M-p 显示前一条命令</div><div class="line">M-n 显示后一条命令</div><div class="line"></div><div class="line">DIRectory EDitor (dired)</div><div class="line">C-x d 打开dired</div><div class="line">C(大写C) 复制</div><div class="line">d 标记等待删除</div><div class="line">D 立即删除</div><div class="line">e或f 打开文件或目录</div><div class="line">g 刷新当前目录</div><div class="line">G 改变文件所属组(chgrp)</div><div class="line">k 从屏幕上的列表里删除一行(不是真的删除)</div><div class="line">m 用*标记</div><div class="line">n 光标移动到下一行</div><div class="line">o 在另一个窗格打开文件并移动光标</div><div class="line">C-o 在另一个窗格打开文件但不移动光标</div><div class="line">P 打印文件</div><div class="line">q 退出dired</div><div class="line">Q 在标记的文件中替换</div><div class="line">R 重命名文件</div><div class="line">u 移除标记</div><div class="line">v 显示文件内容</div><div class="line">x 删除有D标记的文件</div><div class="line">Z 压缩/解压缩文件</div><div class="line">M-Del 移除标记(默认为所有类型的标记)</div><div class="line">~ 标记备份文件(文件名有~的文件)等待删除</div><div class="line"># 标记自动保存文件(文件名形如#name#)等待删除</div><div class="line">*/ 用*标记所有文件夹(用C-u */n移除标记)</div><div class="line">= 将当前文件和标记文件(使用C-@标记而不是dired的m标记)比较</div><div class="line">M-= 将当前文件和它的备份比较</div><div class="line">! 对当前文件应用shell命令</div><div class="line">M-&#125; 移动光标至下一个用*或D标记的文件</div><div class="line">M-&#123; 移动光标至上一个用*或D标记的文件</div><div class="line">% d 使用正则表达式标记文件等待删除</div><div class="line">% m 使用正则表达式标记文件为*</div><div class="line">+ 新建文件夹</div><div class="line">&gt; 移动光标至后一个文件夹</div><div class="line">&lt; 移动光标至前一个文件夹</div><div class="line">s 切换排序模式(按文件名/日期)</div><div class="line"></div><div class="line">或许把这个命令归入这一类也很合适:</div><div class="line">M-x speedbar 打开一个独立的目录显示窗口</div><div class="line"></div><div class="line">Telnet</div><div class="line">M-x telnet 打开telnet模式</div><div class="line">C-d 删除后一个字符或发送EOF</div><div class="line">C-c C-c 停止正在运行的程序(和unix下的C-c类似)</div><div class="line">C-c C-d 发送EOF</div><div class="line">C-c C-o 清除最后一个命令的输出</div><div class="line">C-c C-z 挂起正在运行的命令</div><div class="line">C-c C-u 移除前一行</div><div class="line">M-p 显示前一条命令</div><div class="line"></div><div class="line">Text</div><div class="line">只能在text模式里使用</div><div class="line">M-s 使当前行居中</div><div class="line">M-S 使当前段落居中</div><div class="line">M-x center-region 使被选中的区域居中</div><div class="line"></div><div class="line">宏命令(Macro-commands)</div><div class="line">C-x ( 开始定义宏</div><div class="line">C-x ) 结束定义宏</div><div class="line">C-x e 运行最近定义的宏</div><div class="line">M-n C-x e 运行最近定义的宏n次</div><div class="line">M-x name-last-kbd-macro 给最近定义的宏命名(用来保存)</div><div class="line">M-x insert-kbd-macro 将已命名的宏保存到文件</div><div class="line">M-x load-file 载入宏</div><div class="line"></div><div class="line">编程(Programming)</div><div class="line">M C-\ 自动缩进光标和标记间的区域</div><div class="line">M-m 移动光标到行首第一个(非空格)字符</div><div class="line">M-^ 将当前行接到上一行末尾处</div><div class="line">M-; 添加缩进并格式化的注释</div><div class="line">C, C++和Java模式</div><div class="line">M-a 移动光标到声明的开始处</div><div class="line">M-e 移动光标到声明的结尾处</div><div class="line">M C-a 移动光标到函数的开始处</div><div class="line">M C-e 移动光标到函数的结尾处</div><div class="line">C-c RETURN 将光标移动到函数的开始处并标记到结尾处</div><div class="line">C-c C-q 根据缩进风格缩进整个函数</div><div class="line">C-c C-a 切换自动换行功能</div><div class="line">C-c C-d 一次性删除光标后的一串空格(greedy delete)</div><div class="line"></div><div class="line">为了实现下面的一些技术, 你需要在保存源代码的目录里运行&quot;etags</div><div class="line">*.c *.h *.cpp&quot;(或者源代码的其他的扩展名)</div><div class="line">M-.(点) 搜索标签</div><div class="line">M-x tags-search ENTER 在所有标签里搜索(使用正则表达式)</div><div class="line">M-,(逗号) 在tags-search里跳至下一个匹配处</div><div class="line">M-x tags-query-replace 在设置过标签的所有文件里替换文本</div><div class="line"></div><div class="line">GDB(调试器)</div><div class="line">M-x gdb 在另一个的窗格中打开gdb</div><div class="line"></div><div class="line">版本控制(Version Control)</div><div class="line">C-x v d 显示当前目录下所有注册过的文件(show all registered files in this dir)</div><div class="line">C-x v = 比较不同版本间的差异(show diff between versions)</div><div class="line">C-x v u 移除上次提交之后的更改(remove all changes since last checkin)</div><div class="line">C-x v ~ 在不同窗格中显示某个版本(show certain version in different window)</div><div class="line">C-x v l 打印日志(print log)</div><div class="line">C-x v i 标记文件等待添加版本控制(mark file for version control add)</div><div class="line">C-x v h 给文件添加版本控制文件头(insert version control header into file)</div><div class="line">C-x v r 获取命名过的快照(check out named snapshot)</div><div class="line">C-x v s 创建命名的快照(create named snapshot)</div><div class="line">C-x v a 创建gnu风格的更改日志(create changelog file in gnu-style)</div></pre></td></tr></table></figure>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/quick-key/">quick key</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<article class="post-expand post" itemprop="articleBody">
<header class="article-info clearfix">
<h1 itemprop="name">
<a href="/2016/11/28/mac os 文本编辑 之 emacs 快捷键/" title="mac os 文本编辑" itemprop="url">mac os 文本编辑</a>
</h1>
<p class="article-author">By
<a href="/about" title="zt.cfvli" target="_blank" itemprop="author">zt.cfvli</a>
<p class="article-time">
<time datetime="2016-11-28T05:11:43.000Z" itemprop="datePublished"> Published 2016-11-28</time>
</p>
</header>
<div class="article-content">
<p>C = Control<br>M = Meta = Alt | Esc<br>Del = Backspace</p>
<ul>
<li><p>光标移动基本快捷键(Basic Movement)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">C-f 后一个字符</div><div class="line">C-b 前一个字符</div><div class="line">C-p 上一行</div><div class="line">C-n 下一行</div><div class="line">M-f 后一个单词</div><div class="line">M-b 前一个单词</div><div class="line">C-a 行首</div><div class="line">C-e 行尾</div><div class="line">C-v 向下翻一页</div><div class="line">M-v 向上翻一页</div><div class="line">M-&lt; 到文件开头</div><div class="line">M-&gt; 到文件末尾</div></pre></td></tr></table></figure>
</li>
<li><p>编辑(Editint)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">M-n 重复执行后一个命令n次</div><div class="line">C-u 重复执行后一个命令4次</div><div class="line">C-u n 重复执行后一个命令n次</div><div class="line">C-d 删除(delete)后一个字符</div><div class="line">M-d 删除后一个单词</div><div class="line">Del 删除前一个字符</div><div class="line">M-Del 删除前一个单词</div><div class="line">C-k 移除(kill)一行</div></pre></td></tr></table></figure>
</li>
</ul>
<p class="article-more-link">
</p>
</div>
<footer class="article-footer clearfix">
<div class="article-catetags">
<div class="article-tags">
<span></span> <a href="/tags/quick-key/">quick key</a>
</div>
</div>
<div class="comments-count">
</div>
</footer>
</article>
<nav id="page-nav" class="clearfix">
<span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="extend next" rel="next" href="/page/2/">Next<span></span></a>
</nav>
</div>
<div class="openaside"><a class="navbutton" href="#" title="Show Sidebar"></a></div>
<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="Hide Sidebar"></a></div>
<aside class="clearfix">
<div class="tagslist">
<p class="asidetitle">Tags</p>
<ul class="clearfix">
<li><a href="/tags/quick-key/" title="quick key">quick key<sup>4</sup></a></li>
<li><a href="/tags/ubuntu-MacOS-系统盘-u盘/" title="ubuntu MacOS 系统盘 u盘">ubuntu MacOS 系统盘 u盘<sup>1</sup></a></li>
<li><a href="/tags/XCode/" title="XCode">XCode<sup>1</sup></a></li>
<li><a href="/tags/Objective-c-NSString-NSData/" title="Objective-c NSString NSData">Objective-c NSString NSData<sup>1</sup></a></li>
<li><a href="/tags/emqtt/" title="emqtt">emqtt<sup>1</sup></a></li>
<li><a href="/tags/ios-ui/" title="ios ui">ios ui<sup>1</sup></a></li>
<li><a href="/tags/laravel-web-优化/" title="laravel web 优化">laravel web 优化<sup>1</sup></a></li>
</ul>
</div>
<div class="linkslist">
<p class="asidetitle">Links</p>
<ul>
<li>
<a href="https://coderq.com" target="_blank" title="一个面向程序员交流分享的新一代社区">码农圈</a>
</li>
<li>
<a href="http://wuchong.me" target="_blank" title="Jark&#39;s Blog">Jark&#39;s Blog</a>
</li>
</ul>
</div>
<div class="rsspart">
<a href="/atom.xml" target="_blank" title="rss">RSS</a>
</div>
<div class="weiboshow">
<p class="asidetitle">Weibo</p>
<iframe width="100%" height="119" class="share_self" frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=119&fansRow=2&ptype=1&speed=0&skin=9&isTitle=1&noborder=1&isWeibo=0&isFans=0&uid=null&verifier=b3593ceb&dpc=1"></iframe>
</div>
</aside>
</div>
</div>
<footer><div id="footer" >
<div class="line">
<span></span>
<div class="author"></div>
</div>
<section class="info">
<p> Hello ,I&#39;m Larry Page in Google. <br/>
This is my blog,believe it or not.</p>
</section>
<div class="social-font" class="clearfix">
<a href="http://weibo.com/2176287895" target="_blank" class="icon-weibo" title="微博"></a>
</div>
<p class="copyright">
Powered by <a href="http://hexo.io" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/wuchong/jacman" target="_blank" title="Jacman">Jacman</a> © 2016
<a href="/about" target="_blank" title="zt.cfvli">zt.cfvli</a>
</p>
</div>
</footer>
<script src="/js/jquery-2.0.3.min.js"></script>
<script src="/js/jquery.imagesloaded.min.js"></script>
<script src="/js/gallery.js"></script>
<script src="/js/jquery.qrcode-0.12.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.navbar').click(function(){
$('header nav').toggleClass('shownav');
});
var myWidth = 0;
function getSize(){
if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
} else if( document.documentElement && document.documentElement.clientWidth) {
myWidth = document.documentElement.clientWidth;
};
};
var m = $('#main'),
a = $('#asidepart'),
c = $('.closeaside'),
o = $('.openaside');
c.click(function(){
a.addClass('fadeOut').css('display', 'none');
o.css('display', 'block').addClass('fadeIn');
m.addClass('moveMain');
});
o.click(function(){
o.css('display', 'none').removeClass('beforeFadeIn');
a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');
m.removeClass('moveMain');
});
$(window).scroll(function(){
o.css("top",Math.max(80,260-$(this).scrollTop()));
});
$(window).resize(function(){
getSize();
if (myWidth >= 1024) {
$('header nav').removeClass('shownav');
}else{
m.removeClass('moveMain');
a.css('display', 'block').removeClass('fadeOut');
o.css('display', 'none');
}
});
});
</script>
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.article-content').each(function(i){
$(this).find('img').each(function(){
if ($(this).parent().hasClass('fancybox')) return;
var alt = this.alt;
if (alt) $(this).after('<span class="caption">' + alt + '</span>');
$(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
});
$(this).find('.fancybox').each(function(){
$(this).attr('rel', 'article' + i);
});
});
if($.fancybox){
$('.fancybox').fancybox();
}
});
</script>
<!-- Analytics Begin -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-75864707-1', 'null');
ga('send', 'pageview');
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?e6d1f421bbc9962127a50488f9ed37d1";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- Analytics End -->
<!-- Totop Begin -->
<div id="totop">
<a title="Back to Top"><img src="/img/scrollup.png"/></a>
</div>
<script src="/js/totop.js"></script>
<!-- Totop End -->
<!-- MathJax Begin -->
<!-- mathjax config similar to math.stackexchange -->
<!-- MathJax End -->
<!-- Tiny_search Begin -->
<!-- Tiny_search End -->
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/codebeautiful/beautifulcode.git
[email protected]:codebeautiful/beautifulcode.git
codebeautiful
beautifulcode
beautifulcode
master

搜索帮助