macOS Ventura M1
I've invested a significant amount of time to build this work(flow) environment especially the theme. Each tmux window is a workspace and I'm able to navigate and manipulate my environment ( ie windows, panes, code) from only the CLI (no mouse) with precision and speed. Thought it would be nice to share it with the rest of the world. Yeah I could've wrote a script but for me it's more of an excersize in documenting and following instructions. Hope it helps your workflow!
NOTE: any mv commands means moving the repsective file from this git
repo.
-
MacOS:
- Map Caps Lock Key to Control
- System Preferences -> Keyboard -> Modifier Keys
- install flycut, multi-clipboard for the system,
shift-ctrl-v+leftorrightarrow keys to pick which clipboard to paste - install Spectacle, to allow for arranging MacOS windows via key shortcuts.
- Map Caps Lock Key to Control
-
Chrome Browser:
- install Vimium (vim controls for browsing)
-
Install:
- iTerm2: download stable from https://www.iterm2.com/downloads.html
- homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - zsh:
brew install zsh zsh-completions - ohmyzsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"mv .zshrc ~
iTerm2:
- Install theme:
- git clone https://github.com/dracula/iterm.git
- Preferences -> Profile -> Colors
- import Dracula.itermcolors
- set Dracula color preset
Via Homebrew
- install/upgrade:
brew install tmux git vim the_silver_searcher httpie reattach-to-user-namespace ctags jq htop thefuck tfenv ccat ipcalc hugo
Vim:
- Install janus (https://github.com/carlhuda/janus)
-
curl -L https://bit.ly/janus-bootstrap | bash, syntax hilighting plugins, etc. -
cd $HOME/.vim/janus/vim/tools/fugitive && git checkout master && git pull, fixes issues with latest vim -
cd $HOME/.vim/janus/vim/tools/tlib && git checkout master && git pull, fixes issues with latest vim -
cd $HOME/.vim/janus/vim/tools/nerdtree && git checkout master && git pull, fixes issues with latest vim -
mkdir ~/.janusandgit clonethese plugin repos in it:git clone https://github.com/dracula/vimDarcula Vim Themegit clone https://github.com/vim-airline/vim-airlinegit clone https://github.com/vim-airline/vim-airline-themesgit clone https://github.com/qpkorr/vim-bufkillgit clone https://github.com/fatih/vim-gogit clone https://github.com/hashivim/vim-terraformgit clone https://github.com/yssl/QFEnter.gitgit clone https://github.com/godlygeek/tabular.gitgit clone https://github.com/tpope/vim-bundlergit clone https://github.com/tpope/vim-rails.gitgit clone https://github.com/tpope/vim-surround.gitgit clone https://github.com/tpope/vim-dadbodgit clone https://github.com/szw/vim-tagsgit clone https://github.com/majutsushi/tagbargit clone https://github.com/kkvh/vim-docker-toolsgit clone https://github.com/Xuyuanp/nerdtree-git-plugin
-
mv .vim.before ~ -
mv .vim.after ~
-
OhMyZSH git-open Plugin:
cd ~/.oh-my-zsh/custom/pluginsgit clone https://github.com/paulirish/git-open.git
rvm (https://rvm.io/)
- install:
curl -sSL https://get.rvm.io | bash -s stableand follow sourcing instructions at the end - install ruby 3.2.1
rvm install 3.2.1andrvm --default use 3.2.1 - install tmuxinator:
gem install tmuxinator
Tmux:
-
set up tmuxinator config
mkdir ~/.tmuxinatorandmv hustle.yml ~/.tmuxinator/mkidr ~/binandmv tmuxinator.zsh ~/bin/(you'll need to add~/binto yourPATH)
-
clone this repo anywhere and install fonts
git clone https://github.com/powerline/fonts- run
./install.sh
-
clone this repo anywhere
git clone https://github.com/jimeh/tmux-themepackmv .tmux.conf ~/.tmux.conf- may need to edit
.tmux.confto havesource-filepoint totmux-themepack/powerline/default/blue.tmuxtheme
iTerm2:
- Load
iterm/profile.json - Or do the following:
- under preferences -> profiles -> text
- set fonts
- ascii font - 13pt Monaco
- non ascii font - 13pt source code pro for powerline
- under preferences -> profiles -> window
- background image from https://images7.alphacoders.com/321/thumb-1920-321966.jpg
- under preferences -> profiles -> keys
- map hot keys according to
hexcodes1.pngandhexcodes2.png - ^this is so that we dont have to press tmux leader key
ctrl-q+ tmux-cmd, we just mapctrl-qtocmdkey, for easier/faster typing
- map hot keys according to
FINAL:
- Quit iterm
- load iterm
- enter the command
mat the terminal and everything SHOULD spin up (first startup will be SLOW on Intel but not M1) - Once the tmux env is running, you can close and reopen iterm, press
mand you're instantly back in your tmux session.
Navigation
-
Panes:
- Left:
cmd-h - Up:
cmd-k - Down:
cmd-j - Right:
cmd-l - Zoom In/Out:
cmd-z - Create new vertical pane:
cmd-| - Create new horizontal pane:
cmd--(hyphen) - Move Pane Left:
cmd-{ - Move Pane Right:
cmd-} - scroll buffer:
cmd-[- search up:
? - search down:
/ - use vim controls to navigate left(
h), Up(k), Down(j), Right(l), back page(ctrl-b), forward page(ctrl-f), etc - to copy text, enter highlight mode
v(start highlight at current cursor) orV(start highlight entire line), use vim controls to select desired text.escto stop highlight mode but stay in scroll mode.returnto copy selected text to system clipboard, will exit scroll mode. - clear scroll buffer:
ctrl-k
- search up:
- Left:
-
Windows:
- Next Window (Right):
cmd-p - Prev Window (Left):
cmd-shift-p
- Next Window (Right):
-
Other:
- any other tmux that are not mapped via hex codes use
ctrl-qfor tmux leader key
- any other tmux that are not mapped via hex codes use
-
Leader Key (lkey):
, -
Open/Close NerdTree file browser:
lkey-n- Open file in current pane:
return - Open file split vertical:
s - Open file split horizontal:
i - Show hidden files:
I
- Open file in current pane:
-
navigate open panes
- left
cmd-wthenh, Upcmd-wthenh, Downcmd-wthenj, Rightcmd-wthenl - if several open panes are displayed, you can zoom in/out to one
pane:
cmd-wtheno(note: sometimes vim doesnt remember the last pane configuration when zooming out, not sure why) - to align open panes:
cmd-wthen=(note usually use this when panes get shifted when zooming in/out of tmux pane with vim open) - Shift current pane to far left:
cmd-wthenH - Shift current pane to far right:
cmd-wthenL - if all panes are vertically split, then organize them horizontally
- select each pane:
cmd-wthenJorK
- select each pane:
- if all panes are horizontally split, then organize them vertically
- select each pane:
cmd-wthenHorL
- select each pane:
- left
-
Close Open Panes
- Close open pane but keep open buffer:
:q - Close open pane and close open buffer:
:bd - Close open buffer but and replace open pane with next open buffer:
:BD
- Close open pane but keep open buffer:
-
if you want to find where the current file (open buffer) is located:
lkey-r -
Search file system by file name:
ctrl-pthen start typing name of file, will list files that match, useescto exit search mode.- Select files, up and down:
up/down arrow keys- Open file in current pane:
return - Open file in vertical pane:
ctrl-v - Open file in horizontal pane:
ctrl-x
- Open file in current pane:
- Select files, up and down:
-
Search open buffers by file name:
ctrl-pthenctrl-fthen start typing name of file, will list files that match, useescto exit search mode.- Select files, up and down:
up/down arrow keys- Open file in current pane:
return - Open file in vertical pane:
ctrl-v - Open file in horizontal pane:
ctrl-x
- Open file in current pane:
- Since you can see a list of open buffers at the top even though
they may not be displayed you can open them in splits by name
- split vertical open but not displayed buffer:
:vert sb filenameyou can tab expand the file name here without typing full path - split horizontal open but not displayed buffer:
:sb filenameyou can tab expand the file name here without typing full path
- split vertical open but not displayed buffer:
- Select files, up and down:
-
Step through open buffers using the current open buffer
-
Left
ctrl-h, Rightctrl-l -
Grep for text in all files:
\\(single backslash) then type text you want to search for, thenreturn. Will open QuickFix List pane.- use vim controls to navigate left(
h), Up(k), Down(j), Right(l)- Open file in current pane:
return - Open file in vertical pane:
ctrl-v - Open file in horizontal pane:
ctrl-x
- Open file in current pane:
- close QuickFix list pane:
:ccl
- use vim controls to navigate left(
-
to see history of edits on a file:
F5, step through history,:qto close -
Git blame:
:Gblame,:qto close -
Rename file in open buffer:
:Rename new-file-name
-
quickly cd into previous directories w/o typing absolute path:
z dir-name -
enter vim mode on command line:
escthen use vim controls to navigate or edit. vim modeifor insert (exit vim mode). if editing a long command in vim mode typevto edit command line in a vim editor (qw) to save and exit. sometimes you'll get a strangeexecute:mode (idk what it is for yet) justctrl-cto exit execute mode -
find previous commands as prefix (like ctrl-r), to scroll through history for commands that begin with ssh:
sshthen useup arrowto show only previous commands that begin with ssh. -
cd into last dir:
- -
cd into home dir:
~ -
cd into directory above my current dir:
..back one dir,...back two dirs,...., etc. -
I use the following ZSH plugins, look them up if you want to know more:
git rails vi-mode history-substring-search osx extract z web-search docker thefuck git-open -
check out all the amazing git command aliases with
alias|grep git, -
my favs:
gl- git pull,gp- git push,glol- colorful logs,gaa- git add all,gcmsg 'you know my steez'- commit message,gup- rebase,gco -b new-branch- make new branch,gcm- checkout master
