让 CM-RET 插入 \item[]
在 AUCTeX 中,M-RET 绑定到 (LaTeX-insert-item)
,这会创建一个新的正确缩进行并插入 \item
和一个空格之后放置光标。我想扩展此功能,以便 CM-RET 具有类似的功能,但适用于 \item[description]
。
我想要的是 CM-RET
- 创建一个新的正确缩进行并插入
\item[]
, - 将光标放在方括号之间,然后
- 将光标放在一个当按下 Tab 时,
\item[]
后面有空格。
In AUCTeX M-RET is bound to (LaTeX-insert-item)
which makes a new properly indented line and inserts \item
and a space after which the cursor is placed. I would like to extend this feature so that C-M-RET has similar functionality but for \item[description]
.
What I would like is for C-M-RET to
- make a new properly indented line and insert
\item[]
, - place the cursor between the square brackets, and
- place the cursor one space after
\item[]
as Tab is pressed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下函数抄袭自latex.el,并稍加修改以调用参数提示版本
LaTeX-item-argument
,而不是直接插入项目。您可以将该函数绑定到您喜欢的任何键:
如果您想要
MC-RET
,请使用(元控制返回)
,尽管它似乎仅适用于Alt
键,而不是Esc
键(通常表现相同...)The following function is cribbed from latex.el, and modified slightly to call the argument-prompting version
LaTeX-item-argument
instead of just inserting the item directly.You can bind that function to any key you like:
If you want
M-C-RET
, use(meta control return)
instead, though it only seems to work with theAlt
key, and not theEsc
key (which usually behaves the same...)听起来您想要 Textmate 片段行为。
您需要 yasnippet 来执行代码段扩展/字段移动。 IMO,将其绑定到键并不是一个好的解决方案,因为键的数量是有限的,但 yasnippet 确实允许您这样做。
It sounds like you want Textmate snippets behavior.
You need yasnippet to do the snippet expansion/field movement. IMO, it's not a good solution to bind this to a key because the number of keys is limited, but yasnippet does allow you to do that as well.