Published on

New laptop

Authors
  • avatar
    Name
    Jinjiu Liu
    Twitter

Content

A few days away cause I sank in the new laptop I just got, thanks to my friend's generous help! He bought a second-hand 2022 macbook pro 13" for me from his company. It has the same memory and storage as my previous laptop, e.g. 16/512gb, but with a much better CPU and battery life.

I was a macbook user long time ago when I was a student, but switched to a linux laptop for work few years ago. Since I mainly did software development work and my employer only offered linux laptops, I mostly used linux for years.

What I needed to do was to tweak the macbook properly, so I don't have to re-study all those shortcuts I use in linux and keep same operation habits.

Command or Control, it's a question...

Most of the cases, the shortcuts are the same on macbook using command instead of ctrl. However, in the Terminal, the command + c and command + v are still copy/paste, and there's no easy way to overwrite it. For example, I tried to exchange/remap the ctrl and command keys in the Terminal setting, but then I lost the functions to go through current windows by pressing command + tab.

The solution is iTerm 2 + shortcut rebinding. Go to Settings -> Keys -> Key Bindings, set shift + cmd + c as Copy Selection or Send ^C, set shift + cmd + v as paste or Send ^V, set cmd + c as Apply to current session, Send Hex Codes: 0x03. Now tadaaa! you can use cmd + c to stop the current running process in the terminal like linux! for copying just use shift + cmd + c. Another small setting to enable delete whole time by ctrl + delete is as Apply to current session, Send Hex Codes: 0x15.

I use VS Code mostly, and you just need to customize the shortcuts by: Command Palette → Preferences: Open Keyboard Shortcuts (JSON) and add the json lines below:


  // In terminal: ⌘C sends Ctrl-C when nothing is selected
  {
    "key": "cmd+c",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "\u0003" },            // \u0003 = Ctrl-C
    "when": "terminalFocus && terminalTextSelected == false"
  },
  // In terminal: keep normal Copy when there IS a selection
  {
    "key": "cmd+c",
    "command": "workbench.action.terminal.copySelection",
    "when": "terminalFocus && terminalTextSelected"
  }

Some shortcuts and functions to keep in mind for similar linux experience

  • undo: cmd + z; redo: cmd + shift + z
  • Go to settings -> hot corner shortcuts -> set the top left corner as Mission Control
  • Remove animations: set off to Animate opening applications; set Scale Effect for Minimize windows using. I personally find them take way too long :p Also in the Accessibility, turn on Reduce motion
  • If you don't use spotlight much, unselect the search categories in the setting. I personally only kept Applications, Documents, Folders, PDF Documents, and System Settings. This avoid a lot of background indexing.
  • Switch on Low Power Mode when on battery. Trust me, with Apple silicon chip, it's enough for most cases
  • Switch off Siri as I personally don't want to be heard by my laptop all the time :p

Yep, that's about it! Hope this article helps you a bit if you have the same taste XD