Category Archives: Power Tool

All developer’s power tool

Keyboard Shortcuts You Cannot Miss

Copy from IntelliJ help https://www.jetbrains.com/help/idea/2016.3/keyboard-shortcuts-you-cannot-miss.html

IntelliJ IDEA also provides the default keymap reference in the pdf format. To view the keymap reference, choose

IntelliJ IDEA, as a keyboard-centric IDE, suggests keyboard shortcuts for most of its actions. In this topic, you can find a short list of the most indispensable of them, to make your first steps with IntelliJ IDEA easy.

See the detailed list of default keyboard shortcuts in the Keyboard Shortcuts Reference and learn how to customize your preferred keymap in the Configuring Keyboard Shortcuts section.

Action Shortcut
Find action by name Ctrl+Shift+A
Show the list of available intention actions . Alt+Enter
Switch between views (Project,Structure, etc.). Alt+F1
Switch between the tool windows and files opened in the editor. Ctrl+Tab
Show the Navigation bar. Alt+Home
Insert a live template. Ctrl+J
Surround with a live template. Ctrl+Alt+J
Edit an item from the Project or another tree view. F4
Comment or uncomment a line or fragment of codewith the line or block comment. Ctrl+Slash
Ctrl+Shift+Slash
Find class or file by name. Ctrl+N
Ctrl+Shift+N
Duplicate the current line or selection. Ctrl+D
Incremental expression selection. Ctrl+W and Ctrl+Shift+W
Find/replace text string in the current file. Ctrl+F
Ctrl+R
Find/replace text in the project or in the specified directory Ctrl+Shift+F
Ctrl+Shift+R
Search everywhere. Double-press Shift
Quick view the usages of the selected symbol. Ctrl+Shift+F7
Expand or collapse a code fragment in the editor. Ctrl+NumPad Plus
Ctrl+NumPad -
Invoke code completion. Ctrl+Space
Smart statement completion. Ctrl+Shift+Enter
Smart completion Ctrl+Shift+Space
Show the list of available refactorings (Refactor This). Ctrl+Shift+Alt+T
Open PopUp Class or Function Document Window Ctrl+Q

The complete keymap reference is available from the main menu (Help | Keymap Reference).

Git: Remove a file from a Git repository without deleting it from the local filesystem

From: http://stackoverflow.com/questions/1143796/remove-a-file-from-a-git-repository-without-deleting-it-from-the-local-filesyste

git rm --cached mylogfile.log

For a directory:

git rm --cached -r mydirectory

You can also remove files from the repository based on your .gitignore without deleting them from the local file system :

git rm --cached `git ls-files -i -X .gitignore`

A more generic solution:

  1. Edit .gitignore file.ECHO mylogfile.log >> .gitignore
  2. Remove all items from index.git rm -r -f --cached .
  3. Rebuild index.git add .
  4. Make new commitgit commit -m "Removed mylogfile.log"

IntelliJ using replace (Ctrl+R) with regexp

Task:

have several code lines which “gitter” need to be replaced with actual function name called

log.debug("gitter: {}", inboudStats.getJitter());
log.debug("gitter: {}", inboudStats.getFractionLost());
log.debug("gitter: {}", inboudStats.getBytesReceived());

Solution:

Search: (gitter)(:\s\{\}”,\s(in|out)bou[nd]*Stats.get(.*)\(\))

Replace: $3$2

When intelliJ finds searching string, it gives replace string as well as matching string high lighted.

replacewith-regexp

Ref:


 

IntelliJ IDEA

Useful idea of IntelliJ IDEA

https://www.jetbrains.com/idea/documentation/

Shortcuts

Live Templates

Tutorial Video

 

Git Everyday Commands

Git

git branch

git remote update

Git UNIX

Links

 

git status

Git – Stash changes

Stash changes when you have to work on another branch.

Commands

git stash list [<options>]
git stash show [<stash>]
git stash drop [-q|--quiet] [<stash>]
git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
git stash branch <branchname> [<stash>]
git stash [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
	     [-u|--include-untracked] [-a|--all] [<message>]]
git stash clear
git stash create [<message>]
git stash store [-m|--message <message>] [-q|--quiet] <commit>

Reference