mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
TSL&PRF
This commit is contained in:
parent
a956256b94
commit
5295cdb7b9
@ -1,95 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why I love Emacs)
|
||||
[#]: via: (https://opensource.com/article/20/12/emacs)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Why I love Emacs
|
||||
======
|
||||
Emacs isn't a mere text editor; it places you in control and allows you
|
||||
to solve nearly any problem you encounter.
|
||||
![Emoji keyboard][1]
|
||||
|
||||
I'm a habitual [Emacs][2] user. I didn't choose Emacs as much as it chose me. Back when I was first learning about Unix, I stumbled upon a little-known feature in a strange application called Emacs, which was apparently hidden away on my computer. Legend had it (and was proven true) that if you typed `emacs` into a terminal, pressed **Alt**+**X**, and typed `tetris`, you could play a falling-blocks game.
|
||||
|
||||
![Tetris in Emacs][3]
|
||||
|
||||
That was my introduction to GNU Emacs. While it was frivolous, it was also an accurate indication of what Emacs is all about—the idea that users can reprogram their (virtual) worlds and do _whatever_ they want with an application. Playing Tetris in your text editor is probably not your primary goal on an everyday basis, but it goes to show that Emacs is, proudly, a programming platform. In fact, you might think of it as a kind of precursor to [Jupyter][4], combining a powerful programming language (called `elisp`, to be exact) with its own live environment. As a consequence, Emacs is flexible as a text editor, customizable, and powerful.
|
||||
|
||||
Elisp (and Common Lisp, by extension) aren't necessarily the easiest languages to start out on, if you're used to Bash or Python or similar languages. But LISP dialects are powerful, and because Emacs is a LISP interpreter, you can build applications, whether they're Emacs plugins or prototypes of something you want to develop into a stand-alone project. The wildly popular [org-mode project][5] is just one example: it's an Emacs plugin as well as a markdown syntax with mobile apps to interpret and extend its capabilities. There are many examples of similarly useful applications-within-Emacs, including an email client, a PDF viewer, web browser, a shell, and a file manager.
|
||||
|
||||
### Two interfaces
|
||||
|
||||
GNU Emacs has at least two user interfaces: a graphical user interface (GUI) and a terminal user interface (TUI). This sometimes surprises people because Emacs is often pitted against Vi, which runs in a terminal (although gVim provides a GUI for a modern Vi implementation). If you want to run GNU Emacs as a terminal application, you can launch it with the `-nw` option:
|
||||
|
||||
|
||||
```
|
||||
`$ emacs -nw`
|
||||
```
|
||||
|
||||
With a GUI, you can just launch Emacs from your application menu or a terminal.
|
||||
|
||||
You might think that a GUI renders Emacs less effective, as if "real text editors run in a terminal," but a GUI can make Emacs easier to learn because its GUI follows some typical conventions (a menu bar, adjustable widgets, mouse interaction, and so on).
|
||||
|
||||
In fact, if you run Emacs as a GUI application, you can probably get through the day without noticing you're in Emacs at all. Most of the usual conventions apply, as long as you use the GUI. For instance, you can select text with your mouse, navigate to the **Edit** menu, select **Copy**, and then place your cursor elsewhere and select **Paste**. To save a document, you can go to **File** and **Save** or **Save As**. You can press **Ctrl** and scroll up to make your screen font larger, you can use the scroll bar to navigate through your document, and so on.
|
||||
|
||||
Getting to know Emacs in its GUI form is a great way to flatten the learning curve.
|
||||
|
||||
### Emacs keyboard shortcuts
|
||||
|
||||
GNU Emacs is infamous for complex keyboard combinations. They're not only unfamiliar (**Alt**+**W** to copy? **Ctrl**+**Y** to paste?), they're also notated with arcane terminology ("Alt" is called "Meta"), and sometimes they come in pairs (**Ctrl**+**X** followed by **Ctrl**+**S** to save) and other times alone (**Ctrl**+**S** to search). Why would anyone willfully choose to use this?
|
||||
|
||||
Well, some don't. But those who do are fans of how these combinations easily flow into the rhythm of everyday typing (and often have the **Caps Lock** key serve as a **Ctrl** key). Those who prefer something different, however, have several options.
|
||||
|
||||
* The `evil` mode lets you use Vim keybindings in Emacs. It's that simple: You get to keep the key combinations you've committed to muscle memory, and you inherit the most powerful text editor available.
|
||||
* Common User Access (CUA) keys keep all of the usual Emacs key combinations but the most jarring ones—copy, cut, paste, and undo—are all mapped to their modern bindings (**Ctrl**+**C**, **Ctrl**+**X**, **Ctrl**+**V**, and **Ctrl**+**Z**, respectively).
|
||||
* The `global-set-key` function, part of the programming side of Emacs, allows you to define your own keyboard shortcuts. Traditionally, user-defined shortcuts start with **Ctrl**+**C**, but nothing is stopping you from inventing your own scheme. Emacs isn't precious of its own identity. You're welcome to bend it to your will.
|
||||
|
||||
|
||||
|
||||
### Learn Emacs
|
||||
|
||||
It takes time to get very good with Emacs. For me, that meant printing out a [cheat sheet][6] and keeping it next to my keyboard all day, every day. When I forgot a key combo, I looked it up on my cheat sheet. If it wasn't on my cheat sheet, I learned the keyboard combo, either by executing the function and noting how Emacs told me I could access it quicker or by using `describe-function`:
|
||||
|
||||
|
||||
```
|
||||
M-x describe-function: save-buffer
|
||||
|
||||
save-buffer is an interactive compiled Lisp function in ‘files.el’.
|
||||
|
||||
It is bound to C-x C-s, <menu-bar> <file> <save-buffer>.
|
||||
[...]
|
||||
```
|
||||
|
||||
As you use it, you learn it. And the more you learn about it, the more empowered you become to improve it and make it your own.
|
||||
|
||||
### Try Emacs
|
||||
|
||||
It's a common joke to say that Emacs is an operating system with a text editor included. Maybe that's meant to insinuate Emacs is bloated and overly complex, and there's certainly an argument that a text editor shouldn't require `libpoppler` according to its default configuration (you can compile Emacs without it).
|
||||
|
||||
But there's a greater truth lurking behind this joke, and it reveals a lot about what makes Emacs so fun. It doesn't make sense to compare Emacs to other text editors, like Vim, Nano, or even [VSCodium][7], because the really important part of Emacs isn't the idea that you can type stuff into a window and save it. That's basic functionality that even Bash provides. The true significance of Emacs is how it places you in control and how, through Emacs Lisp ([Elisp][8]), nearly any problem can be solved.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/emacs
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji-keyboard.jpg?itok=JplrSZ9c (Emoji keyboard)
|
||||
[2]: https://en.wikipedia.org/wiki/Emacs
|
||||
[3]: https://opensource.com/sites/default/files/tetris.png (Tetris in Emacs)
|
||||
[4]: https://opensource.com/article/20/11/surprising-jupyter
|
||||
[5]: https://opensource.com/article/19/1/productivity-tool-org-mode
|
||||
[6]: https://opensource.com/downloads/emacs-cheat-sheet
|
||||
[7]: https://opensource.com/article/20/6/open-source-alternatives-vs-code
|
||||
[8]: https://www.gnu.org/software/emacs/manual/html_node/elisp/
|
92
translated/tech/20201202 Why I love Emacs.md
Normal file
92
translated/tech/20201202 Why I love Emacs.md
Normal file
@ -0,0 +1,92 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why I love Emacs)
|
||||
[#]: via: (https://opensource.com/article/20/12/emacs)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
为什么我喜欢 Emacs
|
||||
======
|
||||
|
||||
> Emacs 并不是一个单纯的文本编辑器,它将掌控置于你手中,让你几乎可以解决你遇到的任何问题。
|
||||
|
||||
!["表情符号键盘"][1]
|
||||
|
||||
我是一个典型的 [Emacs][2] 用户。不是我选择的 Emacs,而是它选择了我。早在我刚开始学习 Unix 的时候,我偶然发现了一个奇怪的名为 Emacs 的应用程序,它隐藏在我的电脑上,其中有一个鲜为人知的功能。传说中(而且被证明是真的),如果你在终端上输入 `emacs`,按 `Alt+X`,然后输入 `tetris`,你就可以玩一个掉方块的游戏。
|
||||
|
||||
![Tetris in Emacs][3]
|
||||
|
||||
那就是我对 GNU Emacs 的印象。虽然这很肤浅,但它也准确地表明了 Emacs 的意义:用户可以重新编程他们的(虚拟)世界,并且可以用一个应用程序做*任何*他们想做的事情。在你的文本编辑器中玩俄罗斯方块可能不是你日常的主要目标,但这说明 Emacs 是一个值得骄傲的编程平台。事实上,你可以把它看作是 [Jupyter][4] 的一种先驱,它把一种强大的编程语言(准确的说叫 elisp)和自己的实时环境结合起来。因此,Emacs 作为一个文本编辑器是灵活的、可定制的、强大的。
|
||||
|
||||
如果你习惯于 Bash、Python 或类似的语言,elisp(以及扩展的 Common Lisp)不一定是最容易入门的语言。但是这种 LISP 方言是很强大的,而且因为 Emacs 是一个 LISP 解释器,所以你可以用它构建应用程序,不管它们是 Emacs 插件还是你想开发成一个独立项目的原型。极其流行的 [org 模式项目][5]就是一个例子:它是一个 Emacs 插件,同时也是一个标记语法,有移动应用可以解释和扩展其功能。类似的有用的 Emacs 内应用的例子还有很多,包括电子邮件客户端、PDF 浏览器、Web 浏览器、shell 和文件管理器。
|
||||
|
||||
### 两个界面
|
||||
|
||||
GNU Emacs 至少有两个用户界面:图形用户界面(GUI)和终端用户界面(TUI)。这有时会让人感到惊讶,因为 Emacs 经常与运行在终端中的 Vi 相提并论(尽管 gVim 为现代 Vi 的实现提供了一个 GUI)。如果你想把 GNU Emacs 以终端程序来运行,你可以用 `-nw` 选项来启动它。
|
||||
|
||||
```
|
||||
$ emacs -nw
|
||||
```
|
||||
|
||||
有了 GUI 程序,你可以直接从应用程序菜单或终端启动 Emacs。
|
||||
|
||||
你可能会认为 GUI 会降低 Emacs 的效率,好像“真正的文本编辑器是在终端中运行的”,但 GUI 可以使 Emacs 更容易学习,因为它的 GUI 遵循了一些典型的惯例(菜单栏、可调节的组件、鼠标交互等)。
|
||||
|
||||
事实上,如果你把 Emacs 作为一个 GUI 应用程序来运行,你可能在一天的时间里会完全没有意识到你在 Emacs 中。只要你使用过 GUI,大多数常用的惯例都适用。例如,你可以用鼠标选择文本,导航到**编辑**菜单,选择**复制**,然后将光标放在其他地方,选择**粘贴**。要保存文档,你可以进入**文件**,然后选择**保存**或**另存为**。你可以按 `Ctrl` 键并向上滚动,使屏幕字体变大,你可以使用滚动条来浏览你的文档,等等。
|
||||
|
||||
了解 Emacs 的 GUI 形式是拉平学习曲线的好方法。
|
||||
|
||||
### Emacs 键盘快捷键
|
||||
|
||||
GNU Emacs 以复杂的键盘组合而恶名远扬。它们不仅陌生(`Alt+W` 来复制?`Ctrl+Y` 来粘贴?),而且还用晦涩难懂的术语来标注(`Alt` 被称为 `Meta`),有时它们成双成对(`Ctrl+X` 后是 `Ctrl+S` 来保存),有时则单独出现(`Ctrl+S` 来搜索)。为什么有人会故意选择使用这些呢?
|
||||
|
||||
嗯,有些人不会。但那些喜欢这些的人是因为这些组合很容易融入到日常打字的节奏中(而且经常让 `Caps Lock` 键充当 `Ctrl` 键)。然而,那些喜欢不同的东西的人有几个选择:
|
||||
|
||||
* “邪恶”模式让你在 Emacs 中使用 Vim 键绑定。就是这么简单。你可以保留你的肌肉记忆中的按键组合,并继承最强大的文本编辑器。
|
||||
* 通用用户访问(CUA)键保留了所有 Emacs 常用的组合键,但最令人头疼的键(复制、剪切、粘贴和撤消)都被映射到现代的键盘绑定中(分别为 `Ctrl+C`、`Ctrl+X`、`Ctrl+V` 和 `Ctrl+Z`)。
|
||||
* `global-set-key` 函数,是 Emacs 编程的一部分,允许你定义自己的键盘快捷键。传统上,用户定义的快捷键以 `Ctrl+C` 开头,但没有什么能阻止你发明自己的方案。Emacs 并不敝帚自珍,欢迎你按照自己的意愿来扭转它。
|
||||
|
||||
### 学习 Emacs
|
||||
|
||||
要想很好地使用 Emacs 是需要时间的。对我来说,这意味着打印出一张[速记表][6],每天都把它放在键盘旁边。当我忘了一个键组合时,我就在我的速记表上查找它。如果它不在我的速记表上,我就学习这个键盘组合,要么通过执行该函数,并注意 Emacs 告诉我如何更快地访问它,要么通过使用 `describe-function`:
|
||||
|
||||
```
|
||||
M-x describe-function: save-buffer
|
||||
|
||||
save-buffer is an interactive compiled Lisp function in ‘files.el’.
|
||||
|
||||
It is bound to C-x C-s, <menu-bar> <file> <save-buffer>.
|
||||
[...]
|
||||
```
|
||||
|
||||
当你使用它的时候,你就会学习它。你对它了解得越多,你就越有能力去改进它,使它变成你自己的。
|
||||
|
||||
### 尝试 Emacs
|
||||
|
||||
人们常开玩笑说 Emacs 是一个包含文本编辑器的操作系统。也许这是在暗示 Emacs 臃肿和过于复杂,当然也有一种说法是文本编辑器根据其默认配置不应该需要 `libpoppler`(你可以不需要它来编译 Emacs)。
|
||||
|
||||
但这个笑话背后潜藏着一个更大的真相,它揭示了 Emacs 如此有趣的原因。将 Emacs 与其他文本编辑器,如 Vim、Nano,甚至 [VSCodium][7] 进行比较是没有意义的,因为 Emacs 真正重要的部分并不是你可以在窗口中输入东西并保存的这种思路。那是连 Bash 都能提供的基本功能。Emacs 的真正意义在于它如何将控制置身于你的手中,以及如何通过 Emacs Lisp([Elisp][8])解决几乎任何问题。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/emacs
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji-keyboard.jpg?itok=JplrSZ9c (Emoji keyboard)
|
||||
[2]: https://en.wikipedia.org/wiki/Emacs
|
||||
[3]: https://opensource.com/sites/default/files/tetris.png (Tetris in Emacs)
|
||||
[4]: https://opensource.com/article/20/11/surprising-jupyter
|
||||
[5]: https://opensource.com/article/19/1/productivity-tool-org-mode
|
||||
[6]: https://opensource.com/downloads/emacs-cheat-sheet
|
||||
[7]: https://opensource.com/article/20/6/open-source-alternatives-vs-code
|
||||
[8]: https://www.gnu.org/software/emacs/manual/html_node/elisp/
|
Loading…
Reference in New Issue
Block a user