Gadzan

我的Windows10下开发环境

安装 Windows terminal

首先安装 Windows terminal ,在 Microsoft store 里搜索 Windows terminal, 现在还是 preview 的版本

美化 PowerShell

打开 PowerShell 并输入以下命令安装 posh-git 和 oh-my-posh 这两个模块

Install-Module posh-git -Scope CurrentUser 
Install-Module oh-my-posh -Scope CurrentUser

优化ls命令的颜色,需要管理员权限运行

Install-Module Get-ChildItemColor

让 PowerShell 主题配置生效

新增(/或修改)你的 PowerShell 配置文件
如果之前没有配置文件,就新建一个 PowerShell 配置文件

if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }

用记事本打开配置文件

notepad $PROFILE

在其中添加下面的内容

Import-Module Get-ChildItemColor

$env:PYTHONIOENCODING="utf-8"
# Remove curl alias
If (Test-Path Alias:curl) {Remove-Item Alias:curl}
If (Test-Path Alias:curl) {Remove-Item Alias:curl}
# Remove-Item alias:ls -force
Set-Alias l Get-ChildItemColor -option AllScope
Set-Alias ls Get-ChildItemColorFormatWide -option AllScope

Import-Module posh-git 
Import-Module oh-my-posh 
Set-Theme Paradox

安装 choco

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

安装ConEmu

choco install ConEmu

安装Scoop

在 PowerShell 中输入下面内容,保证允许本地脚本的执行:
set-executionpolicy remotesigned -scope currentuser

然后执行下面的命令安装 Scoop:
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

静待脚本执行完成就可以了,安装成功后,执行下面命令查看帮助文档:
scoop help

添加加 Nerd font的仓库
scoop bucket add nerd-fonts
这里有 scoop 社区支持添加的仓库列表

如果没有git,会提示你顺便先安装git,按照提示安装就行。

安装字体

scoop install FantasqueSansMono-NF

修改 Windows Terminal 配置

点击 Windows Terminal 顶栏的下拉箭头按钮,选择Settings, 按需要修改成下面配置。

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",

    "profiles":
    [
        {
            // Make changes here to the powershell.exe profile
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name": "Windows PowerShell",
            "commandline": "powershell.exe",
            "hidden": false,
            "acrylicOpacity" : 0.5,
            "background" : "#000",
            "closeOnExit" : true,
            "colorScheme" : "Nord",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "FantasqueSansMono NF",
            "fontSize" : 10,
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "useAcrylic" : true
        },
        {
            // Make changes here to the cmd.exe profile
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name": "cmd",
            "commandline": "cmd.exe",
            "hidden": false,
            "acrylicOpacity" : 0.5,
            "background" : "#000",
            "closeOnExit" : true,
            "colorScheme" : "Campbell",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "FantasqueSansMono NF",
            "fontSize" : 10,
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "useAcrylic" : true
        },
        {
            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "hidden": false,
            "name": "Azure Cloud Shell",
            "source": "Windows.Terminal.Azure"
        }
    ],

    // Add custom color schemes to this array
    "schemes": [
           {
             "name": "Campbell",
             "foreground": "#F2F2F2",
             "background": "#0C0C0C",
             "colors": [
               "#0C0C0C",
               "#C50F1F",
               "#13A10E",
               "#C19C00",
               "#0037DA",
               "#881798",
               "#3A96DD",
               "#CCCCCC",
               "#767676",
               "#E74856",
               "#16C60C",
               "#F9F1A5",
               "#3B78FF",
               "#B4009E",
               "#61D6D6",
               "#F2F2F2"
             ]
           },
           {
             "name": "Solarized Dark",
             "foreground": "#FDF6E3",
             "background": "#073642",
             "colors": [
               "#073642",
               "#D30102",
               "#859900",
               "#B58900",
               "#268BD2",
               "#D33682",
               "#2AA198",
               "#EEE8D5",
               "#002B36",
               "#CB4B16",
               "#586E75",
               "#657B83",
               "#839496",
               "#6C71C4",
               "#93A1A1",
               "#FDF6E3"
             ]
           },
           {
             "name": "Solarized Light",
             "foreground": "#073642",
             "background": "#FDF6E3",
             "colors": [
               "#073642",
               "#D30102",
               "#859900",
               "#B58900",
               "#268BD2",
               "#D33682",
               "#2AA198",
               "#EEE8D5",
               "#002B36",
               "#CB4B16",
               "#586E75",
               "#657B83",
               "#839496",
               "#6C71C4",
               "#93A1A1",
               "#FDF6E3"
             ]
           },
           {
             "name": "Ubuntu",
             "foreground": "#EEEEEC",
             "background": "#2C001E",
             "colors": [
               "#EEEEEC",
               "#16C60C",
               "#729FCF",
               "#B58900",
               "#268BD2",
               "#D33682",
               "#2AA198",
               "#EEE8D5",
               "#002B36",
               "#CB4B16",
               "#586E75",
               "#657B83",
               "#839496",
               "#6C71C4",
               "#93A1A1",
               "#FDF6E3"
             ]
           },
           {
             "name": "UbuntuLegit",
             "foreground": "#EEEEEE",
             "background": "#2C001E",
             "colors": [
               "#4E9A06",
               "#CC0000",
               "#300A24",
               "#C4A000",
               "#3465A4",
               "#75507B",
               "#06989A",
               "#D3D7CF",
               "#555753",
               "#EF2929",
               "#8AE234",
               "#FCE94F",
               "#729FCF",
               "#AD7FA8",
               "#34E2E2",
               "#EEEEEE"
             ]
           },
           {
            "name": "Nord",
            "background": "#2e3440",
            "foreground": "#eceff4",
            "brightBlack": "#2e3440",
            "brightBlue": "#5e81ac",
            "brightCyan": "#8fbcbb",
            "brightGreen": "#a3be8c",
            "brightPurple": "#b48ead",
            "brightRed": "#bf616a",
            "brightWhite": "#eceff4",
            "brightYellow": "#ebcb8b",
            "black": "#2e3440",
            "blue": "#5e81ac",
            "cyan": "#8fbcbb",
            "green": "#a3be8c",
            "purple": "#b48ead",
            "red": "#bf616a",
            "white": "#eceff4",
            "yellow": "#ebcb8b"
          }
        ],
    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings": []
}

修改后保存即可看见效果。

添加自定义主题

在 powershell 中输入:
$Themesettings
会输出下面信息:

PromptSymbols        : {UNCSymbol, HomeSymbol, ElevatedSymbol, SegmentSeparatorForwardSymbol...}
CurrentUser          : Administrator
CurrentThemeLocation : C:\Users\Administrator\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.379\Themes\Paradox.psm                        1
Colors               : {AdminIconForegroundColor, PromptBackgroundColor, PromptHighlightColor, GitLocalChangesColor...} GitSymbols           : {OriginSymbols, LocalWorkingStatusSymbol, LocalDefaultStatusSymbol, BranchUntrackedSymbol...}    Options              : {ConsoleTitle, OriginSymbols}
ErrorCount           : 1
MyThemesLocation     : C:\Users\Administrator\Documents\WindowsPowerShell\PoshThemes

CurrentThemeLocation 即是现在主题的地址,在该目录下
C:\Users\Administrator\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.379\Themes\新建一个文件SpencerTechy.psm1
填入一下内容

#requires -Version 2 -Modules posh-git

function Write-Theme {
    param(
        [bool]
        $lastCommandFailed,
        [string]
        $with
    )

    $lastColor = $sl.Colors.PromptBackgroundColor
    $prompt += Write-Prompt -Object "╭" -ForegroundColor $sl.Colors.PromptIndicatorForegroundColor1

    $prompt = Write-Prompt -Object " $($sl.PromptSymbols.StartSymbol) " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptUserBackgroundColor
    $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.PromptIndicatorForegroundColor3 -BackgroundColor $sl.Colors.PromptUserBackgroundColor
    #check for elevated prompt
    If (Test-Administrator) {
        $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol)" -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.PromptUserBackgroundColor
    }


    $user = [System.Environment]::UserName
    $computer = [System.Environment]::MachineName
    $path = Get-ShortPath -dir $pwd
    if (Test-NotDefaultUser($user)) {
        $prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptUserBackgroundColor
    }

    if (Test-VirtualEnv) {
        $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol)" -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor
        $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -ForegroundColor $sl.Colors.VirtualEnvForegroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor
        $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol)" -ForegroundColor $sl.Colors.VirtualEnvBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor
    }
    else {
        $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol)" -ForegroundColor $sl.Colors.PromptUserBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor
    }

    # Writes the drive portion
    $prompt += Write-Prompt -Object " $path " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor

    $status = Get-VCSStatus
    if ($status) {
        $themeInfo = Get-VcsInfo -status ($status)
        $lastColor = $themeInfo.BackgroundColor
        $prompt += Write-Prompt -Object $($sl.PromptSymbols.SegmentForwardSymbol) -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $lastColor
        $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -BackgroundColor $lastColor -ForegroundColor $sl.Colors.GitForegroundColor
    }

    # Writes the postfix to the prompt
    $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor

    #check the last command state and indicate if failed
    If ($lastCommandFailed) {
        $prompt += Write-Prompt -Object " $($sl.PromptSymbols.FailedCommandSymbol)" -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
    } else {
        $prompt += Write-Prompt -Object " $($sl.PromptSymbols.SuccessCommandSymbol)" -ForegroundColor $sl.Colors.CommandSuccessIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
    }

    # $timeStamp = Get-Date -UFormat %T
    # $timestamp = " $timeStamp "

    # $prompt += Set-CursorForRightBlockWrite -textLength ($timestamp.Length + $sl.PromptSymbols.TimeSymbol.Length + $sl.PromptSymbols.SegmentBackwardSymbol.Length + $sl.PromptSymbols.SegmentForwardSymbol.Length + 1)
    # $prompt += Write-Prompt $sl.PromptSymbols.SegmentBackwardSymbol -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
    # $prompt += Write-Prompt $sl.PromptSymbols.TimeSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor
    # $prompt += Write-Prompt $timeStamp -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor
    # $prompt += Write-Prompt $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor

    $prompt += Set-Newline

    if ($with) {
        $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor
    }

    $prompt += Write-Prompt -Object "╰" -ForegroundColor $sl.Colors.PromptIndicatorForegroundColor1
    $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.PromptIndicatorForegroundColor1
    $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.PromptIndicatorForegroundColor2
    $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.PromptIndicatorForegroundColor3
    $prompt += ' '
    $prompt
}

$sl = $global:ThemeSettings #local settings
$sl.PromptSymbols.StartSymbol = [char]::ConvertFromUtf32(0xe70c)
$sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F)
$sl.PromptSymbols.SegmentForwardSymbol = "" # [char]::ConvertFromUtf32(0xE0B0) #(0xE0B4)
$sl.PromptSymbols.SegmentBackwardSymbol = [char]::ConvertFromUtf32(0xE0B2)
$sl.PromptSymbols.TimeSymbol = ' ' + [char]::ConvertFromUtf32(0x235F)
$sl.PromptSymbols.FailedCommandSymbol = [char]::ConvertFromUtf32(0x2718)
$sl.PromptSymbols.SuccessCommandSymbol = [char]::ConvertFromUtf32(0x2714)
$sl.Colors.PromptForegroundColor = [ConsoleColor]::White
$sl.Colors.PromptBackgroundColor = [ConsoleColor]::DarkBlue
$sl.Colors.PromptSymbolColor = [ConsoleColor]::White
$sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue
$sl.Colors.GitForegroundColor = [ConsoleColor]::Black
$sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed
$sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkMagenta
$sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::DarkRed
$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White
$sl.Colors.CommandSuccessIconForegroundColor = [System.ConsoleColor]::DarkGreen
$sl.Colors.CommandFailedIconForegroundColor = [System.ConsoleColor]::DarkRed
$sl.Colors.PromptIndicatorForegroundColor1 = [ConsoleColor]::DarkBlue
$sl.Colors.PromptIndicatorForegroundColor2 = [ConsoleColor]::DarkYellow
$sl.Colors.PromptIndicatorForegroundColor3 = [ConsoleColor]::DarkMagenta
$sl.Colors.PromptUserBackgroundColor = [ConsoleColor]::Black

或者在这个地址下载

保存后,在 PowerShell 中输入notepad $PROFILE

修改最后一行的
Set-Theme Paradox改为Set-Theme SpencerTechy,保存

安装 mobaXterm

Windows 下的 SSH 工具
官网下载安装

下载个人用的免费版本即可,在 Settings -> SSH -> SSH Settings 把 SSH keepalive 勾上。

安装 VScode

官网下载安装

设置

设置默认显示空格和tab符号
打开VScode,左上角 文件 -> 首选项 -> 设置,搜索栏里搜索关键字whitespace 在Editor: Render Whitespace里选择all

安装插件

  1. indent-rainbow 让空格加上颜色,看上去更容易对齐;
    indent-rainbow

  2. Bracket Pair Colorizer 用于着色匹配括号;
    Bracket Pair Colorizer

  3. GitLens git日志查看插件
    GitLens

  4. vscode-icons 目录图标
    vscode-icons

  5. Atuo Rename Tag 修改 html 标签,自动帮你完成头部和尾部闭合标签的同步修改;
    Atuo Rename Tag

  6. beautify 格式化代码工具

美化javascript,JSON,CSS,Sass,和HTML在Visual Studio代码。

  1. vetur vue代码高亮插件
  2. ESLint Javascript代码规范工具
  3. Vue VSCode Snippets 前端框架Vue.js快捷代码助手
    Vue VSCode Snippets
  4. Live Server 一个可热加载的页面开发服务器
    Live Server
  5. Markdown All in One Markdown的加强插件,支持快捷键、表格、自刷新预览
  6. Markdown Preview Mermaid Support 让Markdown支持插入 Mermaid 流程图 和预览。
    Markdown Preview Mermaid Support

安装 VScode 主题

Dracula Official
Dracula Official

安装 Edge

最新的Edge是基于Chromium的,所以支持直接安装Chrome的插件,官网下载安装

插件

  1. Proxy SwitchyOmega 网络调试代理插件
  2. Talend API Tester - Free Edition Restful API调试工具
  3. Postwoman Extension for Chrome Postwoman API调试工具,Demo页可以直接作为PWA使用,调试http页面需要使用自带的代理,Github
  4. Charset 改变页面的编码,Google Chrome在55版本以后删除了手动设置网站编码的功能。但是在部分设置不规范不正确的网站,新版浏览器无法准确判断其使用的编码,导致网站显示乱码。

评论