windows 终端解决方案 windows terminal
程序员文章站
2024-03-15 22:56:54
...
提起 windows 下的终端,大家可能都会想到巨难看的 CMD
或者稍好一些的 PowerShell
作为一个常年使用 windows 系统开发的前端,做梦都想要有一个类似 Mac 或者 Linux 命令行的终端,直到我看到了 windows terminal
先放图,相比前两者,高端大气上档次有没有,命令支持也非常丰富
windows terminal
windows terminal 是微软开源的一个终端解决方案,在微软应用商店就可以下载安装
系统要求 windows 10 的 18362.0 版本以上
下载后打开应用,界面还是巨难看,不过 windows terminal 的界面都是可以自定义配置的
打开配置文件,目前还不支持界面配置,所以会看到一个 json文件
配置我们常用的 powershell 界面,下面的 schemes 可以添加主题
在 iterm 的主题列表里选择自己喜欢的主题,然后搜索对应的 JSON 配置
将配置粘贴到 schemes 数组中,修改 profiles 中 powershell 的属性 colorScheme 为你的主题名即可,更多配置详情参考文档
例如我的配置如下
// 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": "PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"acrylicOpacity": 0.75,
"useAcrylic": true,
"colorScheme": "Gruvbox Dark"
},
{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false
},
{
"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": "Cobalt Neon",
"black": "#142631",
"red": "#ff2320",
"green": "#3ba5ff",
"yellow": "#e9e75c",
"blue": "#8ff586",
"purple": "#781aa0",
"cyan": "#8ff586",
"white": "#ba46b2",
"brightBlack": "#fff688",
"brightRed": "#d4312e",
"brightGreen": "#8ff586",
"brightYellow": "#e9f06d",
"brightBlue": "#3c7dd2",
"brightPurple": "#8230a7",
"brightCyan": "#6cbc67",
"brightWhite": "#8ff586",
"background": "#142838",
"foreground": "#8ff586"
},
{
"name": "Violet Light",
"black": "#56595c",
"red": "#c94c22",
"green": "#85981c",
"yellow": "#b4881d",
"blue": "#2e8bce",
"purple": "#d13a82",
"cyan": "#32a198",
"white": "#d3d0c9",
"brightBlack": "#45484b",
"brightRed": "#bd3613",
"brightGreen": "#738a04",
"brightYellow": "#a57705",
"brightBlue": "#2176c7",
"brightPurple": "#c61c6f",
"brightCyan": "#259286",
"brightWhite": "#c9c6bd",
"background": "#fcf4dc",
"foreground": "#536870"
},
{
"name": "Gruvbox Dark",
"black": "#1e1e1e",
"red": "#be0f17",
"green": "#868715",
"yellow": "#cc881a",
"blue": "#377375",
"purple": "#a04b73",
"cyan": "#578e57",
"white": "#978771",
"brightBlack": "#7f7061",
"brightRed": "#f73028",
"brightGreen": "#aab01e",
"brightYellow": "#f7b125",
"brightBlue": "#719586",
"brightPurple": "#c77089",
"brightCyan": "#7db669",
"brightWhite": "#e6d4a3",
"background": "#1e1e1e",
"foreground": "#e6d4a3"
}
],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": [
{
"command": "copy",
"keys": ["ctrl+shift+c"]
},
{
"command": "paste",
"keys": ["ctrl+shift+v"]
},
{
"command": "closeTab",
"keys": ["ctrl+w"]
},
{
"command": "scrollDown",
"keys": ["ctrl+j"]
},
{
"command": "scrollUp",
"keys": ["ctrl+k"]
},
{
"command": "scrollDownPage",
"keys": ["ctrl+shift+j"]
},
{
"command": "scrollUpPage",
"keys": ["ctrl+shift+k"]
},
{
"command": "prevTab",
"keys": ["ctrl+left"]
},
{
"command": "nextTab",
"keys": ["ctrl+right"]
}
]
}
全部的配置列表参考:配置列表
快捷键配置,*
用数字代替
名称 | 说明 |
---|---|
newTab | 以第一个命令行配置打开新的标签页 |
newTabProfile* | 以第 * 个命令行配置打开新的标签页 |
closeTab | 关闭当前标签页 |
prevTab | 显示上一个标签页 |
nextTab | 显示下一个标签页 |
scrollUp | 向上滚动一行 |
scrollUpPage | 向上滚动一页 |
scrollDown | 向下滚动一行 |
scrollDownPage | 向下滚动一页 |
switchToTab* | 显示第 * 个标签页 |
这里就已经配置完成了,然后我们配置一下 powershell 的功能
Powershell 配置
vim
使用 vim 需要安装 Git,然后继续下面的操作
- 打开Git安装目录,“C:/Program Files/Git/usr/bin/vim.exe”
- 打开windows Powershell的位置:“C:/Windows/System32/WindowsPowerShell/v1.0”, 在此路径下添加一个名为profile.ps1的文件,输入文本
# There's usually much more than this in my profile!
$SCRIPTPATH = "C:\Program Files\Git\usr\share\vim" # 此行根据$VIMPATH寻找相应vim路径即可
$VIMPATH = "C:\Program Files\Git\usr\bin\vim.exe" # 此行为1中vim.exe路径
Set-Alias vi $VIMPATH
Set-Alias vim $VIMPATH
# for editing your PowerShell profile
Function Edit-Profile
{
vim $profile
}
# for editing your Vim settings
Function Edit-Vimrc
{
vim $home\_vimrc
}
- 管理员运行 powershell,执行下面的命令
$ Set-ExecutionPolicy RemoteSigned
然后就可以使用 vim 了
上一篇: Given a string s, find the longest palindromic substring in s. You may assume that the maximum lengt
推荐阅读
-
windows 终端解决方案 windows terminal
-
美化Windows PowerShell以及Fluent Terminal配置Posh-git、Oh-my-posh、DirColors方法
-
Windows中MySQL root用户忘记密码解决方案
-
Windows中MySQL root用户忘记密码解决方案
-
windows cmd/linux terminal/git bash设置代理
-
解决windows 2003 Sql2000中OLEDB分布式事务无法启动的解决方案_MySQL
-
Windows 10被曝在桌面上生成神秘文件 解决方案来了
-
比较全windows 没有声音的解决方案
-
有关在Windows下配置PHP Apache Optimizer失败的问题解决方案_PHP
-
WINDOWS服务器安装多套PHP的另类解决方案_PHP