powershell profile

发布时间 2023-07-04 18:13:32作者: hellozhangjz
function welcome {
  echo " 
     _          _ _                         _   _                  __       _             
    | |        | | |                       | | | |                / _|     | |            
    | |__   ___| | | ___    _ __ __    ___ | |_| |__   ___ _ __  | |_ _   _| | _____ _ __ 
    | '_ \ / _ \ | |/ _ \  | '_ `  _\  / _ \| __| '_ \ / _ \ '__| |  _| | | | |/ / _ \ '__|
    | | | |  __/ | | (_) | | | | | | | (_) | |_| | | |  __/ |    | | | |_| |   <  __/ |   
    |_| |_|\___|_|_|\___/  |_| |_| |_|\___/ \__|_| |_|\___|_|    |_|  \__,_|_|\_\___|_|   
                                                                                          
  "                                                                                      
}

#只显示当前文件夹名称
function prompt {
  $p = pwd|Split-Path -Leaf
  "$p :" 
}
#prompt end


#conda配置
(& "C:\Users\hello\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression

#conda activate 别名
function ca ([String]$env_name="base"){
  conda activate $env_name
}

function cad {
  conda deactivate
}

function jb {
  jupyter notebook
}
#conda end

#设置清屏
# remove-item alias:cls
# function cls {
#   clear-host
#   welcome
# }

# remove-item alias:clear
# function clear {
#   clear-host
#   welcome
# }

# Set-PSReadLineKeyHandler -Chord Ctrl+l -ScriptBlock {
#     [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
#     [Microsoft.PowerShell.PSConsoleReadLine]::Insert('clear')
#     [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
# }
#清屏end


#快速打开 profile
function profile {
  code $profile
}
#profile end

#用Select-String实现linux的grep
remove-item alias:ls
function ls {
  Get-ChildItem | out-string -stream
}

set-alias -name grep -value select-string
#set grep end

# 快速打开桌面
function cdd {
  cd ~/Desktop
}
# desktop end


welcome