All Projects → madhavtummala → Terminal-Setup

madhavtummala / Terminal-Setup

Licence: MIT license
Best Setup for your terminal for programming on macOS

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Terminal-Setup

Zsh Iterm Touchbar
Display feedback of terminal in the 🍏 Touchbar
Stars: ✭ 632 (+2330.77%)
Mutual labels:  productivity, iterm2
awesome-xonshrc
👓 🐚 Make your xonsh RC file installable with awesome snippets of code.
Stars: ✭ 43 (+65.38%)
Mutual labels:  iterm2
3llo
3llo - Trello interactive CLI aplication
Stars: ✭ 245 (+842.31%)
Mutual labels:  productivity
bliss-zsh
A delicate Zsh theme that injects color without overwhelming your workspace
Stars: ✭ 20 (-23.08%)
Mutual labels:  iterm2
Dash.jl
Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.
Stars: ✭ 248 (+853.85%)
Mutual labels:  productivity
httpie-image
HTTPie plugin to display images in iTerm2
Stars: ✭ 23 (-11.54%)
Mutual labels:  iterm2
Espanso
Cross-platform Text Expander written in Rust
Stars: ✭ 3,834 (+14646.15%)
Mutual labels:  productivity
dotfiles
My personal (.)dotfiles and configurations for various programs and environments.
Stars: ✭ 34 (+30.77%)
Mutual labels:  iterm2
node-gif
Displays Gifs In Terminal 👽 👾 🚀 💣
Stars: ✭ 27 (+3.85%)
Mutual labels:  iterm2
python-imgcat
🖼 imgcat in Python (for iTerm2)
Stars: ✭ 184 (+607.69%)
Mutual labels:  iterm2
halcyon-iterm
Halcyon Theme for iTerm2
Stars: ✭ 49 (+88.46%)
Mutual labels:  iterm2
Sharex
ShareX is a free and open source program that lets you capture or record any area of your screen and share it with a single press of a key. It also allows uploading images, text or other types of files to many supported destinations you can choose from.
Stars: ✭ 18,143 (+69680.77%)
Mutual labels:  productivity
ayu-iTerm
ayu color themes for iTerm
Stars: ✭ 120 (+361.54%)
Mutual labels:  iterm2
Todoman
✅ A simple, standards-based, cli todo (aka: task) manager.
Stars: ✭ 247 (+850%)
Mutual labels:  productivity
Efficient-office
Alfred-Workflows,Vim,Script,Mac
Stars: ✭ 36 (+38.46%)
Mutual labels:  iterm2
Linux Window Session Manager
A tool to store and reload open windows and window positions for x11 desktops like unity and gnome.
Stars: ✭ 243 (+834.62%)
Mutual labels:  productivity
dotfiles
Blugil's dotfiles
Stars: ✭ 23 (-11.54%)
Mutual labels:  iterm2
Base2Tone-iterm2
Syntax highlighting colorschemes for iTerm2
Stars: ✭ 29 (+11.54%)
Mutual labels:  iterm2
catimg
Print an image of a cat to the iTerm2 terminal
Stars: ✭ 13 (-50%)
Mutual labels:  iterm2
dotfiles
🔧 My dotfiles on  macOS for Neovim, Zsh, kitty, lf, etc
Stars: ✭ 90 (+246.15%)
Mutual labels:  iterm2

Fresh macOS Terminal Setup

Clean Install macOS Big Sur

  • Backup files
  • Restart and then press ⌘ + ⌥ + R at startup chime
  • Wait for latest macOS to download on wifi
  • Erase all volumes in Disk Utility and install Big Sur

Installing tools

Our main goal is to keep our development tools separate from system tools.
First step for this is installing homebrew.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Next install a bunch of stuff, that is needed using brew.

brew install --cask iterm2
brew install python
brew install --cask sublime-text
brew install vim nano bash zsh

All these tools will be in /usr/local/bin which doesn't require sudo.
Change the default login shell in Users and Groups > Advanced Options to /usr/local/bin/zsh.
Add the following line in ~/.zshrc.

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

or for M1

export PATH=/opt/homebrew/bin:$PATH

Note: After openning iTerm2, do iTerm2 > Make iTerm2 Default Term
Note: Go to System Preferences > Keyboard > Shortcuts > Services, set a shortcut (I set ⌘ + 5) for new iTerm window/tab here

Setting up SSH and GPG keys

Install gnupg first.

brew install gpg

Follow this documentation for GPG keys and this for SSH keys

If you want to transfer gpg keys from backup or old computer.

Export keys (backup)

Import gpg keys from another computer. First lets get the key id.

~ ❯ gpg --list-secret-keys --keyid-format LONG
/Users/Madhav/.gnupg/pubring.kbx
--------------------------------
sec   rsa4096/2E214BB6870E6584 2019-10-27 [SC]
      D633155EE585A691DE7B33602E214BB6870E6584
uid                 [ultimate] Madhav Tummala (Git) <[email protected]>
ssb   rsa4096/FBB5221605FB333C 2019-10-27 [E]

Here, the keyid is 2E214BB6870E6584. Now, to export

gpg --armor --export <key-id> > public.asc
gpg --armor --export-secret-key <key-id> > private.asc

Import keys

gpg --import private.asc

You will require to enter the pass-phrase while importing and exporting, so please remember the pass-phrase. To edit the pass-phrase, after importing,

Changing the Passphrase

gpg --edit-key <key-id>
gpg> passwd #set the new pass-phrase
ggp> save

Set Up ZSH

Install oh-my-zsh.

Setup syntax highlighting

brew install zsh-syntax-highlighting
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

You will need to install nerd-font for icons in the prompt to show up properly

brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font

Then, in iTerm profile settings use a different font for non-ascii text and set it to hack nerd font mono.

Install colorls

If you want to be a little extra, you can install colorls. Use a personal installation of ruby.

brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

source ~/.zshrc
gem install colorls
echo "export PATH=$PATH:$(ruby -e 'puts Gem.bindir')" >> ~/.zshrc

# Create alias
alias lc="colorls"
alias lcl="colorls -lA --sd"

zsh theme

We will use my theme called clear.

wget -O $ZSH_CUSTOM/themes/clear.zsh-theme https://raw.githubusercontent.com/madhavchoudhary/clear/master/clear.zsh-theme

Set ZSH_THEME="clear" in ~/.zshrc. For reference the final ~/.zshrc file will look like:

# Oh-my-zsh settings
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="clear"
plugins=(git)
source $ZSH/oh-my-zsh.sh

# User settings
alias python="/usr/local/bin/python3"
alias pip="/usr/local/bin/pip3"
alias lc="colorls"
export LC_ALL=en_US.UTF-8
export GPG_TTY=$(tty)
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

or for M1, the final file looked like

# Oh-my-zsh settings
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="clear"
plugins=(git)
source $ZSH/oh-my-zsh.sh
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# Env settings
export LC_ALL=en_US.UTF-8
export GPG_TTY=$(tty)
export PATH=/opt/homebrew/bin/:/opt/homebrew/opt/ruby/bin/:$PATH

# Aliases
alias python="/opt/homebrew/bin/python3"
alias pip="/opt/homebrew/bin/pip3"
alias lc="$(ruby -e 'puts Gem.bindir')/colorls"
alias lcl="$(ruby -e 'puts Gem.bindir')/colorls -lA --sd"

iterm2 profile

You can import the Mad iTerm Profile inlcuded. It also has all the good keyboard shortcuts set.
If you want to set your profile manually, these are the shortcuts I used.

Description Keyboard Combination Action Code
Move cursor one word left ⌥ + ← Send Escape Sequence Esc+ b
Move cursor one word right ⌥ + → Send Escape Sequence Esc+ f
Move cursor to beginning of line ⌘ + ← Send Hex Code 0x01
Move cursor to end of line ⌘ + → Send Hex Code 0x05
Delete word ⌥ + ←Delete Send Hex Code 0x1b 0x08
Delete line ⌘ + ←Delete Send Hex Code 0x15
Undo ⌘ + z Send Hex Code 0x1f
Select by word left ⌥ + ⇧ + ← Move Start of Selection Back, Move by word -
Select by word right ⌥ + ⇧ + → Move End of Selection Forward, Move by word -
Select by line left ⌘ + ⇧ + ← Move Start of Selection Back, Move by line -
Select by line right ⌘ + ⇧ + → Move End of Selection Forward, Move by line -

Git setup

Using git config --global --edit change your config

# This is Git's per-user configuration file.
[user]
        name = MadhavChoudhary
        email = [email protected]
        signingkey = 2E214BB6870E6584
[core]
        editor = "nano -w"
[commit]
        gpgsign = true

Errors

Vim Warnings

If you get warnings while opening vim like this:

Warning: Failed to set locale category LC_NUMERIC to en_CH.
Warning: Failed to set locale category LC_TIME to en_CH.
Warning: Failed to set locale category LC_COLLATE to en_CH.
Warning: Failed to set locale category LC_MONETARY to en_CH.
Warning: Failed to set locale category LC_MESSAGES to en_CH.

Add this to your ~/.zshrc

export LC_ALL=en_US.UTF-8

Commit singing error

backup ❯ git commit -m 'added new gpg key'                               master
error: gpg failed to sign the data
fatal: failed to write commit object

Add this to your ~/.zshrc

export GPG_TTY=$(tty)

Contributing

Look here for tips and here for my previous setups.
You can contribute to either of those documents and add sugesstions or errors in this setup document in case something doesn't work as expected.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].