Windows终端配置

环境: Windows 10

scoop (optional)

Scoop

1
2
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

管理员权限下安装

1
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"

neovim

安装

1
scoop install neovim

wezterm

下载安装

配置:

  1. KevinSilvester/wezterm-config
  2. QianSong1/wezterm-config

配置文件目录:C:\Users\[your user name]\.config\wezterm

主题:

catppuccin

快捷键导出:

1
echo $(wezterm show-keys) >> C:\\Users\\Administrator\\Desktop\\wez_keys.xls

powershell

  1. starship: Releases · starship/starship (github.com) 下载安装
  2. 安装 posh
1
2
Install-Module posh-git -Scope CurrentUser # posh-git
Install-Module oh-my-posh -Scope CurrentUser -RequiredVersion 2.0.496 # oh-my-posh
  1. 修改配置文件
1
nvim $Profile

添加以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Import-Module posh-git # 引入 posh-git
Import-Module oh-my-posh # 引入 oh-my-posh

Invoke-Expression (&starship init powershell) # 引入Starship

Set-PSReadLineOption -PredictionSource History # 设置预测文本来源为历史记录

Set-PSReadlineKeyHandler -Key Tab -Function Complete # 设置 Tab 键补全
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete # 设置 Ctrl+d 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置 Ctrl+z 为撤销
Set-PSReadLineKeyHandler -Key UpArrow -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::HistorySearchBackward()
[Microsoft.PowerShell.PSConsoleReadLine]::EndOfLine()
}
Set-PSReadLineKeyHandler -Key DownArrow -ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::HistorySearchForward()
[Microsoft.PowerShell.PSConsoleReadLine]::EndOfLine()
}

重启终端

1
2
3
4
5
6
7
Move-Item $env:LOCALAPPDATA\nvim $env:LOCALAPPDATA\nvim.bak

Move-Item $env:LOCALAPPDATA\nvim-data $env:LOCALAPPDATA\nvim-data.bak

git clone --depth 1 https://github.com/AstroNvim/AstroNvim $env:LOCALAPPDATA\nvim

nvim

用户配置文件,Windows 下配置目录为:C:\Users\Administrator\AppData\Local\nvim

Managing User Configuration | AstroNvim Docs

AstroNvim 配置

https://github.com/AstroNvim/astrocommunity

  1. C:\Users\Administrator\AppData\Local\nvim\.gitignore 注释掉 lua/user
  2. C:\Users\Administrator\AppData\Local\nvim\lua\user\plugins\community.lua 添加社区第三方包
  3. C:\Users\Administrator\AppData\Local\nvim\lua\user\init.lua 配置第三方包
1
2
3
4
5
6
7
8
9
10
11
return {
-- Add the community repository of plugin specifications
"AstroNvim/astrocommunity",
-- example of importing a plugin, comment out to use it or add your own
-- available plugins can be found at https://github.com/AstroNvim/astrocommunity

{ import = "astrocommunity.colorscheme.catppuccin" },
-- { import = "astrocommunity.completion.copilot-lua-cmp" },
{ import = "astrocommunity.utility.noice-nvim" },
{ import = "astrocommunity.completion.cmp-cmdline" },
}

开始界面配置

C:\Users\Administrator\AppData\Local\nvim\lua\user\plugins\core.lua 替换opts.section.header.val 字符串即可。

LSP

:LspInstall 需要的安装包。配置都再 user 文件下的 lua 脚本中。


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!