Tag: mac

My Mac OSX custom Intellij shortcuts

Navigate: class cmd O, additional ctrl shift T
Navigate file: cmd shift O, added ctrl shift R (removed run context configuration)
Navigate declaration and usages, removed: cmd B, added: F3 (removed toggle bookmark)
Navigate type declaration, removed: shift + cmd B, added: shift + F3
Navigate implementations: cmd + I, ctrl + I, ctrl + shift + I
Navigate between matching braces: added ctrl + shift + [/]

Find usages: alt F7, added ctrl + shift + G (removed: unselect occurrences)

Find: cmd +F, added ctrl+ F (removed: right in editor actions)
Navigate File structure: cmd + F12, added ctrl + O (removed: override methods)

Refactor this: ctrl +T , added alt + shift + T (removed: switch task)
Rename: shift + F6, added alt + shift + R (removed: rerun tests)
Extract variable: alt+cmd+V, added alt + shift + L
Extract method: alt+cmd + M, added alt + shift + M
Duplicate line: added: alt + D (removed cmd+D)
Delete line: added: alt + shift + D
Hide all tool windows: shift + cmd + F12, added ctrl + M (removed: move caret to matching brace and commit message history)
Preferences: cmd + , added ctrl + alt + s
Show intention actions: alt + enter, added ctrl + 1 (Remove Go to bookmark 1)
Next highlighted error: F2, added ctrl+ . (removed: Choose lookup item and insert dot), added alt + .
Previous highlighted error: shift + F2, added ctrl+ , added alt + .
Reformat code: alt + cmd + L, added: ctrl + shift + F
Inline: added: alt + shift + I
Inline: alt + cmd + N, added alt + shift + I (removed: inspect code with editor settings)
Source code generate: cmd + N, ctrl + Enter, additionally: alt + shift + S
Extract field: alt + cmd + F, additionally alt + shift + F(removed: add to favorites)
Extract constant: alt + cmd + C, additionally: alt + shift + C (removed: recent changes)
**Extend/shrink selection: original: alt + up arrow/alt + down arrow changed to: alt + shift + arrow Up/Down, added additionally ctrl +W / ctrl + shift + W
Find in path: shift + cmd + F, added additionally: ctrl + alt + shift + F
Replace in path: shift + cmd + R, added additionally: ctrl + alt + shift + R
**Move line up: original: alt + shift + arrow Up/Down changed to: alt + arrow Up/Down
Organize imports: ctrl + alt + O, additionally: ctrl + shift + O, alt+shift+O
Navigate to Test/Junit (junit) added: ctrl + shift + J (removed: join lines), ctrl + shift + alt + T
Join lines: added: alt + shift + J (used also to compress/minify/linearize xml or json to single line)
Navigate type declaration: shift + cmd + B (removed shift + ctrl +B), added: shift + ctrl + D
Navigate declaration: added F3
Navigate Super method: added: ctrl + shift + U or added: ctrl + shift + M
Navigate bookmark show: added: shift + cmd + B, added: shift + ctrl + B, added: alt + shift + B, S
Bookmark add: added: cmd + B, added: ctrl + B, added: alt+ shift +B, A
Navigate bookmark menu: added ctrl + shift + alt + B, added alt+ shift +B, B (removed navigate type declaration)
Complete statement: ctrl + shift + Enter
Navigate to last edit location: ctrl + shift + backspace, added: cmd + L, added: ctrl + L
Navigate line number: ctrl + shift + L

** Rename: alt + shift + R (removed: rerun tests)

** Run/Debug context configuration original: run context configuration alt + shift + R,(removed: run/debug in main menu)

ctrl + R/D – run/debug junit test class opened in the editor
ctrl + alt + R/D – popup run/debug menu with classes/methods to select for running/debugging
ctrl + alt + cmd + R/D – rerun/debug class/method previously selected in the menu
alt + E – evaluate expression (in debug)
alt + shift + E – quick evaluate expression (in debug)

Added cmd+0, alt+0 terminal

Existing:
cmd + shift + T: navigate/create test
ctrl + Enter -> accept highlighted button in popup

VCS
Update: added cmd + U, added ctrl + U or added alt + shift + V, U
Diff: existing cmd + D (compare with local in vcs view)
Compare with same repository version: cmd+shift+D
Compare with local version: alt+shift+V, D
Compare with latest repo version: alt+shift+V, Shift+D

Prev/next difference: added ctrl + alt + ,/.
Push: existing alt + shift + K, or added: alt + P, or added: alt + shift + V, P
Revert: added alt + shift + V, R or added alt + R
History: added alt + H or added: alt + shift + H

Existing: View Parameter Info: cmd + P, added ctrl + P

Run: alt + shift + X, R
Run…: alt + shift + X, Shift + R
Debug: alt + shift + X, D
Debug…: alt + shift + X, Shift + D
Rerun tests: alt + shift + X, T
Rerun failed tests: alt + shift + X, Shift + T or alt + shift + X, F

Quick documentation: ctrl + Q
Navigate back/forward: added ctrl+alt+left/right arrow, added: alt+cmd+left/right arrow
Navigate Last edit location added: ctrl+shift+L
Navigate to line: cmd + L or added ctrl + L
Navigate bookmark: added ctrl + shift + B
Navigate to recently edited files: cmd + shift + E, ctrl + shift + E
Navigate to recent files: cmd + E, ctrl + E

Highlight usages in file: ctrl + F, ctrl + G

Generate source: added alt + shift + G
Find by action: added ctrl + shift + A
Ctrl + N added: new (Java, Scala)

Project Defaults -> Project Structure -> search sdk
Change color of ‘Identifier under caret’ to be brighter

Scala
Preferences-> Languages and Frameworks/Scala -> Show type info on mouse hover
Alt+Enter when cursor on valu/method -> Add type annotation to value definition
run scala console: cmd+shift+S

Advertisements

Mac shortcuts

cmd+W – close window
cmd+Q – quit window
cmd+tab – switch windows

alt + cmd + space – open finder
cmd + shift + m – toggle zoom: maximize/minimize window
cmd + m – minimize application to dock icon (un-minize – select app with cmd+tab, while pressing cmd, start pressing alt and release cmd)
F5 for Reload This Page – System Preferences/Keyboad/Shortcuts/App Shortcuts/+ to add Google Chrome application, title Reload This Page/shortcut F5
F11 – show desktop
F3 – show mission control (all windows) or 3 fingers swipe up
ctrl+ down arrow – show Application Windows for (App Expose) or 3 fingers swipe down
ctrl + up arrow – show Mission control
ctrl + F8 + down arrow + down arrow + enter – lock screen (Utilities/KeyChain Access/Preferences/General: check: Show keychain status in menu bar)

Terminal:
alt + right/left arrow – move one word forward / backward
ctrl + A / E (or fn + shift + left/right arrow) – move to the begin / end of line

TextEdit/Browser (alt and cmd):
alt + right/left arrow – move cursor one word forward/backward
cmd + right/left arrow – move to end/begin of line (also ctrl + right/left when disabled remapped Mission Control)
cmd + up/down arrow  – move cursor to home/end
fn+right/left arrow – go to home/end
fn+up/down arrow – page up/down (curson does not move)
shift + alt +right/left – select one word from cursor to right/left
shift + cmd + right/left – select words from cursor to end/begin of line
cmd + c / v / x – copy / paste / remove
ctrl + tab – move between tabs in chrome
cmd + alt + shift + v – paste formatted text but adjust to the format of target text

Vim (fn and ctrl, does not use cmd so be able use the same keys in Windows/Linux):
fn + right/left – move to the begin/end of line (fn since no home/end button)
ctrl + right/left – move to the one word forward/backward (with disabled/remapped Mission Control)
cmd + shift + v – paste selected text (needs to be selected via mouse)

My Intellij (fn and ctrl, does not use cmd so be able use the same keys in Windows/Linux):
fn + right/left – move to the begin/end of line (fn since no home/end button)
ctrl + right/left – move one word forward/backward (with disabled/remapped Mission Control)
shift + fn + right/left – select words from curson to the begin/end of line
shift + ctrl + right/left – select one word forward/backward (with disabled/remapped Mission Control)
ctrl + c / v / x – copy / paste / remove

Setup

    1. Turn off AutoCorrect: Apple Menu > System Preferences > Keyboard > Text and turn  Autocorrect off by unchecking Correct spelling automatically
    2. Add ssh autocompletion for bash by appending ~/.bash_profile or ~/.bashrc:
_complete_ssh_hosts ()
{
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    comp_ssh_hosts=`
#        cat ~/.ssh/known_hosts | \
#        cut -f 1 -d ' ' | \
#        sed -e s/,.*//g | \
#        grep -v ^# | \
#        uniq | \
#        grep -v "\[" ;
        cat ~/.ssh/config | \
        grep "^Host " | \
        awk '{print $2}'
    `
    COMPREPLY=( $(compgen -W "${comp_ssh_hosts}" -- $cur))
    return 0
}
complete -F _complete_ssh_hosts ssh
    1. Terminal prompt structure and colors:
export PS1="\[\033[01;32m\]\u@MacBook\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -Gh'

brew install svn (append .bash_profile: export PATH=/usr/local/bin:${PATH})
brew install maven
brew install cntlm

Settings -> Keyboard/Text: disable use smart quotes and dashes

Finder -> Preferences/Advanced/Show all filename extensions