From 8ea60a6b30f0814129b71c3e9407316baf101c2c Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 12 Apr 2022 02:15:23 +0200 Subject: [PATCH] Add `vscode` settings. --- Rakefile | 1 + lib/defaults.rb | 4 ++-- lib/tasks/brew.rake | 1 + lib/tasks/terminal.rake | 7 ++++--- lib/tasks/vscode.rake | 35 +++++++++++++++++++++++++++++++++++ ~/.tm_properties | 2 +- 6 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 lib/tasks/vscode.rake diff --git a/Rakefile b/Rakefile index 9c3de0b..e954848 100644 --- a/Rakefile +++ b/Rakefile @@ -123,6 +123,7 @@ task :macos => [ :dnsmasq, :loginwindow, :textmate, + :vscode, :dock, :softwareupdate, :terminal, diff --git a/lib/defaults.rb b/lib/defaults.rb index a188440..7343d87 100644 --- a/lib/defaults.rb +++ b/lib/defaults.rb @@ -66,12 +66,12 @@ def color(r, g, b, a = 1) ) end - def font(name, size = 11.0) + def font(name, size:) wrap_data( { '$class' => { 'CF$UID' => 3 }, 'NSName' => { 'CF$UID' => 2 }, - 'NSSize' => size, + 'NSSize' => size.to_f, 'NSfFlags' => 16, }, name, diff --git a/lib/tasks/brew.rake b/lib/tasks/brew.rake index cb65959..809737e 100644 --- a/lib/tasks/brew.rake +++ b/lib/tasks/brew.rake @@ -212,6 +212,7 @@ namespace :brew do 'fluor' => {}, 'fork' => {}, 'font-meslo-lg-nerd-font' => {}, + 'font-sauce-code-pro-nerd-font' => {}, 'handbrake' => { flags: ["--appdir=#{converters_dir}"] }, 'hazel' => {}, 'hex-fiend' => {}, diff --git a/lib/tasks/terminal.rake b/lib/tasks/terminal.rake index 32dd472..1c75b5a 100644 --- a/lib/tasks/terminal.rake +++ b/lib/tasks/terminal.rake @@ -11,7 +11,8 @@ task :terminal do write 'Shell', '' write 'CopyAttributesProfile', '' - meslo = font('MesloLGSNerdFontComplete-Regular') + font_name = 'SauceCodeProNerdFontCompleteM-Regular' + font_size = 13 base03 = color(0, 43, 54) base02 = color(7, 54, 66) @@ -45,7 +46,7 @@ task :terminal do 'BackgroundColor' => color(253, 246, 227, 0.98), 'CursorColor' => base1, 'SelectionColor' => base02, - 'Font' => meslo, + 'Font' => font(font_name, size: font_size), 'TextColor' => base1, 'TextBoldColor' => base01, 'ANSIBlackColor' => base03, @@ -101,7 +102,7 @@ task :terminal do 'BackgroundColor' => color(0, 43, 54, 1), 'CursorColor' => base01, 'SelectionColor' => base02, - 'Font' => meslo, + 'Font' => font(font_name, size: font_size), 'TextColor' => base01, 'TextBoldColor' => base1, 'ANSIBlackColor' => base2, diff --git a/lib/tasks/vscode.rake b/lib/tasks/vscode.rake new file mode 100644 index 0000000..0abe15f --- /dev/null +++ b/lib/tasks/vscode.rake @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require 'json' + +task :vscode do + settings_path = Pathname('~/Library/Application Support/Code/User/settings.json').expand_path + + settings = settings_path.exist? ? JSON.parse(settings_path.read) : {} + + settings.merge!({ + 'trailing-spaces.trimOnSave' => true, + 'trailing-spaces.highlightCurrentLine' => false, + # FIXME: https://github.com/shardulm94/vscode-trailingspaces/issues/55 + # FIXME: https://github.com/shardulm94/vscode-trailingspaces/issues/56 + 'trailing-spaces.syntaxIgnore' => ['markdown'], + 'workbench.preferredLightColorTheme' => 'Solarized Light', + 'workbench.preferredDarkColorTheme' => 'Solarized Dark', + 'window.autoDetectColorScheme' => true, + 'editor.fontFamily' => 'SauceCodePro Nerd Font Mono', + 'editor.cursorWidth' => 1, + 'editor.tabSize' => 2, + 'editor.fontSize' => 13, + }) + + settings_path.write JSON.pretty_generate(settings) + + extensions = [ + 'EditorConfig.EditorConfig', + 'shardulm94.trailing-spaces', + ] + + extensions.each do |extension| + command 'code', '--install-extension', extension + end +end diff --git a/~/.tm_properties b/~/.tm_properties index 6642a01..42d432b 100644 --- a/~/.tm_properties +++ b/~/.tm_properties @@ -1,6 +1,6 @@ # This file was created automatically, do not edit it directly. -fontName = "Source Code Pro" +fontName = "SauceCodePro Nerd Font" fontSize = 13 wrapColumn = 0