This directory contains iTerm2 preferences that are version-controlled with your dotfiles.
iTerm2 has been configured to save its preferences to this directory instead of the default location (~/Library/Preferences/).
- Custom Preferences Folder: iTerm2 is set to load/save preferences from this directory
- Semantic History: Configured to open files in Neovim using
nvr(Neovim Remote) - Tab-specific sockets: Each iTerm tab has its own Neovim server socket
Run this script to configure iTerm2 preferences location and Semantic History:
# Set iTerm2 to use custom preferences folder
defaults write com.googlecode.iterm2 PrefsCustomFolder -string "$HOME/dotfiles/iterm2"
defaults write com.googlecode.iterm2 LoadPrefsFromCustomFolder -bool true
# Configure Semantic History for all profiles
python3 ~/dotfiles/scripts/setup_iterm_semantic_history.py- Restart iTerm2 for changes to take effect
- iTerm2 will now save all preferences to
~/dotfiles/iterm2/ - Any changes you make in iTerm2 settings will be automatically saved here
The Semantic History feature allows you to Cmd+Click on file paths in your terminal to open them in Neovim.
How it works:
- Detects patterns like:
file.py:42,path/to/file.js:10, etc. - Opens the file in the Neovim instance running in the same iTerm tab
- Each tab has its own Neovim server, so clicks in Tab A only affect Tab A's Neovim
Usage:
- Split your iTerm window (⌘D)
- In the left pane: start
nvimorvim - In the right pane: run commands that output file paths:
pytest # Shows test failures with file:line python script.py # Shows stack traces echo "Check file.py:42 for the bug"
- Cmd+Click on any file path to open it in the left pane's Neovim!
Color themes are stored in ../iterm-themes/ directory.
com.googlecode.iterm2.plist- Main preferences file (auto-generated by iTerm2)README.md- This file
If you need to reset to defaults:
# Remove custom folder setting
defaults delete com.googlecode.iterm2 PrefsCustomFolder
defaults delete com.googlecode.iterm2 LoadPrefsFromCustomFolder
# Restart iTerm2If you need to update the Semantic History command:
python3 ~/dotfiles/scripts/setup_iterm_semantic_history.pyEdit the script at ~/dotfiles/scripts/setup_iterm_semantic_history.py to change the command.
- Verify Neovim is running with a server:
ls /tmp/nvimsocket-* - Check that
nvris installed:which nvr - Test manually:
nvr --servername /tmp/nvimsocket-<tab-id> --remote test.txt
- Make sure iTerm2 is reading from the custom folder:
defaults read com.googlecode.iterm2 LoadPrefsFromCustomFolder # Should output: 1
- Restart iTerm2
- Check that
ITERM_SESSION_IDis set:echo $ITERM_SESSION_ID - Verify the nvim function in
.zshrcis loaded:type nvim - Run tests:
~/dotfiles/tests/test_nvim_server.sh