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

效果

快捷键添加

不会改的,自行留言

相关推荐
景彡先生1 小时前
Python Selenium详解:从入门到实战,Web自动化的“瑞士军刀”
前端·python·selenium
珺毅同学4 小时前
YOLO输出COCO指标及YOLOv12报错
python·深度学习·yolo
安庆平.Я4 小时前
STM32——IWDG
stm32·单片机·嵌入式硬件
怀民民民5 小时前
轮询&中断 串口实训
单片机·嵌入式硬件·串口·中断·轮询·学习日志·keill
2401_841495645 小时前
Windows 系统中ffmpeg安装问题的彻底解决
windows·python·ffmpeg·bug·语音识别·下载·安装步骤
code_ing-6 小时前
【Linux】命令行参数与环境变量
linux·c++·windows·笔记
kaka❷❷6 小时前
STM32 单片机 ESP8266 联网 和 MQTT协议
stm32·单片机·嵌入式硬件·物联网·mqtt·esp8266
waysolong906 小时前
MCP服务构建、使用
python
胜天半月子6 小时前
Python自动化测试 | 快速认识并了解pytest的基本使用
服务器·python·pytest
小小测试开发6 小时前
Python Web3库入门:从零开始与以太坊区块链交互
python·web3·区块链