{"id":21560466,"url":"https://github.com/lu0/xkb-xmodmap-vim-config","last_synced_at":"2026-04-17T15:33:51.010Z","repository":{"id":132823891,"uuid":"435172212","full_name":"lu0/xkb-xmodmap-vim-config","owner":"lu0","description":"Keyboard layout for Linux to relocate navigation and number keys closer to the Home Row, replicating vim-like keys on any non-vim text fields/editors, enhancing typing experience.","archived":false,"fork":false,"pushed_at":"2023-01-15T06:10:58.000Z","size":323,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T04:32:38.825Z","etag":null,"topics":["dotfiles","dotfiles-linux","hacktoberfest","vim","vim-like","xkb","xkb-keyboard-layout","xmodmap"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lu0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-05T13:18:50.000Z","updated_at":"2025-01-26T19:44:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"2bc8a154-7ce3-40af-afdb-b2fccc643c29","html_url":"https://github.com/lu0/xkb-xmodmap-vim-config","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lu0/xkb-xmodmap-vim-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lu0%2Fxkb-xmodmap-vim-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lu0%2Fxkb-xmodmap-vim-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lu0%2Fxkb-xmodmap-vim-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lu0%2Fxkb-xmodmap-vim-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lu0","download_url":"https://codeload.github.com/lu0/xkb-xmodmap-vim-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lu0%2Fxkb-xmodmap-vim-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31934354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T12:37:54.787Z","status":"ssl_error","status_checked_at":"2026-04-17T12:37:25.095Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotfiles","dotfiles-linux","hacktoberfest","vim","vim-like","xkb","xkb-keyboard-layout","xmodmap"],"created_at":"2024-11-24T09:15:04.291Z","updated_at":"2026-04-17T15:33:51.004Z","avatar_url":"https://github.com/lu0.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vim-like XKB/xmodmap configuration\n\n`xmodmap` configuration files (`*.lst`) are easier to read and maintain than\n`xkb` files, this is the reason most customized keyboard layout configurations\nare shared as `lst` files.\nBut loading layouts from `xmodmap` config files is really slow, and `xkb` can do\nthe same job almost immediately.\n\nThis repository stores the `xmodmap` and `xkb` configuration files I made to\nremap some of the keys on my keyboard to keys near the home row, along with\ndetailed instructions on how to convert from an `xmodmap` `*.lst` configuration\nfile to a system-wide `xkb` layout.\n\n- [Vim-like XKB/xmodmap configuration](#vim-like-xkbxmodmap-configuration)\n  - [Which keys do I remap?](#which-keys-do-i-remap)\n  - [Convert `xmodmap` to `xkb` files](#convert-xmodmap-to-xkb-files)\n  - [Create a new custom layout](#create-a-new-custom-layout)\n    - [Set the layout as a variant for the base one](#set-the-layout-as-a-variant-for-the-base-one)\n    - [Make the layout the default one](#make-the-layout-the-default-one)\n\n## Which keys do I remap?\nThe following pictures give a good insight of the custom layout I use, the first\none shows the default layout and the second one shows the one I use. I basically\nadded vim-like keys (arrows, \u003ckbd\u003eHome\u003c/kbd\u003e\u003ckbd\u003eEnd\u003c/kbd\u003e and\n\u003ckbd\u003eEsc\u003c/kbd\u003e:\u003ckbd\u003eCaps Lock\u003c/kbd\u003e swap), media keys (play/pause, previous/next\ntrack) and a numeric pad.\n\nOverridden keys are shown in blue, while hidden keys are shown in red; the hidden\nkeys are accessible by using \u003ckbd\u003eAltGr\u003c/kbd\u003e as the modifier key.\n\n![default latam layout](./assets/latam_layout-default.png)\n![default latam layout](./assets/latam_layout-custom.png)\n\n\n- **Note**: If you're already using a Latin American keyboard, you may want to\ngo ahead and test my custom layout by running the following script, will prompt you\nfor your password to save the generated xkb layout into the system (it may take\na minute or so):\n\n    ```language\n    ./xmodmap-to-xkb-layout.sh\n    ```\n\n    Keep reading to do this manually or with other base layouts.\n\n## Convert `xmodmap` to `xkb` files\n\nReplace each occurrence of `latam` from all steps with the name of the layout\nyour custom layout is based upon.\n\nYou can see the complete list of layouts with:\n```sh\nsed '/^! layout$/, /^ *$/!d; //d' /usr/share/X11/xkb/rules/base.lst\n```\n\n1. Install xkb utilities\n   ```sh\n   sudo apt install x11-xkb-utils\n   ```\n   \n1. Restore the default configuration.\n    ```sh\n    setxkbmap -option \u0026\u0026 setxkbmap latam\n    ```\n\n1. Backup the default layout.\n    ```sh\n    xmodmap -pke \u003e xmodmap/xmodmap_latam_defaults.lst\n    xkbcomp -xkb $DISPLAY xkb/latam_defaults.xkb\n    ```\n\n1. Apply your custom `xmodmap` file after any extra mappings, for example, I\n    swap \u003ckbd\u003eEsc\u003c/kbd\u003e with \u003ckbd\u003eCaps Lock\u003ckb\u003e. This may take a minute.\n    ```sh\n    setxkbmap -option caps:swapescape\n    xmodmap xmodmap/xmodmap_latam_customs.lst\n    ```\n\n1. Get the keymap you just applied but with `XKB`.\n    ```sh\n    xkbcomp -xkb $DISPLAY xkb/latam_custom.xkb\n    ```\n\n1. Restore the default configuration, again.\n    ```sh\n    setxkbmap -option \u0026\u0026 setxkbmap latam\n    ```\n\n1. Test/apply the custom generated `xkb` file.\n    ```sh\n    xkbcomp -w0 xkb/latam_custom.xkb $DISPLAY\n    ```\n\n1. Then you can use the previous command (with absolute path) on a startup script to apply your custom keymap on login.\n\n## Create a new custom layout\nYou can further convert your custom `xkb` file into an `xkb symbols` file to let `XKB` recognize it as a new layout.\n\n1. Get the symbols portion of the complete `xkb` file.\n    ```sh\n    sed -n '/^xkb_symbols/, /^xkb_/p' xkb/latam_custom.xkb | head -n-1 \u003e xkb/latam_custom_symbols.xkb\n    ```\n\n1. Open `xkb/latam_custom_symbols.xkb` and rearrange the header from:\n    ```txt\n    xkb_symbols \"pc+latam+inet(evdev)\" {\n    ```\n    To:\n    ```txt\n    xkb_symbols \"latam_custom\" {\n        include \"pc+latam+inet(evdev)\"\n    ```\n    \n1. Create a link to the symbols file into the xkb config folder:\n    ```sh\n    sudo ln -srf xkb/latam_custom_symbols.xkb /usr/share/X11/xkb/symbols/latam_custom\n    ```\n    \n1. Restore the default configuration, again.\n    ```sh\n    setxkbmap -option \u0026\u0026 setxkbmap latam\n    ```\n\n1. Then you can run `setxkbmap latam_custom` to apply the new layout.\n\n### Set the layout as a variant for the base one\nYou can go even further and convert your custom `xkb` layout into a variant of\nthe layout it's based on.\n\n- Open `/usr/share/X11/xkb/symbols/latam` and add the following snippet to the\nbottom of the file:\n    ```perl\n    partial alphanumeric_keys\n    xkb_symbols \"vimlikekeys\" {\n        include \"latam_custom\"\n        name[Group1]=\"Spanish (Latin American, Vim-like keys)\";\n    };\n    ```\n\nNow you can just run `setxkbmap latam vimlikekeys` to apply the layout custom,\nof follow the next step to make the layout available in the Keyboard settings\nof your Desktop Environment.\n\n- Open `/usr/share/X11/xkb/rules/evdev.xml` and add the following snippet\ninside between tags `\u003cvarianList\u003e` of the layout you based your custom\nlayout on, in my case, `latam`:\n    ```xml\n    \u003c!-- ... --\u003e\n    \u003clayout\u003e\n     \u003cconfigItem\u003e\n         \u003cname\u003elatam\u003c/name\u003e\n         \u003cshortDescription\u003ees\u003c/shortDescription\u003e\n         \u003cdescription\u003eSpanish (Latin American)\u003c/description\u003e\n         \u003c!-- ... --\u003e\n     \u003c/configItem\u003e\n     \u003cvariantList\u003e\n         \u003c!-- Add this snippet: --\u003e\n         \u003cvariant\u003e\n         \u003cconfigItem\u003e\n             \u003cname\u003evimlikekeys\u003c/name\u003e\n             \u003cdescription\u003eSpanish (Latin American, Vim-like keys)\u003c/description\u003e\n         \u003c/configItem\u003e\n         \u003c/variant\u003e\n         \u003c!-- End of snippet --\u003e\n         \u003c!-- ... --\u003e\n     \u003c/variantList\u003e\n    \u003c!-- ... --\u003e\n    \u003c/layout\u003e\n    ```\n\nThen you will be able to select the layout it in the keyboard settings of the\nDesktop Environment, `Cinnamon` in my case:\n\n![Selection of variant in Cinnamon's keyboard settings](assets/layout-variant-selection.png)\n\n\n### Make the layout the default one\n\nYou can now apply the custom layout by running either `setxkbmap latam_custom`\nor `setxkbmap latam vimlikekeys`, but newly plugged keyboards, TTYs, Display\nManagers (logging screens), etc., will fallback to the default\nlayout. Follow the next steps to make the new custom layout the default\none.\n\n1. Set the layout and variant of the keyboard in the system-wide configuration file.\n\n    ```sh\n    echo -n '\n    XKBLAYOUT=\"latam\"\n    XKBVARIANT=\"vimlikekeys\"\n    ' | sudo tee -a /etc/default/keyboard\n    ```\n\n2. Reboot to apply the changes system-wide.\n\n\n*Note:* This works for debian-based distros.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flu0%2Fxkb-xmodmap-vim-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flu0%2Fxkb-xmodmap-vim-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flu0%2Fxkb-xmodmap-vim-config/lists"}