在LibreOffice中使用Microsoft Office快捷键
Use Microsoft Office Shortcuts in Libre Office

原始链接: https://github.com/Zaki101Aslam/MS-office-shortcuts-for-Libre-Office

这个仓库提供了配置文件,用于将常用的 Microsoft Office 键盘快捷键映射到 LibreOffice (Writer, Calc, & Impress)。旨在帮助用户从 MS Office 切换到 LibreOffice。 为每个应用程序预生成了 `.cfg` 文件,可以直接通过 LibreOffice 的自定义设置(工具 > 自定义 > 键盘 > 加载)导入。 一个 Python 脚本 (`generate_config.py`) 允许用户*自定义*这些映射,交互式地添加或编辑快捷键。一个验证脚本 (`verify_config.py`) 确保生成的 `.cfg` 文件是有效的 XML,具有正确的 UNO 命令且没有重复项。 为了进行全面的测试,一个 GUI 验证脚本 (`verify_shortcuts_gui.py`) 在 LibreOffice 中自动执行击键操作,并验证生成的文件内容 – 需要图形环境以及 `pyautogui` & `odfpy` 库。 快捷键映射本身存储在 JSON 文件中,鼓励社区通过 pull request 贡献。

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 在 Libre Office 中使用 Microsoft Office 快捷键 (github.com/zaki101aslam) 16 分,作者 Zaki101Aslam 2 小时前 | 隐藏 | 过去 | 收藏 | 2 条评论 求助 Zaki101Aslam 2 小时前 | 下一个 [–] 我目前正在从 Windows 迁移到 Linux,并熟悉 LibreOffice。为了使切换更顺利,我创建了一个工具,将(几乎)所有的 MS Office 快捷键映射到 LibreOffice 的对应快捷键。 我使用了 Jules agent 来帮助构建和完善这个仓库。我想其他人进行相同的迁移可能会觉得它有用。 希望得到社区关于改进映射的反馈! replys2l 12 分钟前 | 上一个 [–] 试试 OnlyOffice。 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

This repository provides LibreOffice configuration files that map common Microsoft Office keyboard shortcuts to their LibreOffice equivalents. It covers Writer (Word), Calc (Excel), and Impress (PowerPoint).

  • Word -> Writer: Maps shortcuts like Clear Formatting (Ctrl+Space), Go To (Ctrl+G), Font Size (Ctrl+Shift+<, >), etc.
  • Excel -> Calc: Maps shortcuts like Insert/Delete Rows (Ctrl++, Ctrl+-), Insert Date/Time (Ctrl+;, Ctrl+Shift+:), etc.
  • PowerPoint -> Impress: Maps shortcuts like New Slide (Ctrl+M), Duplicate Slide (Ctrl+D), Presentation Mode (F5, Shift+F5).
  • Customization Tool: Includes a Python script to easily modify shortcuts and generate your own configuration files.

Using Pre-generated Configurations

  1. Download the .cfg file for the application you want to configure from the dist/ folder:

    • Word_Shortcuts_for_Writer.cfg
    • Excel_Shortcuts_for_Calc.cfg
    • PowerPoint_Shortcuts_for_Impress.cfg
  2. Open LibreOffice (Writer, Calc, or Impress).

  3. Go to Tools > Customize...

  4. Select the Keyboard tab.

  5. Click the Load... button on the right side.

  6. Select the downloaded .cfg file.

  7. Click Open.

  8. Verify the shortcuts are loaded and click OK.

If you want to change any of the mappings or add new ones, you can use the included Python script.

  1. Clone this repository.

    git clone https://github.com/Zaki101Aslam/MS-office-shortcuts-for-Libre-Office
    cd MS-office-shortcuts-for-Libre-Office
  2. Run the customization script in interactive mode:

    python3 src/generate_config.py --interactive
  3. Follow the on-screen prompts:

    • Select the application (Writer, Calc, or Impress).
    • Edit (E): Change an existing shortcut.
    • Add (A): Add a new shortcut mapping (requires knowing the UNO command).
    • Save (S): Save your changes and generate a new .cfg file.
  4. Import the generated .cfg file into LibreOffice as described in the Installation section.

To verify that the generated configuration files are valid (correct XML structure, valid UNO command format, and no duplicate keys), you can run the included verification script:

python3 src/verify_config.py

This static analysis tool checks:

  • Integrity of the Zip archive.
  • Presence of required XML files.
  • Correct XML namespaces.
  • Duplicate key assignments within a single file.
  • Valid command format (must start with .uno:).

End-to-End GUI Verification

To verify that the shortcuts actually work in a real LibreOffice instance, you can run the GUI verification script. This script simulates keystrokes (typing, deleting, selecting, saving) and verifies the resulting document content.

Prerequisites:

  • A graphical desktop environment (Windows, Linux with X11/Wayland, or macOS).
  • LibreOffice installed and reachable via libreoffice or soffice command.
  • Python libraries:
    pip install pyautogui odfpy

Running the Test:

python3 src/verify_shortcuts_gui.py

Note: Do not touch your mouse or keyboard while the test is running. The test will perform typing, backspace, delete, and selection operations and strictly verify the output document content.

Feel free to open issues or pull requests to suggest more mappings! The mappings are stored in JSON files in the mappings/ directory.

联系我们 contact @ memedata.com