emacs 如何返回到上一层的括号{ [ ( 之类的

1.  var extend = function(obj) {
2.    var length = arguments.length;
3.     if (length < 2 || obj == null) return obj;
4.     for (var index = 1; index < length; index++) {
5.         var source = arguments[index];
6.         for (var key in source) {
7.             obj[key] = source[key];
8.         }
9.     }
10.    return obj;
11.};

比如现在光标在第7行,先返回到第6行最后的 { 中,然后在返回到第4行最后的 {

json 文件中 [ 也可以使用的

试了下 C-M-u (backward-up-list) 是可行的

C-M-u runs the command backward-up-list (found in global-map), which
is an interactive compiled Lisp function in `lisp.el'.

It is bound to <C-M-up>, C-M-u, ESC <C-up>.

(backward-up-list &optional ARG ESCAPE-STRINGS NO-SYNTAX-CROSSING)

Move backward out of one level of parentheses.
This command will also work on other parentheses-like expressions
defined by the current language mode
1 个赞

一直都是用 smartparens 没留意过竟然没有对应的 forward-up-list :smile:

6. for (var key in source) { <-------.
                                     | sp-backward-up-sexp
7.     obj[key] = source[key]; >-----|
                                     | sp-up-sexp
8. } <-------------------------------'
1 个赞

3Q

写写那位大神

好像是的,好尴尬啊!

补充一下,对应的往后跳跃是up-list。我搜forward up forward list愣是找不到,幸好有find-function。。

666 社区的力量是强大的👌

往前跳 down-list 会跳过( 哪个函数是和backward-up-list对应的呢?

我很好奇 @twlz0ne 的字符画是怎么画出来的?

不知道是不是 artist-mode

应该是的吧,我用了一下,很好玩:smile:

徒手画的,没用模式

1 个赞

当前光标位置 在1 前面。

C-M-b可以实现在括号上往后跳(往上跳) -1 -2 前的括号上

请问:有哪个函数可以往前跳(往下跳)到 1 2 3 前的括号上么???

不知道表述清楚了么。

C-M-f

通常这种操作都是对称的,有 (-b)backward 就有 (-f)forward, 有 up 就有 down

C-M-f forward-sexp 倒是可以往下跳 但是会跳到 小括号)的后面, 我想跳到 下一个( 上有没有什么方法?

还有一个问题就是 C-M-d down-list 往下级跳的时候会跳过( 到达括号后面一个字符 ,有没有哪个方法是跳到下一级的( 上的,而不是跳过(

ps:我是不是得另开一个主题了。

不可以的,好像