http://www.dekiru.cn/?p=1491

Geany 不好用,建议用一些好用的编辑器或ide

Subliem Text 或 VS code

Pycharm等。

设置运行环境

菜单栏–生成–设置生成命令–执行命令(execute)那里输入python3 %f

以后直接按F5键即可运行python文件.

设置代码检查

配置pep8

菜单栏–生成–设置生成命令–Lint–输入pep8 –max-line-length=80 "%f"

sudo pip3 install pep8

或者使用最新的pycodestyle进行代码检测.

sudo pip3 install pycodestyle

使用pep8

菜单栏–生成–Lint

使用空格代替制表符

菜单栏–编辑–首选项–编辑器–缩进–宽度:4,类型:空格,勾上"用Tab键缩进"

菜单栏–编辑–首选项–文件–保存文件–用空格替换制表符

代码格式化

使用black或着autopep8.

配置black或autopep8

sudo pip3 install black

sudo pip3 install autopep8

菜单栏–生成–设置生成命令–python命令部分–新增命令项:格式化python文件,black %f

菜单栏–生成–设置生成命令–python命令部分–新增命令项:格式化python文件,autopep8 -i %f

black使用方法

菜单栏–生成–格式化python文件,或者直接按F9格式化.

然后ctrl+r重新载入格式化的文件即可.

自动完成

配置snippets

菜单栏–工具–配置文件–snippets.conf,或者直接修改 ~/.config/geany/snippets.conf

官网来源https://wiki.geany.org/snippets/python/start

[Special]部分新增

wordchars=._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

[Python]部分新增

for=for i in xrange(%cursor%):\n\t
doc=""" %cursor% """\n
elif=elif %cursor%:\n\t
else=else:\n\t%cursor%
if=if %cursor%:\n\t
from=from %cursor% import \n
main=if __name__ == '__main__':\n\t%cursor%
class=class %cursor%(object):\n\t""" Class doc """\n\t\n\tdef __init__ (self):\n\t\t""" Class initialiser """\n\t\tpass
def=def %cursor%(self):\n\t""" Function doc\n\n\t@param PARAM: DESCRIPTION\n\t@return RETURN: DESCRIPTION\n\t"""\n\t
get=def get%cursor%(self): return self._var\n
set=def set%cursor%(self): self._var = var\n
.=self.%cursor%
prop=property %cursor%:\n\tdef __get__(self):\n\t\treturn self.%cursor%_get()\n\n\tdef __set__(self, value):\n\t\tself.%cursor%_set(value)
try=try:\n\t%cursor%\nexcept Exception, e:\n\t
py=#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\n%cursor%
while=while %cursor%:\n\t
with=with %cursor%:\n\t
head="""\n\t%cursor%PROJECT – MODULE\n\n\tDESCRIPTION\n\n\t@copyright: {year} by {developer} <{mail}>\n\t@license: GNU GPL, see COPYING for details.\n"""\n
pp=from pprint import pprint\npprint(%cursor%)
cod=# coding: utf-8
dt=from datetime import datetime

使用方法,输入main,按tab,geany自动将main补全为if __name__ == '__main__':

代码提示

配置tag

官网下载tag文件https://wiki.geany.org/tags/start

解压后,把tag后缀的文件方法到~/.config/geany/tag目录即可

安装插件

配置插件:菜单栏–工具–插件管理器–勾选插件–点击窗口低下的配置按钮

官网地址:https://plugins.geany.org/

文件浏览器:sudo apt-get install geany-plugin-treebrowser

成对标签高亮:geany-plugin-pairtaghighlighter

自动高亮相同的字符:geany-plugin-automark

代码缩略图:geany-plugin-overview

虚拟终端支持:geany-plugin-multiterm

markdown支持:geany-plugin-markdown

python支持:geany-plugin-py(Provides most of the standard Geany C API for Python,该插件可以让geany支持python写的插件,比如geany pynav,也可以自己用python为geany写插件.)

xml美化:geany-plugin-prettyprinter

在实现和接口间跳转:geany-plugin-codenav

其他的小附加组件:geany-plugin-addons

在终端执行程序

菜单栏–编辑–首选项–虚拟终端–勾选“在虚拟终端中执行程序”

geany的插件文档

https://www.geany.org/manual/reference/index.html

配置pip国内的一些镜像

  阿里云 https://mirrors.aliyun.com/pypi/simple/
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  豆瓣(douban) http://pypi.douban.com/simple/
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
 ~/.pip/pip.conf

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

最新文章

  1. DDD实践切入点(二)
  2. scikit-learn 朴素贝叶斯类库使用小结
  3. Qt 5.2 Creator 和 vs2012 QT 插件的安装
  4. Shell脚本关于屏幕输出的字符进行颜色控制的问题
  5. h4和h5的区别
  6. PAT乙级真题1003. 我要通过!(20)(解题)
  7. C#对HTML转译需要注意的问题
  8. MVC常用 ActionResult
  9. 利用putty软件连接虚拟机中linux操作系统
  10. mybatis之特殊查询
  11. UNIX网络编程——利用ARP和ICMP协议解释ping命令
  12. python 生成18年写过的博客词云
  13. 工具方法 .js
  14. Hibernate HQL一对多 在一方的查询
  15. luogu 1972 小H的项链 莫队
  16. spring boot 测试类
  17. 8.在XamarinAndroid上进一步控制包的大小
  18. Scrum Meeting 11.04
  19. MongoDB Shell 了解使用
  20. Python 执行命令行操作。

热门文章

  1. 量体裁衣方得最优解:聊聊页面静态化架构和二级CDN建设
  2. vue-cli2 生成的项目打包优化(持续学习中)
  3. Cloudreve 自建云盘实践,我说了没人能限得了我的容量和速度!
  4. Dapper, Ef core, Freesql 插入大量数据性能比较(二)
  5. 华为云PB级数据库GaussDB(for Redis)揭秘第七期:高斯Redis与强一致
  6. Bounding Volume Hierarchies 加速结构
  7. antd+react项目迁移vite的解决方案
  8. 2020.1 PyCharm 激活
  9. Jenkins 分布式和并发构建
  10. 1058 A+B in Hogwarts