joshmfrankel / joshfrankel.me

Repo for my portfolio website
joshfrankel.me
0 stars 0 forks source link

Setting up a Mac for Linux users & Editor #3

Open joshmfrankel opened 11 months ago

joshmfrankel commented 11 months ago

Apps

joshmfrankel commented 3 months ago

Homebrew

# Install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Add to path
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/joshfrankel/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
joshmfrankel commented 3 months ago

Keyboard

Customize Modifier keys

Image

Spotlight

Screenshots

joshmfrankel commented 3 months ago

Mouse

joshmfrankel commented 3 months ago

Dock

Image

Desktop & Stage Manager

Faster reveal

defaults write com.apple.dock autohide-delay -int 0
defaults write com.apple.dock autohide-time-modifier -float 0.4
killall Dock

Image

joshmfrankel commented 3 months ago

Magnet - App

joshmfrankel commented 3 months ago

iTerm2

Appearance

Image

New Profile - Guake

General

Image

Colors

Text

Terminal

Window

Keys

Image

Image

Keys

Key Bindings

joshmfrankel commented 3 months ago

System Settings

Appearance

Display

Menu Bar

Image

joshmfrankel commented 3 months ago

Terminal

Install oh-my-zsh

Syntax Highlighting

brew install zsh-syntax-highlighting
echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
source ~/.zshrc

Auto Suggestion

brew install zsh-autosuggestions
echo "source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
source ~/.zshrc
joshmfrankel commented 3 months ago

Version Manager

asdf add plugin ruby asdf add plugin nodejs asdf add plugin golang

brew install libyaml # For ruby installation brew install postgresql # For 'pg' gem

joshmfrankel commented 3 months ago

VSCode

Image

Keybindings

Image

joshmfrankel commented 2 months ago

Sublime Text - Settings

Settings

{
  "always_show_minimap_viewport": true,
  "auto_complete_include_snippets": true,
  "bold_folder_labels": true,
  "caret_style": "phase",
  "color_scheme": "Packages/Material Theme/schemes/Material-Theme-Palenight.tmTheme",
  "draw_minimap_border": true,
  "draw_white_space": [
    "selection",
    "trailing",
    "isolated"
  ],
  "ensure_newline_at_eof_on_save": true,
  "fade_fold_buttons": false,
  "font_face": "Operator Mono Medium",
  "font_size": 15,
  "highlight_line": true,
  "highlight_modified_tabs": true,
  "ignored_packages": [
    "Vintage",
  ],
  "indent_guide_options": [
    "draw_normal",
    "draw_active"
  ],
  "index_files": true,
  "line_padding_top": 1,
  "line_padding_bottom": 1,
  "overlay_scroll_bars": "enabled",
  "rulers": [
    120
  ],
  "scroll_past_end": 0.25,
  "shift_tab_unindent": true,
  "show_full_path": true,
  "show_rel_path": true,
  "show_sidebar_button": false,
  "show_indentation": false,
  "tab_size": 2,
  "theme": "Material-Theme-Palenight.sublime-theme",
  "translate_tabs_to_spaces": true,
  "trim_trailing_white_space_on_save": "all",
  "update_system_recent_files": false,
  "word_wrap": true,
  "material_theme_contrast_mode": true,
  "material_theme_panel_separator": true,
  "material_theme_small_statusbar": true,
  "material_theme_big_fileicons": true,
  "material_theme_compact_sidebar": true,
  "material_theme_tabs_separator": true,
  "material_theme_accent_bright-teal": true,
}

Add to CLI

# Mac
echo 'export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"' >> ~/.zshrc

Resources

joshmfrankel commented 2 months ago

Sublime Text - Plugins

Alternative to LSP

Material Theme

FileManager

{
  "show_edit_to_the_left_command": false,
  "show_edit_to_the_right_command": false,
  "show_find_in_files_command": false,
  "show_open_in_browser_command": false,
}
joshmfrankel commented 2 months ago

Sublime Text - LSP

Option 1 - LSP

https://github.com/sublimelsp/LSP/issues/2501

gem install rubocop
gem install solargraph
gem install solargraph-rails
npm install -g typescript-language-server typescript eslint

Ensure that Typescript does not try to format styles. Eslint/prettier should handle this (see: https://github.com/sublimelsp/LSP-typescript/issues/118)

{
  "disabled_capabilities": {
    "documentFormattingProvider": true,
    "documentRangeFormattingProvider": true,
  },
}
{
  "lsp_format_on_save": true,
  "lsp_code_actions_on_save": {
    "source.fixAll.eslint": true,
  },

  "diagnostics_highlight_style": {
    "error": "box",
    "warning": "box",
    "info": "box",
    "hint": "box",
  },

  "diagnostics_gutter_marker": "dot",
  "show_code_lens": "phantom",
   "show_inlay_hints": true,
   "document_highlight_style": "background",
  "clients": {
    "ruby": {
        "enabled": false,
        "command": ["/Users/joshfrankel/.asdf/shims/solargraph", "stdio"],
        "selector": "source.ruby | text.html.ruby",
        "initializationOptions": {
            "diagnostics": true,
        },
    },
  },
}
joshmfrankel commented 2 months ago

Option 2 - SublimeLinter + Sublime-Codefmt

SublimeLinter

Install linter binaries

npm install -g eslint_d
npm install -g prettier
gem install rubocop

Settings

// SublimeLinter Settings - User
{
  "show_panel_on_save": "view",

  "linters": {
    "eslint": {
      "env": {
        "PATH": "~/.asdf/shims:$PATH",
      },
    },

    "rubocop": {
      "executable": "~/.asdf/shims/rubocop",
    },
  },
}

Sublime-codefmt

Auto-format files in the background

Eslint_d is optional. Prettier will handle most cases but left here for posterity

{
  "overrides": {
    "eslint": {
      "command": [
        "/Users/joshfrankel/.asdf/shims/eslint_d",
        "--fix",
        "--config",
        "$config",
        "$file",
      ],
    },

    "rubocop": {
      "command": [
        "/Users/joshfrankel/.asdf/shims/rubocop",
        "--autocorrect-all",
        "--raise-cop-error",
        "--no-color",
        "--config",
        "$config",
        "$file",
      ],
    },

    "prettier": {
      "command": [
        "/Users/joshfrankel/.asdf/shims/prettier",
        "--parser",
        "$parser",
        "--write",
        "--config",
        "$config",
        "$file",
      ],
    },
  },
}
joshmfrankel commented 1 month ago

Sublime Text - Keybindings

[
  {
    "keys": [
      "alt+shift+1"
    ],
    "command": "set_layout",
    "args": {
      "cols": [
        0.0,
        1.0
      ],
      "rows": [
        0.0,
        1.0
      ],
      "cells": [
        [
          0,
          0,
          1,
          1
        ]
      ]
    }
  },
  {
    "keys": [
      "alt+shift+2"
    ],
    "command": "set_layout",
    "args": {
      "cols": [
        0.0,
        0.5,
        1.0
      ],
      "rows": [
        0.0,
        1.0
      ],
      "cells": [
        [
          0,
          0,
          1,
          1
        ],
        [
          1,
          0,
          2,
          1
        ]
      ]
    }
  },
  {
    "keys": [
      "alt+shift+3"
    ],
    "command": "set_layout",
    "args": {
      "cols": [
        0.0,
        0.33,
        0.66,
        1.0
      ],
      "rows": [
        0.0,
        1.0
      ],
      "cells": [
        [
          0,
          0,
          1,
          1
        ],
        [
          1,
          0,
          2,
          1
        ],
        [
          2,
          0,
          3,
          1
        ]
      ]
    }
  },
  {
    "keys": [
      "alt+shift+4"
    ],
    "command": "set_layout",
    "args": {
      "cols": [
        0.0,
        1.0
      ],
      "rows": [
        0.0,
        0.5,
        1.0
      ],
      "cells": [
        [
          0,
          0,
          1,
          1
        ],
        [
          0,
          1,
          1,
          2
        ]
      ]
    }
  },
  {
    "keys": [
      "super+shift+k"
    ],
    "command": "run_macro_file",
    "args": {
      "file": "res://Packages/Default/Delete Line.sublime-macro"
    }
  },
  {
    "keys": [
      "super+t"
    ],
    "command": "show_overlay",
    "args": {
      "overlay": "goto",
      "text": ":"
    }
  },
  // Movement
  {
    "keys": [
      "super+left"
    ],
    "command": "move",
    "args": {
      "by": "subwords",
      "forward": false
    }
  },
  {
    "keys": [
      "super+right"
    ],
    "command": "move",
    "args": {
      "by": "subwords",
      "forward": true
    }
  },
  {
    "keys": [
      "super+left+home"
    ],
    "command": "move_to",
    "args": {
      "to": "bol"
    }
  },
  {
    "keys": [
      "super+right+end"
    ],
    "command": "move_to",
    "args": {
      "to": "eol"
    }
  },
  {
    "keys": [
      "end"
    ],
    "command": "move_to",
    "args": {
      "to": "eol"
    }
  },
  {
    "keys": [
      "home"
    ],
    "command": "move_to",
    "args": {
      "to": "bol"
    }
  },
  {
    "keys": [
      "end"
    ],
    "command": "move_to",
    "args": {
      "to": "eol"
    }
  },
  {
    "keys": [
      "shift+end"
    ],
    "command": "move_to",
    "args": {
      "to": "eol",
      "extend": true
    }
  },
  {
    "keys": [
      "shift+home"
    ],
    "command": "move_to",
    "args": {
      "to": "bol",
      "extend": true
    }
  },
  {
    "keys": [
      "super+m"
    ],
    "command": "move_to",
    "args": {
      "to": "brackets"
    }
  },
  // Utilities
  {
    "keys": [
      "super+shift+alt+d"
    ],
    "command": "clone_file"
  },
  // TestRspec
  {
    "keys": [
      "option+shift+r"
    ],
    "command": "test_current_line",
    "context": [
      {
        "key": "selector",
        "operator": "equal",
        "operand": "source.ruby, source.rspec"
      }
    ]
  },
  {
    "keys": [
      "option+shift+t"
    ],
    "command": "test_current_file",
    "context": [
      {
        "key": "selector",
        "operator": "equal",
        "operand": "source.ruby, source.rspec"
      }
    ]
  },
  {
    "keys": [
      "option+shift+e"
    ],
    "command": "run_last_spec"
  },
  {
    "keys": [
      "option+shift+w"
    ],
    "command": "switch_between_code_and_test",
    "context": [
      {
        "key": "selector",
        "operator": "equal",
        "operand": "source.ruby, source.rspec"
      }
    ]
  },
]

Resources

joshmfrankel commented 3 weeks ago

Cursor Editor

Plugins

Cursor Settings

joshmfrankel commented 3 weeks ago

Cursor Editor - Settings

{
  "editor": {
    "fontFamily": "Operator Mono Medium",
    "fontLigatures": "'ss01','ss05','dlig'",
    "fontSize": 15,
    "formatOnSave": true,
    "lineHeight": 0,
    "multiCursorModifier": "ctrlCmd",
    "scrollPredominantAxis": false,
    "scrollBeyondLastLine": false,
    "smoothScrolling": true,
    "snippetSuggestions": "top",
    "tabSize": 2,
    "wordWrap": "on",
  },
  "workbench.commandPalette.history": 10,
  "explorer.confirmDelete": false,
  "workbench.tree.indent": 20,
  "workbench.editor.highlightModifiedTabs": true,
  "workbench.editor.tabSizing": "shrink",
  "files.insertFinalNewline": true,
  "files.trimTrailingWhitespace": true,
  "terminal.external.linuxExec": "zsh",
  "terminal.integrated.fontSize": 13,
  "security.workspace.trust.untrustedFiles": "open",
  "git.autofetch": true,
  "workbench.colorTheme": "Material Theme Palenight High Contrast",
  "window.commandCenter": false,
  "workbench.activityBar.location": "top",
  "workbench.colorCustomizations": {
    "editor.findMatchHighlightBorder": "#b638ffa4",
    "editorIndentGuide.activeBackground1": "#b638ffa4",
    "editorError.foreground": "#ff000088",
    "editorWarning.foreground": "#ffe60033",
    "editorInfo.foreground": "#00ff0088",
    "tab.activeBorder": "#9d00ff",
    "tab.unfocusedActiveBorder": "#000000",
    "tab.inactiveForeground": "#959DCB",
    "[Material Theme Palenight High Contrast]": {
      "activityBarBadge.background": "#64FFDA",
      "activityBar.activeBorder": "#64FFDA",
      "list.activeSelectionForeground": "#64FFDA",
      "list.inactiveSelectionForeground": "#64FFDA",
      "list.highlightForeground": "#64FFDA",
      "scrollbarSlider.activeBackground": "#64FFDA50",
      "editorSuggestWidget.highlightForeground": "#64FFDA",
      "textLink.foreground": "#64FFDA",
      "progressBar.background": "#64FFDA",
      "pickerGroup.foreground": "#64FFDA",
      "tab.activeBorder": "#64FFDA",
      "notificationLink.foreground": "#64FFDA",
      "editorWidget.resizeBorder": "#64FFDA",
      "editorWidget.border": "#64FFDA",
      "settings.modifiedItemIndicator": "#64FFDA",
      "settings.headerForeground": "#64FFDA",
      "panelTitle.activeBorder": "#64FFDA",
      "breadcrumb.activeSelectionForeground": "#64FFDA",
      "menu.selectionForeground": "#64FFDA",
      "menubar.selectionForeground": "#64FFDA",
      "editor.findMatchBorder": "#64FFDA",
      "selection.background": "#64FFDA40",
      "statusBarItem.remoteBackground": "#64FFDA"
    }
  },
  "search.location": "panel",
  "workbench.layoutControl.enabled": false,
  "editor.formatOnPaste": false,
  "editor.suggest.preview": true,
  "diffEditor.renderSideBySide": false,
  "diffEditor.experimental.showMoves": true,
  "solargraph.autoformat": true,
  "solargraph.commandPath": "/Users/joshfrankel/.asdf/shims/solargraph",
  "solargraph.logLevel": "debug",
  "breadcrumbs.symbolPath": "off",
  "breadcrumbs.enabled": false,
  "window.title": "${activeFolderMedium}${separator}${activeEditorShort}${separator}(${activeRepositoryBranchName})",
  "search.mode": "reuseEditor",
  "editor.scrollbar.verticalScrollbarSize": 16,
  "editor.padding.bottom": 200,
  "materialTheme.accent": "Bright Teal",
  "workbench.preferredHighContrastColorTheme": "Material Theme Palenight High Contrast",
  "workbench.iconTheme": "eq-material-theme-icons-palenight",
  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": [
          "keyword.control.ruby",
          "keyword.control.def.ruby",
          "keyword.control.start-block.ruby",
          "keyword.control.pseudo-method.ruby",
          "keyword.control.module.ruby",
          "keyword.control.class.ruby",
        ],
        "settings": {
          "foreground": "#c792ea"
        }
      },
      {
        "scope": [
          "constant.language.ruby",
          "variable.parameter.function.ruby",
          "constant.other.symbol.hashkey.parameter.function.ruby",
        ],
        "settings": {
          "foreground": "#F78C6C"
        }
      },
      {
        "scope": [
          "source.ruby",
          "variable.other.readwrite.instance.ruby",
        ],
        "settings": {
          "foreground": "#959DCB"
        }
      },
      {
        "scope": [
          "constant.other.symbol.hashkey.ruby",
          "constant.other.symbol.ruby"
        ],
        "settings": {
          "foreground": "#C3E88D"
        }
      },
      {
        "scope": [
          "keyword.other.special-method.ruby",
        ],
        "settings": {
          "foreground": "#82AAFF",
          "fontStyle": "italic",
        }
      },
      {
        "scope": [
          "variable.other.constant.ruby",
        ],
        "settings": {
          "foreground": "#FFCB6B",
        }
      },
    ]
  },
  "editor.minimap.enabled": true,
  "editor.minimap.autohide": true,
  "gitlens.codeLens.enabled": false,
  "gitlens.hovers.enabled": false,
  "rubyLsp.formatter": "rubocop",
  "[ruby]": {
    "editor.defaultFormatter": "Shopify.ruby-lsp",
  }
}
joshmfrankel commented 3 weeks ago

Cursor Editor - Keybindings

// Place your key bindings in this file to override the defaults
[
  {
    "key": "ctrl+shift+down",
    "command": "-editor.action.insertCursorBelow",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+down",
    "command": "editor.action.moveLinesDownAction",
    "when": "editorTextFocus && !editorReadonly"
  },
  {
    "key": "alt+down",
    "command": "-editor.action.moveLinesDownAction",
    "when": "editorTextFocus && !editorReadonly"
  },
  {
    "key": "ctrl+cmd+down",
    "command": "-editor.action.moveLinesDownAction",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+up",
    "command": "editor.action.moveLinesUpAction",
    "when": "editorTextFocus && !editorReadonly"
  },
  {
    "key": "alt+up",
    "command": "-editor.action.moveLinesUpAction",
    "when": "editorTextFocus && !editorReadonly"
  },
  {
    "key": "ctrl+shift+up",
    "command": "-editor.action.insertCursorAbove",
    "when": "editorTextFocus"
  },
  {
    "key": "cmd+q",
    "command": "-workbench.action.quit"
  },
  {
    "key": "cmd+k",
    "command": "aipopup.action.modal.generate",
    "when": "editorFocus && !composerBarIsVisible && !composerControlPanelIsVisible"
  },
  {
    "key": "cmd+k",
    "command": "-aipopup.action.modal.generate",
    "when": "editorFocus && !composerBarIsVisible && !composerControlPanelIsVisible"
  },
  {
    "key": "shift+cmd+k",
    "command": "-aipopup.action.modal.generate",
    "when": "editorFocus && !composerBarIsVisible && !composerControlPanelIsVisible"
  },
  {
    "key": "shift+cmd+f",
    "command": "-workbench.action.findInFiles"
  },
  {
    "key": "shift+cmd+f",
    "command": "-workbench.view.search",
    "when": "workbench.view.search.active && neverMatch =~ /doesNotMatch/"
  },
  {
    "key": "shift+cmd+f",
    "command": "workbench.action.findInFiles"
  },
  {
    "key": "shift+alt+r",
    "command": "extension.runLineOnRspec",
    "when": "editorLangId == 'ruby'"
  },
  {
    "key": "cmd+l",
    "command": "-extension.runLineOnRspec",
    "when": "editorLangId == 'ruby'"
  },
  {
    "key": "shift+alt+t",
    "command": "extension.runFileOnRspec",
    "when": "editorLangId == 'ruby'"
  },
  {
    "key": "alt+cmd+l",
    "command": "-extension.runFileOnRspec",
    "when": "editorLangId == 'ruby'"
  },
  {
    "key": "shift+alt+e",
    "command": "extension.runOnLastSpec",
    "when": "editorLangId == 'ruby'"
  },
  {
    "key": "cmd+y",
    "command": "-extension.runOnLastSpec",
    "when": "editorLangId == 'ruby'"
  },
  {
    "key": "shift+alt+w",
    "command": "extension.runOpenSpec",
    "when": "editorLangId == 'ruby'"
  },
  {
    "key": "alt+cmd+o",
    "command": "-extension.runOpenSpec",
    "when": "editorLangId == 'ruby'"
  },
  {
    "key": "shift+alt+2",
    "command": "workbench.action.editorLayoutTwoColumns"
  },
  {
    "key": "shift+alt+3",
    "command": "workbench.action.editorLayoutThreeColumns"
  },
  {
    "key": "shift+alt+1",
    "command": "workbench.action.editorLayoutSingle"
  },
  {
    "key": "shift+alt+4",
    "command": "workbench.action.editorLayoutTwoRows"
  },
  {
    "key": "shift+alt+5",
    "command": "workbench.action.editorLayoutTwoByTwoGrid"
  },
  {
    "key": "escape",
    "command": "workbench.action.closePanel"
  },
  {
    "key": "cmd+m",
    "command": "editor.action.jumpToBracket",
    "when": "editorFocus"
  },
  {
    "key": "ctrl+m",
    "command": "-editor.action.jumpToBracket",
    "when": "editorFocus"
  },
  {
    "key": "shift+cmd+w",
    "command": "-workbench.action.closeWindow"
  },
  {
    "key": "shift+cmd+w",
    "command": "workbench.action.closeOtherEditors"
  },
  {
    "key": "alt+cmd+t",
    "command": "-workbench.action.closeOtherEditors"
  }
]