Skip to content

Instantly share code, notes, and snippets.

@jacqinthebox
Last active December 22, 2019 17:43
Show Gist options
  • Select an option

  • Save jacqinthebox/76d3e1b61547d86471a77d5140d1700f to your computer and use it in GitHub Desktop.

Select an option

Save jacqinthebox/76d3e1b61547d86471a77d5140d1700f to your computer and use it in GitHub Desktop.
[Keyboard Shortcuts]Keyboard Shortcuts #markdown #vim #vscode

Keyboard Shortcuts

Table of Contents

Git

Command What is does
git branch -a Display local and remote branches
git diff origin/feature/archive-kid feature/archive-kid Show differences
git log --oneline --decorate --color -graph --all Nice tree
git diff --stat --color feature/archive-kid origin/feature/archive-kid Show only difference
git remote show origin show branches on remote
git remote prune origin --dry-run clean up stale branches, if for real then omit --dry-run

Don't forget to fetch first.

tmux

git clone --recursive https://github.com/tony/tmux-config.git ~/.tmux
ln -s ~/.tmux/.tmux.conf ~/.tmux.conf

Ctrl+b c Create a new window (with shell)
Ctrl+b w Choose window from a list
Ctrl+b 0 Switch to window 0 (by number )
Ctrl+b , Rename the current window
Ctrl+b % Split current pane horizontally into two panes
Ctrl+b " Split current pane vertically into two panes
Ctrl+b o Go to the next pane Ctrl+b arrow keys Navigate between panes
Ctrl+b ; Toggle between current and previous pane
Ctrl+b x Close the current pane

Ctrl+b [ enable scroll up and down (press q to exit this mode)

:resize-pane -D (Resizes the current pane down)
:resize-pane -U (Resizes the current pane upward)
:resize-pane -L (Resizes the current pane left)
:resize-pane -R (Resizes the current pane right)
:resize-pane -D 10 (Resizes the current pane down by 10 cells)
:resize-pane -U 10 (Resizes the current pane upward by 10 cells)
:resize-pane -L 10 (Resizes the current pane left by 10 cells)
:resize-pane -R 10 (Resizes the current pane right by 10 cells)

Enter copy mode: <prefix>+[  
Start copy: <Space>  
Copy text: <Enter>  
Paste text: <prefix>+]  

Notetaking

Command Key
Start template :Template note
Save note :Keep note
Save something else :Keep filename
Insert Timestamp :r !date
Search :Ack PowerShell .

Todo: describe prerequistes

  • Silver Searcher
  • Vim Template
  • Vim Ack
  • You Complete Me
  • .vimrc check
git clone git://github.com/aperezdc/vim-template.git ~/.vim/bundle/vim-template
sudo apt-get install silversearcher-ag
cd ~/.vim/bundle && git clone https://github.com/rking/ag.vim 

:Ag [options] {pattern} [{directory}] 

Vim-Markdown

Command Key
Align `:'<,'>Tabularize /
Fold zM
Unfold zR
Open fold cursor is on zA or za
LivedownPreview :LivedownPreview
LivedownKill :LivedownKill
LivedownToggle :LivedownToggle

https://github.com/plasticboy/vim-markdown

npm install -g livedown
git clone git://github.com/shime/vim-livedown.git ~/.vim/bundle/vim-livedown

https://github.com/shime/vim-livedown

https://vim.rtorr.com/

Mac

Command Key
Beginning of page CMD + UP
End of page CMD + Down
Beginning of line CMD + Left
End of line CMD + Right
Toggle Maximize CTRL + CMD + F
Toggle Maximize (iTerm) CMD + Enter
Application Window CTRL+UP
Mission Control CTRL+DOWN
Show Desktop F11

Updating-Mac

# what do we have
brew cask install `brew cask list`

brew upgrade
brew cask upgrade
upgrade_oh_my_zsh

iTerm

Command Key
New Tab CMD + T
Toggle Tabs CMD + Nr

Vim

Command Key
End of line $
Beginning of line 0
Middle M
New Tab CTRL + t
Next tab gT
Pevious tab gt
Up and down paragraph { }
Find and replace :%s/foo/bar/g
undo u
delete b4 colon cw
cit delete bw tags
a delete + ins
G o Go to end of fine and add new line
  • E,e, B, b, W,w

  • { – Go to the beginning of the current paragraph. By pressing { again and again move to the previous paragraph beginnings.

  • } – Go to the end of the current paragraph. By pressing } again and again move to the next paragraph end, and again.

  • /i – Search for a pattern which will you take you to the next occurrence of it.

  • ?i – Search for a pattern which will you take you to the previous occurrence of it.

  • asterisk – Go to the next occurrence of the current word under the cursor.

  • hashtag – Go to the previous occurrence of the current word under the cursor.

https://rumorscity.com/2014/08/16/5-best-vim-cheat-sheet/
https://www.thegeekstuff.com/2009/03/8-essential-vim-editor-navigation-fundamentals/
https://www.maketecheasier.com/vim-keyboard-shortcuts-cheatsheet/
https://www.fprintf.net/vimCheatSheet.html
https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html

VsCode

Command Key
Go to Explorer CTRL+SHIFT+E
Toggle Sidebar CTRL+B
Toggle Terminal CTRL + backtic

Chrome

Command Key
Next/Prev Tab CMD + Option + Arrow
New tab CMD + t
Close tab CMD + w

Linux

Misc shell commands.

Copy over ssh:

cat ~/.ssh/id_rsa.pub | ssh git@remote-server "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"
# run app and release erminal
nohup ./todoist &

# kill 
pidof httpd
ps aux | grep httpd

kill -9 3486
kill -SIGKILL 3486

Networking

show dns

nmcli dev show eth0

Share

mount -t cifs -o username=username,password=password //server-name/sharename /mountpoint

Encrypt

gpg --output ~/Cloudstation/markdown -c <encrypted file>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment