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

效果

快捷键添加

不会改的,自行留言

相关推荐
q***01651 小时前
Windows操作系统部署Tomcat详细讲解
java·windows·tomcat
lingzhilab3 小时前
零知IDE——基于STM32F103RBT6与RFID-RC522的校园餐卡系统实现
stm32·单片机·嵌入式硬件
promising-w3 小时前
【stm32入门教程】GPIO输入之按键控制LED&光敏传感器控制蜂鸣器
stm32·单片机·嵌入式硬件
必胜的思想钢印4 小时前
修改主频&睡眠模式&停机模式&待机模式
笔记·stm32·单片机·嵌入式硬件·学习
电子_咸鱼5 小时前
【STL string 全解析:接口详解、测试实战与模拟实现】
开发语言·c++·vscode·python·算法·leetcode
哈茶真的c6 小时前
【书籍心得】左耳听风:传奇程序员练级攻略
java·c语言·python·go
Neur0toxin6 小时前
入侵排查_2025/11/23
linux·windows·应急响应
io_T_T7 小时前
Paddle-CLS图像分类_环境安装
python·日常软硬件经验分享
文亭湖畔程序猿7 小时前
开天斧 STC8H8K64U低功耗demo
单片机·嵌入式硬件
百***48077 小时前
Python使用PyMySQL操作MySQL完整指南
数据库·python·mysql