+ Adding git to powershell and added highlight support for ps1

This commit is contained in:
ziro 2020-07-27 11:12:42 +07:00
parent 0bebd4b1bd
commit 1adb99be96
2 changed files with 28 additions and 2 deletions

View file

@ -1,6 +1,31 @@
function Prompt function Git-Status
{
"$([char]27)[31m"
if ((git status --porcelain -b 2>$1 | Select-String -Pattern 'M ') -notmatch 'fatal') {
"M"
}
if ((git status --porcelain -b 2>$1 | Select-String -Pattern '\? ') -notmatch 'fatal') {
"?"
}
}
function Git-Branch
{
" $([char]27)[35m " + (git branch --show-current)
}
function end_of_prompt
{ {
" "
$([char]27)[34;1m" + $env:COMPUTERNAME + "" + (Get-Location) + "
$([char]27)[32;1m$> $([char]27)[0m" $([char]27)[32;1m$> $([char]27)[0m"
} }
function prompt
{
if ((git log -n 1 2>$1) -notmatch 'fatal') {
"
$([char]27)[34;1m" + $env:COMPUTERNAME + "" + (Get-Location) + (Git-Branch) + (Git-Status) + (end_of_prompt)
}
else
{
"
$([char]27)[34;1m" + $env:COMPUTERNAME + "" + (Get-Location) + (end_of_prompt)
}
}

View file

@ -10,6 +10,7 @@ let $vimplug_bundle='~/.local/share/vim/bundle'
" ----- List of used plugins " ----- List of used plugins
call plug#begin($vimplug_bundle) call plug#begin($vimplug_bundle)
Plug 'PProvost/vim-ps1'
Plug 'deoplete-plugins/deoplete-jedi' Plug 'deoplete-plugins/deoplete-jedi'
Plug 'kovetskiy/sxhkd-vim' Plug 'kovetskiy/sxhkd-vim'
Plug 'lervag/vimtex' Plug 'lervag/vimtex'