Skip to content

Instantly share code, notes, and snippets.

@ngr-t
Created February 24, 2017 08:43
Show Gist options
  • Save ngr-t/6a7db05d1b542c0582cb0f03ecddbc2b to your computer and use it in GitHub Desktop.
Save ngr-t/6a7db05d1b542c0582cb0f03ecddbc2b to your computer and use it in GitHub Desktop.
My keymap config file for Atom editor.
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
#
# 'atom-text-editor':
# 'enter': 'editor:newline'
#
# 'atom-workspace':
# 'ctrl-shift-p': 'core:move-up'
# 'ctrl-p': 'core:move-down'
#
# You can find more information about keymaps in these guides:
# * https://atom.io/docs/latest/using-atom-basic-customization#customizing-key-bindings
# * https://atom.io/docs/latest/behind-atom-keymaps-in-depth
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it here:
# https://github.com/bevry/cson#what-is-cson
'body':
# Prevent tabs from closing on the key binding for pane moving in vim-mode-plus:normal-mode.
'ctrl-w': 'unset!'
# Globally set key bindings for Focus Pane or Panel.
# The default command for them? Line Selection or Joinning Line? Unnecessary for Vimmer!
'ctrl-j': 'focus-pane-or-panel:focus-below'
'ctrl-k': 'focus-pane-or-panel:focus-above'
'ctrl-h': 'focus-pane-or-panel:focus-on-left'
'ctrl-l': 'focus-pane-or-panel:focus-on-right'
# 'ctrl-tab': 'unset!'
# 'ctrl-shift-tab': 'unset!'
'body atom-text-editor.autocomplete-active':
# Change keys to move in autocompletes.
'shift-tab': 'autocomplete-plus:move-up'
'tab': 'autocomplete-plus:move-down'
'shift-[': 'autocomplete-plus:page-up'
'shift-]': 'autocomplete-plus:page-down'
'ctrl-g ctrl-g': 'autocomplete-plus:move-to-top'
'ctrl-shift-g ctrl-shift-g': 'autocomplete-plus:move-to-bottom'
'atom-workspace atom-text-editor':
# Unset editor keybindings (conflicting with multi-cursor-plus)
'alt-left': 'unset!'
'alt-right': 'unset!'
'alt-shift-left': 'unset!'
'alt-shift-right': 'unset!'
# Unset editor keybindings (conflicting with focus-pane-or-panel)
'ctrl-j': 'unset!'
'ctrl-k': 'unset!'
'ctrl-h': 'unset!'
'ctrl-l': 'unset!'
# Default key binding overlaps on Hydrogen's run code command.
'ctrl-shift-enter': 'termination:insert-selected-text'
# Set the key binding the same as anything-find of ST3.
'ctrl-:': 'lazy-motion:forward'
'.platform-win32':
'ctrl-alt-b': 'editor:focus-main'
'atom-workspace atom-text-editor:not([mini])':
# Unset editor keybindings (conflicting with multi-cursor-plus)
'alt-shift-up': 'unset!'
'alt-shift-down': 'unset!'
'ctrl-alt-t': 'transpose-selection:transpose'
# Jumping within editor is used more often.
# Set them easier to type.
'alt--': 'cursor-history:prev-within-editor'
'alt-=': 'cursor-history:next-within-editor'
'alt alt--': 'cursor-history:prev'
'alt alt-=': 'cursor-history:next'
'atom-workspace':
# Key bindings for multi-cursor-plus
'alt-x': 'multi-cursor-plus:mark'
'alt-up': 'multi-cursor-plus:move-up'
'alt-down': 'multi-cursor-plus:move-down'
'alt-left': 'multi-cursor-plus:move-left'
'alt-right': 'multi-cursor-plus:move-right'
'ctrl-alt-left': 'multi-cursor-plus:move-to-beginning-of-word'
'ctrl-alt-right': 'multi-cursor-plus:move-to-end-of-word'
'alt-home': 'multi-cursor-plus:move-to-first-character-of-line'
'alt-end': 'multi-cursor-plus:move-to-end-of-line'
'ctrl-alt-home': 'multi-cursor-plus:move-to-top'
'ctrl-alt-end': 'multi-cursor-plus:move-to-bottom'
'alt-shift-up': 'multi-cursor-plus:select-up'
'alt-shift-down': 'multi-cursor-plus:select-down'
'alt-shift-left': 'multi-cursor-plus:select-left'
'alt-shift-right': 'multi-cursor-plus:select-right'
'ctrl-alt-shift-left': 'multi-cursor-plus:select-to-beginning-of-word'
'ctrl-alt-shift-right': 'multi-cursor-plus:select-to-end-of-word'
'alt-shift-home': 'multi-cursor-plus:select-to-first-character-of-line'
'alt-shift-end': 'multi-cursor-plus:select-to-end-of-line'
'ctrl-alt-shift-home': 'multi-cursor-plus:select-to-top'
'ctrl-alt-shift-end': 'multi-cursor-plus:select-to-bottom'
'atom-text-editor.vim-mode-plus.normal-mode':
# key bindings for multi-cursors in vim-mode-plus
# Not so convenient!
'alt-x': 'multi-cursor-plus:mark'
'alt-k': 'multi-cursor-plus:move-up'
'alt-j': 'multi-cursor-plus:move-down'
'alt-h': 'multi-cursor-plus:move-left'
'alt-l': 'multi-cursor-plus:move-right'
'alt-b': 'multi-cursor-plus:move-to-beginning-of-word'
'alt-e': 'multi-cursor-plus:move-to-end-of-word'
'alt-0': 'multi-cursor-plus:move-to-first-character-of-line'
'alt-4': 'multi-cursor-plus:move-to-end-of-line'
'alt-g alt-g': 'multi-cursor-plus:move-to-top'
'alt-shift-g alt-shift-g': 'multi-cursor-plus:move-to-bottom'
'alt-shift-k': 'multi-cursor-plus:select-up'
'alt-shift-j': 'multi-cursor-plus:select-down'
'alt-shift-h': 'multi-cursor-plus:select-left'
'alt-shift-l': 'multi-cursor-plus:select-right'
'alt-shift-b': 'multi-cursor-plus:select-to-beginning-of-word'
'alt-shift-e': 'multi-cursor-plus:select-to-end-of-word'
'alt-shift-0': 'multi-cursor-plus:select-to-first-character-of-line'
'alt-shift-4': 'multi-cursor-plus:select-to-end-of-line'
'ctrl-alt-g ctrl-alt-g': 'multi-cursor-plus:select-to-top'
'ctrl-alt-shift-g ctrl-alt-shift-g': 'multi-cursor-plus:select-to-bottom'
"atom-text-editor[data-grammar='source r']":
# Smart assign key.
";": "custom:insert-assign"
"; ;": "custom:insert-;"
# The key bindings for the pipe-freaks (different from RStudio's key binding).
"ctrl-> ctrl->": "custom:insert-pipe"
"ctrl-< ctrl->": "custom:insert-pipe-assign"
# Auto-insertion of matching single quotation mark is irritating on editing roxygen-style comment. Avoid it.
"# '": "custom:insert-knitr-style-comment"
"atom-text-editor:not(.autocomplete-active)[data-grammar='source r']":
# Continuing new line with comment. The commands below abort key binds if the cursor is not within a comment line.
"enter": "custom:comment-aware-newline"
"shift-enter": "custom:comment-ignorant-newline"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment