Skip to content

Instantly share code, notes, and snippets.

@NazarK
Last active October 19, 2023 05:43
Show Gist options
  • Save NazarK/3793146616ed1ae9a7dacca3aced2624 to your computer and use it in GitHub Desktop.
Save NazarK/3793146616ed1ae9a7dacca3aced2624 to your computer and use it in GitHub Desktop.
setup macos keyboard
#set ctrl to work as command
#make sublime to be opened from browser (when debugging RoR apps): https://github.com/inopinatus/sublime_url
#fix command + pgup command + pgdown to switch tabs
defaults write -g NSUserKeyEquivalents -dict-add "Select Previous Tab" "@\UF72C" "Previous Tab" "@\UF72C" "Previous Workspace" "@\UF72C" "Select Next Tab" "@\UF72D" "Next Tab" "@\UF72D" "Next Workspace" "@\UF72D" "Show Previous Tab" "@\UF72C" "Show Next Tab" "@\UF72D"
#setup keybindings
https://gist.github.com/trusktr/1e5e516df4e8032cbc3d
Go to Terminal -> Preferences -> Profiles -> Keyboard and add:
Key: ↖ Action: \033OH
Key: ↗ Action: \033OF
#git autocomplete in zsh
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc && . ~/.zshrc
#install ruby in rvm (openssl trouble)
#add to ~/.zshrc
#export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
brew install openssl@1.1
brew uninstall --ignore-dependencies openssl@3
rvm reinstall 2.7.6
brew install openssl@3
#make openssl 1.1 default
brew link openssl@1.1
#for mimemagic gem
brew install shared-mime-info
#for pg gem
brew install libpq
gem install pg -v '1.2.3' -- --with-pg-config=/usr/local/opt/libpq/bin/pg_config
#for createdb to work
echo 'export PATH="/usr/local/Cellar/postgresql@12/12.16/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
#rvm install 2.7.7 --with-openssl-dir=$(brew --prefix openssl@1.1)/lib
#fix F11 and F12 wit karabiner app
#fix home and end by importing rule "PC Style"
#https://apple.stackexchange.com/questions/143299/fix-home-and-end-keys-on-non-cocoa-applications
#https://medium.com/@elhayefrat/how-to-fix-the-home-and-end-buttons-for-an-external-keyboard-in-mac-4da773a0d3a2#:~:text=if%20you%20are%20a%20seasoned,end%20of%20the%20line%20respectively.
#If you want to fix the “Home” and “End” buttons, here is a quick tip to get them working again the way they should.
#1. Open a terminal. You can access it from the Launchpad.
#2. Type the following commands (and press Enter after each line):
sudo bash
mkdir -p ~/Library/KeyBindings ; cd ~/Library/KeyBindings
vim DefaultKeyBinding.dict
#What the above commands do is create a new “KeyBindings” folder in the “Library” folder and add a new “DefaultKeyBinding.dict” file.
#3. In the text editor that opens, copy and paste the following commands to it:
{
/* Remap Home / End keys */
/* Home Button*/
"\UF729" = "moveToBeginningOfLine:";
/* End Button */
"\UF72B" = "moveToEndOfLine:";
/* Shift + Home Button */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* Shift + End Button */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* Ctrl + Home Button */
"^\UF729" = "moveToBeginningOfDocument:";
/* Ctrl + End Button */
"^\UF72B" = "moveToEndOfDocument:";
/* Shift + Ctrl + Home Button */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
/* Shift + Ctrl + End Button*/
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:";
}
#Save (using the shortcut “Ctrl + o”) and exit (“Ctrl + x”) the file.
#4. Restart your Mac. The “Home” and “End” should be working now, and you can use it in conjunction with the “Shift” and “Ctrl” modifier buttons.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment