Skip to content

Commit

Permalink
add keybinding file for keyboard shortcuts in VS code
Browse files Browse the repository at this point in the history
  • Loading branch information
awojasinski committed Feb 14, 2024
1 parent 0bc70a0 commit 66cec7f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
17 changes: 17 additions & 0 deletions roles/code/files/keybindings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"key": "ctrl+w",
"command": "workbench.action.terminal.kill",
"when": "terminalFocus"
},
{
"key": "ctrl+shift+s",
"command": "workbench.action.terminal.split",
"when": "terminalFocus && terminalProcessSupported || terminalFocus && terminalWebExtensionContributedProfile"
},
{
"key": "ctrl+shift+5",
"command": "-workbench.action.terminal.split",
"when": "terminalFocus && terminalProcessSupported || terminalFocus && terminalWebExtensionContributedProfile"
}
]
9 changes: 6 additions & 3 deletions roles/code/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
state: present
when: ansible_facts['os_family'] == 'Darwin'

- name: Copy VS Code settings file
- name: Copy VS Code config files
ansible.builtin.copy:
src: settings.json
dest: "{{ code_settings_path }}"
src: "{{ item }}"
dest: "{{ code_config_path }}"
mode: "0644"
with_items:
- settings.json
- keybindings.json

- name: List VS Code extensions
ansible.builtin.command:
Expand Down
8 changes: 4 additions & 4 deletions roles/code/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
code_settings_path_os:
code_config_path_os:
- os: "Darwin"
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/Library/Application\ Support/Code/User"
- os: "Debian"
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/Code/User/"

code_settings_path:
"{{ (code_settings_path_os |
code_config_path:
"{{ (code_config_path_os |
selectattr('os', 'equalto', ansible_facts['os_family']) |
first).path }}/settings.json"
first).path }}"

code_extensions:
- {name: Ansible language support, id: redhat.ansible}
Expand Down

0 comments on commit 66cec7f

Please sign in to comment.