Skip to content

Instantly share code, notes, and snippets.

@jamesodoherty-huntress
Last active November 5, 2022 00:42
Show Gist options
  • Select an option

  • Save jamesodoherty-huntress/f06ef767bae48d8088c326a69d4dbda9 to your computer and use it in GitHub Desktop.

Select an option

Save jamesodoherty-huntress/f06ef767bae48d8088c326a69d4dbda9 to your computer and use it in GitHub Desktop.
Emacs config and karabiner elements config
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(current-language-environment "UTF-8")
'(indent-tabs-mode nil)
'(inhibit-startup-screen t)
'(mac-command-modifier 'super)
'(mac-mouse-wheel-mode nil)
'(mac-option-modifier 'meta)
'(make-backup-files nil)
'(package-selected-packages '(swift-mode company lsp-ui lsp-mode go-mode))
'(show-trailing-whitespace t)
'(tool-bar-mode nil)
'(tooltip-mode nil)
'(visible-bell t)
'(xterm-mouse-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(setq lsp-keymap-prefix "C-c l")
(remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
(setq-default fill-column 80)
(add-hook 'go-mode-hook
(lambda ()
(lsp-deferred)
(setq tab-width 4)
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t)))
(add-hook 'ruby-mode-hook
(lambda ()
(lsp-deferred)))
(add-hook 'js-mode-hook
(lambda ()
(setq indent-tabs-mode nil)
(setq js-indent-level 2)
(lsp-deferred)))
(if (eq system-type 'darwin)
(let ((path (replace-regexp-in-string
"[ \t\n]*$" ""
(shell-command-to-string "/bin/zsh -i -c 'echo $PATH'")))
(gnu-tool-paths '("/opt/homebrew/opt/coreutils/libexec/gnubin"
"/opt/homebrew/opt/grep/libexec/gnubin"
"/opt/homebrew/opt/findutils/libexec/gnubin")))
(setenv "PATH" (format "%s:%s" (string-join gnu-tool-paths ":") path))
(setq exec-path (append
gnu-tool-paths
exec-path
(split-string path ":")))))
{
"title": "Apple keyboard modifier customizations for built-in keyboards",
"rules": [
{
"description": "Built-in keyboard customizations for Terminal and Emacs",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_command",
"modifiers": {"optional": ["any"]}
},
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$",
"^com\\.apple\\.Terminal$",
"^org\\.gnu\\.Emacs$"
]
},
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"key_code": "left_option"
}
]
},
{
"type": "basic",
"from": {
"modifiers": {
"mandatory": [
"left_command"
]
}
},
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$",
"^com\\.apple\\.Terminal$",
"^org\\.gnu\\.Emacs$"
]
},
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"modifiers": [
"left_option"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "left_option",
"modifiers": {"optional": ["any"]}
},
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$",
"^com\\.apple\\.Terminal$",
"^org\\.gnu\\.Emacs$"
]
},
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"key_code": "left_command"
}
]
},
{
"type": "basic",
"from": {
"modifiers": {
"mandatory": [
"left_option"
]
}
},
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$",
"^com\\.apple\\.Terminal$",
"^org\\.gnu\\.Emacs$"
]
},
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "right_command",
"modifiers": {"optional": ["any"]}
},
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$",
"^com\\.apple\\.Terminal$",
"^org\\.gnu\\.Emacs$"
]
},
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"key_code": "right_option"
}
]
},
{
"type": "basic",
"from": {
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$",
"^com\\.apple\\.Terminal$",
"^org\\.gnu\\.Emacs$"
]
},
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"modifiers": [
"right_option"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "right_option",
"modifiers": {"optional": ["any"]}
},
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$",
"^com\\.apple\\.Terminal$",
"^org\\.gnu\\.Emacs$"
]
},
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"key_code": "right_control"
}
]
},
{
"type": "basic",
"from": {
"modifiers": {
"mandatory": [
"right_option"
]
}
},
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$",
"^com\\.apple\\.Terminal$",
"^org\\.gnu\\.Emacs$"
]
},
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"modifiers": [
"right_control"
]
}
]
}
]
},
{
"description": "Global built-in keyboard customizations",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "escape",
"modifiers": {"optional": ["any"]}
},
"conditions": [
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"key_code": "caps_lock"
}
]
},
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {"optional": ["any"]}
},
"conditions": [
{
"type": "device_if",
"identifiers": [
{
"is_built_in_keyboard": true
}
]
}
],
"to": [
{
"key_code": "escape"
}
]
}
]
}
]
}
@jamesodoherty-huntress
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment