Keil C51 插件 快速复制一行

此插件解决的问题

目前 Keil 软件 只可以 先选中一行,再Ctrl C + Ctrl V , 太麻烦了

Keil 插件 -- Python 代码

python 复制代码
import sys


# 插入当前行内容
def insert_line(current_file_path, line_number):
    line_to_insert = ''

    # 读取文件内容
    with open(current_file_path, 'r', encoding='gb2312') as file:
        content = file.read()

    # 分割内容为行
    lines = content.splitlines()

    # 获取当前行 内容
    if line_number <= len(lines):
        line_to_insert = lines[line_number - 1]
    else:
        raise IndexError("Line number exceeds the total number of lines in the file.")

    # 插入新行
    lines.insert(line_number - 1, line_to_insert)

    # 将修改后的内容写回文件
    with open(current_file_path, 'w', encoding='gb2312') as file:
        file.write('\n'.join(lines) + '\n')


if __name__ == "__main__":
    try:
        filename = sys.argv[1:]

        file_path = ' '.join(filename[:-2]) + filename[-2].split('\\')[-1]

        row_num = int(filename[-1]) + 1

        insert_line(file_path, row_num)

        print('复制当前一行')

    except Exception as e:
        print(str(e))

需要修改的地方

上面代码,所需要的包,自行导入

Python 生成 exe

pip install pyinstaller -- 自行安装包

python 复制代码
pyinstaller -Fw .\Select_All_if.py 

Keil C51 插件安装

参数 自行复制

复制代码
$E !E ~E

效果

快捷键添加

不会改的,自行留言

相关推荐
Blossom.1182 小时前
移动端部署噩梦终结者:动态稀疏视觉Transformer的量化实战
java·人工智能·python·深度学习·算法·机器学习·transformer
AiXed3 小时前
PC微信协议之AES-192-GCM算法
前端·数据库·python
灵光通码3 小时前
神经网络基本概念
python·神经网络
点灯小铭4 小时前
基于单片机的窗帘、灯光、空调智能家居控制系统设计
单片机·嵌入式硬件·毕业设计·智能家居·课程设计·期末大作业
Petrichor_H_5 小时前
DAY 31 文件的规范拆分和写法
python
咚咚王者6 小时前
人工智能之编程进阶 Python高级:第九章 爬虫类模块
开发语言·python
朱一头zcy6 小时前
Win11右键菜单如何把“显示更多选项“中的内容改为默认展示出来
windows
深蓝海拓7 小时前
使matplot显示支持中文和负号
开发语言·python
AntBlack7 小时前
AI Agent : CrewAI 简单使用 + 尝试一下股票分析
后端·python·ai编程
一眼万里*e7 小时前
搭建本地deepseek大模型
python