emacs中的Python代码折叠? [英] Python code-folding in emacs?

查看:123
本文介绍了emacs中的Python代码折叠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多类和定义...

I have many classes and defs ...

我想拥有 + 和<$ c $ class def 之前的c>-键折叠或打开类(切换

I want to have + and - keys before class and def to collapse the class or open it ( toggle it ).

我该怎么做?

推荐答案

Hideshow可以直接使用并折叠python代码。它是我的emacs版本(24.3.1)的内置版本。

Hideshow works out of the box and folds python code. It is built-in my version of emacs (24.3.1)

我从来不需要以下命令:

I have never needed more than these commands:

M-x hs-minor-mode
M-x hs-hide-all
M-x hs-show-all

要使用Cc @ Cc进行切换,可能需要重新绑定。您可能还想在.emacs文件中设置一个钩子,以便在打开.py文件时自动启用hs-minor-mode。

To toggle use C-c @ C-c which probably needs rebinding. You might also want to setup a hook in your .emacs file for hs-minor-mode to automatically be enabled when opening .py files.

我将其组合使用

M-x imenu <my_func_name>

这篇关于emacs中的Python代码折叠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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