Item 5: Use Temp Buffers
条款5:使临时Buffer
One of the most powerful things about Emacs is its ability to swiftly generate a new buffer that isn't associated with a file or process. Once you get used to using this technique, you'll sorely miss the functionality in other editors and applications.
emacs最强大的功能之一就是她可以迅捷地生成一个不与任何一个文件关联的buffer。一旦你习惯了使用这一技术,你就对明显地感觉到其它编辑器这一功能性的不足。
To create a temp buffer, just switch to it! Ctrl-x b invokes the command switch-to-buffer, and you just type in adsflj or whatever comes out of drumming on the keyboard. Instantly you've got yourself a scratchpad, where you can take notes, dump temporary results, or use it in any way that's convenient for the problem at hand.
要想建一个临时buffer,很简单,切换过去就是了!Ctrl-x b调用命令switch-to-buffer,然后你就瞎按一通adsflj。马上地你就来到一个草稿本上,你可以在上面做笔记,把临时结果导过来,或者用来做任何对你手头问题有帮助的事。
If you plan on keeping multiple temp buffers around, you might give them more memorable names,such as foo, bar, baz, and buh.
如果你打算维护多个临时buffer,你则应该给它们起些好记点的名字,比如:foo, bar, baz, buh...等等
If you want to see your temp buffer side-by-side with another buffer, you can split the screen horizontally or vertically. See Item 6.
如果你打算边靠边地比对两个buffer,你可把emacs屏幕水平地分割一下。(条款6会讲到)
Because your temp buffers aren't associated with a file, you can kill them just as quickly as you created them using Ctrl-x k, the kill-buffer command.
由于你的临时buffer并不与任何一个文件关联,你杀它们就跟创建它们一样方便,用ctrl-k,也就是kill-buffer命令。
If you decide you want to save the contents of a temp buffer somewhere, just switch to the buffer and Ctrl-x Ctrl-w to invoke the write-file command. It will prompt you for a filename, and after saving, you can kill the buffer safely and revisit the file contents later.
如果你打算保存临时buffer的内容了,也很简单,使用Ctrl-x Ctrl-w调用write-file命令。她会提示你输入一个文件名。保存文件后,你可以杀掉这个buffer(译注:区区真的很喜欢用杀这个词来替代关闭这一说法~),并可以随时通过打开文件重新访问它的内容。
浙公网安备 33010602011771号