diff --git a/roles/code/files/keybindings.json b/roles/code/files/keybindings.json new file mode 100644 index 0000000..bb524e7 --- /dev/null +++ b/roles/code/files/keybindings.json @@ -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" + } +] \ No newline at end of file diff --git a/roles/code/tasks/main.yml b/roles/code/tasks/main.yml index f615244..e087c91 100644 --- a/roles/code/tasks/main.yml +++ b/roles/code/tasks/main.yml @@ -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: diff --git a/roles/code/vars/main.yml b/roles/code/vars/main.yml index 17641e9..3e0a2b5 100644 --- a/roles/code/vars/main.yml +++ b/roles/code/vars/main.yml @@ -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}