Emacs记住文本选择 [英] Emacs remember text selection

查看:89
本文介绍了Emacs记住文本选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经准备好尝试新的东西,经过几年的使用gEdit我的大部分编码需求,并尝试学习使用Emacs。我知道这将是困难的,因为我听说过Emacs有多复杂,但是我被它的力量所吸引。最难的事情就是习惯于在.emacs文件中编写ELisp来改变编辑器的内容。我现在不能自己做,但是我在这里找到了一些有用的代码段来改变一些选项。

I decided that I was ready to try something new, after a few years of using gEdit for most of my coding needs, and try to learn using Emacs. I knew this would be difficult, as I have heard how complex Emacs can be, but I was lured by its power. The hardest thing has been getting used to writing ELisp in the .emacs file to change things about the editor. I can't currently do it myself, but I have found a few helpful snippets here and there to change some options.

有一件事我有很多问题随着Emacs记住我在命令后选择的文本。例如,我通常突出显示一段代码来缩小它。但是,如果我在Emacs中执行此操作,它将在选择所有文本之前移动所选文本一次。有人知道这个吗?

One thing I have been having a lot of problems with is getting Emacs to remember the text I have selected after a command. For instance, I commonly highlight a section of code to mass indent it. However, if I do this in Emacs, it will move the selected text only once before unselecting all of the text. Does anyone know a way around this?

无论如何,对于我看起来好像是一个容易的问题,但是经过一个小时的谷歌搜索,并在这里查看所以我以为这是值得问的。我还有几个关于Emacs的问题,但是我会把它们保存下来,并且在我得到这个解决之后单独询问。谢谢!

Anyway, I apologize for what seems to me to be an easy question, but after an hour of Google searching and looking around here on SO, I thought it was worth asking. I have a few more questions about Emacs, but I will save them and ask separately after I get this straightened out. Thanks!

更新

有几个人问我正在使用什么MOD​​,什么类型的文字正在进入虽然我不太了解Emacs模式,但我现在正在编辑一个纯文本文件。如下所示:

A few people have asked about what mod I am using and what type of text I am entering. While I don't know much about Emacs modes, I am editing a pure text file at the moment. Something like this:

Hello, I am a simple text file
that is made up of three separate 
lines.

如果我突出显示所有三行,然后点击TAB,我得到:

If I highlight all three lines and hit TAB, I get this:

    Hello, I am a simple text file
    that is made up of three separate 
    lines.

但是,如果我使用Cx Cx,像下面的一些建议重新选择文本并点击TAB再次,我得到这个:

This is great, however, if I use C-x C-x like some suggest below to reselect the text and hit TAB again, I get this:

        Hello, I am a simple text file
            that is made up of three separate 
                lines.

我希望这有帮助!

推荐答案

尝试在Emacs取消选择后,键入Cx Cx。

Try typing C-x C-x after Emacs unselects it.

然后,而不是击中选项卡(我从来不知道选项卡做你所说的话!这完全是打击了),做 M-8 Cx Ci 。可惜它是如此之多的钥匙,但它应该做你想要的 - 即把所有的东西推到8列以上。如果你想要一些其他数量的列,那么很明显地替换 M-8

Then, instead of hitting tab (I never knew that tab does what you said! That's totally whacked.), do M-8 C-x C-i. Pity it's so many keys, but it ought to do what you want -- namely, shove everything over 8 columns. Obviously replace the M-8 with something else if you want some other number of columns.

这篇关于Emacs记住文本选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆