Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/soimort/dotfiles

Mort's dotfiles
https://github.com/soimort/dotfiles

Last synced: 2 months ago
JSON representation

Mort's dotfiles

Awesome Lists containing this project

README

        

# Mort's Cheatsheet

**[WARNING] This configuration set is a very personal thing and comes with definitely NO warranty. It may eat your hamster!**

## Package initialization

### (via git submodule, could be outdated)

$ git submodule init && git submodule update

### Vim/Vundle (no submodule, always updated)

(1)

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

(2) Launch vim and run `:PluginInstall`.

### Tmux/TPM (no submodule, always updated)

(1)

$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

(2) Reload tmux environment so TPM is sourced:

$ tmux source ~/.tmux.conf

(3) In tmux, press `prefix + I` to fetch plugins.

### Emacs/ELPA

M-x package-install RET elscreen RET Install [ElScreen](https://melpa.org/#/elscreen)

M-x package-install RET powerline RET Install [Powerline](https://melpa.org/#/powerline)

## Emacs

### Project workflow

#### Initialize a new project

$ md my_project
$ cd my_project/
$ git init
$ git flow init -d
$ echo '.emacs*' > .gitignore
$ e .gitignore

In Emacs, use M-s r to save the current session into `./.emacs.desktop` and `./.emacs.elscreen` before exit.

#### Start hacking on an existing project

$ cd my_project/
$ e

Emacs will try to restore the last session from `./.emacs.desktop` and `./.emacs.elscreen`, and save current session back into them on exiting. Automatically.

Editing certain files by initializing `emacs` with explicit parameters will not cause Emacs to restore and save sessions automatically: (unless M-s r is invoked)

$ e README.md src/hello.c

### Basic commands

(See also: )

C-x C-f Find file

C-x C-v RET Reload file

C-x C-s Save buffer

C-x s Save file (like save-as)

C-x b Switch buffer

C-x Left Switch to previous buffer

C-x Right Switch to next buffer

C-x k Kill buffer

C-x h Select entire buffer

C-x o Move cursor to other window

C-x 0 Close current window (after splitting)

C-x 1 Close any other windows

C-x 2 Split window vertically

C-x 3 Split window horizontally

C-g Cancel

C-d Kill character

M-d Kill word

M-\ Kill word backwards

C-w Cut (kill)

M-w Copy

M-y Paste (yank)

M-h Select current paragraph

C-s Incremental search

C-r Incremental search backward

C-M-s Regex incremental search

C-M-r Regex incremental search backward

M-% Search/replace

M-; Comment/uncomment region

C-/ C-x u Undo

M-/ Complete word (like tab-complete)

C-f Move cursor forward

C-b Move cursor back

M-f Move cursor forward-by-word

M-b Move cursor backward-by-word

C-n Move cursor to next line

C-p Move cursor to prev line

C-l Scroll to middle and redraw screen

C-a Move cursor to beginning of line

C-e Move cursor to end of line

M-m Move cursor to first non-whitespace char

M-{ Move cursor up-by-paragraph

M-} Move cursor down-by-paragraph

M-\< Go to top of buffer

M-\> Go to end of buffer

M-g M-g Go to line number

M-$ Check and correct spelling of the word at point

M-! Run shell command

M-| Run shell command with region contents as input

M-& Run shell command asynchronously

M-x [mode-name] Change mode

M-x cd Change directory

M-x shell Shell

M-x eshell Eshell

M-x term Terminal emulation

C-\\ Enable/disable input method (e.g. C-\\ greek)

C-\ Enable/disable IBus input method

F11 Fullscreen

### Nonstandard commands

M-n Scroll view down (by 1 line)

M-\ Scroll view down

M-p Scroll view up (by 1 line)

M-\ Scroll view up

\ Newline and indent

C-S-\ Delete whole line (without putting it into kill-ring)

C-c c Copy entire buffer to clipboard

C-x C-c Quit (without asking for saving buffer)

### ElScreen commands

M-s c M-s C-c Create a new screen and switch to it

M-s C Create a new screen with the window-configuration of the current screen

M-s d Create a new screen and run dired

M-s f M-s C-f Find file in new screen

M-s C-r Find file in new screen (read-only)

M-s k M-s C-k Kill current screen

M-s M-k Kill current screen and buffers

M-s K Kill other screens

C-\ M-s n M-s C-n Next screen

C-S-\ M-s p M-s C-p Previous screen

M-s a M-s C-a Toggle to the screen selected previously

M-s ' Prompt for a screen number to switch to

M-s " Present a list of all screens for selection

M-s [0-9] Jump to the screen number 0-9

M-s \ M-s C-s Swap current screen with previous one

M-s w M-s C-w Show a list of screens

M-s A Allow the user to enter a name for the current screen

M-s m M-s C-m Repeat the last message displayed in the mini-buffer

M-s t M-s C-t Display date/time

M-s M-x Read function name, then call it with new screen

M-s i Show/hide the screen number in the mode line

M-s T Show/hide the tab on the top of each frame

M-s v Display ElScreen version

M-s b Switch to the screen in which specified buffer is displayed

M-s ? Show key bindings of ElScreen and Add-On softwares

### Nonstandard ElScreen commands

M-s \ Move the current screen to the left

M-s \ Move the current screen to the right

M-s r Remember (save current session)

M-s \ Open all buffers in individual screens

M-s h Toggle window split

### CUA mode

(Active region) C-x Cut (kill)

(Active region) C-c Copy

C-v Paste (yank)

C-z Undo

C-g C-z Redo

### Markdown mode and Python mode

C-S-c > Shift 4 spaces to the right

C-S-c < Shift 4 spaces to the left

### Emmet mode

C-j Expand

### Flyspell mode

C-c $ Correct word at point or save word to dictionary

### Customized commands

C-` f Find file in new screen (= M-s C-f)

C-` d Enable Flyspell mode (= M-x flyspell-mode)

C-` s Enable Flyspell mode for comments and strings only (= M-x flyspell-prog-mode)

C-` w Close current window (= C-x 0)

C-` v Split window vertically (= C-x 2)

C-` h Split window horizontally (= C-x 3)

C-` TAB Use clang-format to format selected region or current line

## Tmux

### Create / kill pane

M-s 3 M-s | Split window horizontally

M-s 2 M-s - Split window vertically

M-s x Kill current pane

M-s 0 Kill current pane (no prompt!)

### Select pane

M-s \ Select left-side pane

M-s \ Select right-side pane

M-s \ Select down-side pane

M-s \ Select up-side pane

M-s ; Select last pane

### Resize pane

M-h Resize pane left-side

M-l Resize pane right-side

M-j Resize pane down-side

M-k Resize pane up-side

### Create / kill window

M-s c Create new window

M-s & Kill current window

M-s k Kill current window (no prompt!)

### Select window

C-\ Select previous window

C-\ Select next window

### Miscellany

M-s r Reload configuration (`.tmux.conf`)

M-s t Display time

M-s q Display pane number

M-s ? Show key bindings of Tmux

## Git

### Git-flow commands

`git flow init -d` Initialize a new repo with the default branch structure

`git flow feature` List feature branches

`git flow feature start ` Start a feature branch

`git flow feature finish ` Finish a feature branch

`git flow feature publish ` Push a feature branch to the remote repo

`git flow feature pull ` Pull a feature branch from the remote repo

`git flow release` List release branches

`git flow release start ` Start a release branch

`git flow release finish ` Finish a release branch

`git flow hotfix` List hotfix branches

`git flow hotfix start ` Start a hotfix branch

`git flow hotfix finish ` Finish a hotfix branch

`git flow support` List support branches

`git flow support start ` Start a support branch

### Tags / Releases

`git tag -a vX.Y.Z -m 'version X.Y.Z' [commit]` Create a new tag

`git push origin --tags` Push tags

### Aliases

`git co` = `git checkout`

`git br` = `git branch`

`git ci` = `git commit`

`git st` = `git status`

`git unstage` = `git reset HEAD --`

`git last` = `git log -1 HEAD`

`git ll` Show fancy Git log

`git d` = `git diff HEAD --`

## Xmonad

### Standard commands

Super-Shift-Enter
Launch terminal

Super-p
Launch dmenu

Super-Shift-C
Close the focused window

Super-Space
Rotate through the available layout algorithms

Super-j
Move focus to the next window

Super-k
Move focus to the previous window

Super-Shift-J
Swap the focused window with the next window

Super-Shift-K
Swap the focused window with the previous window

Super-l
Expand the master area

Super-h
Shrink the master area

Super-,
Increment the number of windows in the master area

Super-.
Deincrement the number of windows in the master area

Super-q
Restart xmonad

Super-Shift-Q
Quit xmonad

### Customized commands

Super-PgDn or
Super-Down Switch to next workspace

Super-PgUp or
Super-Up Switch to previous workspace

Super-Shift-PgDn or
Super-Shift-Down Move window to next workspace

Super-Shift-PgUp or
Super-Shift-Up Move window to previous workspace

Super-Tab Toggle workspaces

Super-Right Switch to next screen

Super-Left Switch to previous screen

Super-Shift-Right Move window to next screen

Super-Shift-Left Move window to previous screen

Super-Shift-L Lock screen

Super-Shift-P Take screenshot