Giter VIP home page Giter VIP logo

pure-pwsh's People

Contributors

chinanf-boy avatar insign avatar musm avatar nickcox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pure-pwsh's Issues

virtual environtment is displayed twice

I copy-pasted this straight from the README

Import-Module pure-pwsh
Import-Module posh-git

$pure.PrePrompt = {
    param ($user, $cwd, $git, $slow)
    "`n$user{1}{0}$cwd $git $slow `n" -f
    ($user ? ' ' : ''),
    (($ve = $env:virtual_env) ? "$($pure._branchcolor)($(Split-Path -Leaf $ve)) " : "" )
}

And here's my prompt:

(venv)
(venv) ~\programming\python\some_project_with_venv main*

I tried to figure this out myself but the PowerShell syntax is really difficult for me to parse and I couldn't tell what needed changing.

How to integrate prompt hooks

I'd like to do something like this

$PrePrompt = {if ($Env:CONDA_DEFAULT_ENV -ne "base") {
        "($Env:CONDA_DEFAULT_ENV) "
    } else { }}


$pure.PrePrompt = {param ($cwd, $git, $slow) "$($myColors.DeepSkyBlue3)$([Environment]::UserName) $cwd $git`n$PrePrompt"}

Customization question

$pure.PrePrompt= {param ($cwd, $git, $slow) "$([Environment]::UserName) $cwd $git $slow"}

How would I go about colors my username with the same color used for cwd ?

Additionally how would I go about customizing other default colors

prompt adds a new line after initialization

When starting powershell or pwsh with this prompt it ends up adding a new line at initialization.

I.e.

$ pwsh -NoLogo

<pure prompt> # additional new line is inserted above
$ pwsh -NoLogo
<normal prompt> # no new line above

Making the default settings closer to stock Pure

I think it would make sense for this port to use the same settings as stock Pure for consistency. This way, users switching between zsh and PowerShell can benefit from the same appearance out of the box (I use PowerShell Core on Linux occasionally).

For the record, I use those settings to make pure-pwsh look closer to stock Pure:

$esc = [char]27
$pure.PwdColor = "$esc[34m"
$pure.BranchColor = "$esc[90m"
$pure.RemoteColor = "$esc[36m"
$pure.PromptColor = "$esc[35m"

zsh_pwsh_pure

Garbled prompt when using pure-pwsh via SSH

I'm hosting an OpenSSH server using the official Microsoft-supplied port on Windows 10 build 17134. When I connect to it from my Linux PC and start PowerShell, the prompt is garbled (but the rest is fine); I tried both kitty and Konsole to rule out a terminal-specific issue.

This does not occur in cmd.exe or PowerShell with the default prompt. See below for an example (look how the prompt is moved to the right):

image

Hooks for the shortening cwd

Say I want to shorten very long paths with a function

function ShortenPath([string] $path) {
    $loc = $path.Replace($HOME, '~')
    # remove prefix for UNC paths
    $loc = $loc -replace '^[^:]+::', ''
    # make path shorter like tabs in Vim,
    # handle paths starting with \\ and . correctly
    return ($loc -replace '\\(\.?)([^\\])[^\\]*(?=\\)', '\$1$2')
}

how would I go about adding this in this prompt?

v1 Release

  • Update docs
    • PS 7 requirement
    • Describe status of Mac/Linux
  • Gracefully handle case where git not on path
  • Display username and host over SSH

after running a git pull I get a broken prompt

Hi! thanks for the great work! I love pure and glad to see a version for powershell.

I have an issue at the moment, when I run a git checkout <branch> or git pull that works I get a prompt with a ? instead of the .

It also replicates the last command there, then immediately draws a new prompt. Then my next command fails because it tries to combine it with the reprinted command.

Here is example output:

E:\repos\virtuoso develop ⇣
❯ git pull
Updating 76e0a5f..f18bf0e
Fast-forward
 app/pods/application/template.hbs                  |   9 +-
 .../application-current-user/template.hbs          |  10 +-
 app/pods/components/application-nav/template.hbs   |  34 +++--
 .../components/application-search/template.hbs     |  18 +--
 .../components/display-flash-messages/template.hbs |   4 +-
 app/templates/head.hbs                             |   2 +-
 package.json                                       |   3 +-

E:\repos\virtuoso develop
? git pull

E:\repos\virtuoso develop  (3.05s)
❯ git pull
fatal: Cannot rebase onto multiple branches.

E:\repos\virtuoso develop  (2.51s)
❯ git status
On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

E:\repos\virtuoso develop
❯ git pull
Already up to date.
Current branch develop is up to date.

My profile is this:

if ($host.Name -eq 'ConsoleHost')
{
    Import-Module PSReadLine
}

Remove-PSReadlineKeyHandler 'CTRL+R'
Import-Module PSFzf

Import-Module -Name E:\repos\pure-pwsh\pure-pwsh\pure-pwsh.psd1
Import-Module posh-git
#Import-Module oh-my-posh
#Set-Theme agnoster

new-item -path Env:. -name FZF_DEFAULT_COMMAND -value "rg --files . 2> nul"
new-item -path Env:. -name EDITOR -value "atom"
New-Alias vim nvim
New-Alias which get-command

Import-Module "C:\ProgramData\chocolatey\lib\ripgrep\tools\_rg.ps1"

#function Get-GitStatus { & git status $args }
#New-Alias -Name gst -Value Get-GitStatus -Force -Option AllScope
#function Get-GitCommit { & git commit -ev $args }
#New-Alias -Name gc -Value Get-GitCommit -Force -Option AllScope
function Get-GitAdd { & git add --all $args }
New-Alias -Name ga -Value Get-GitAdd -Force -Option AllScope
function Get-GitTree { & git lg }
New-Alias -Name lg -Value Get-GitTree -Force -Option AllScope
function Get-GitCheckout { & git checkout $args }
New-Alias -Name gco -Value Get-GitCheckout -Force -Option AllScope
function Get-GitBranch { & git branch $args }
New-Alias -Name gb -Value Get-GitBranch -Force -Option AllScope
function Get-GitDiff { & git diff $args }
New-Alias -Name gd -Value Get-GitDiff -Force -Option AllScope
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
  Import-Module "$ChocolateyProfile"
}

$DefaultUser = 'invad'

# Host Foreground
$Host.PrivateData.ErrorForegroundColor = 'Red'
$Host.PrivateData.WarningForegroundColor = 'Yellow'
$Host.PrivateData.DebugForegroundColor = 'Green'
$Host.PrivateData.VerboseForegroundColor = 'Blue'
$Host.PrivateData.ProgressForegroundColor = 'Gray'

# Host Background
$Host.PrivateData.ErrorBackgroundColor = 'DarkGray'
$Host.PrivateData.WarningBackgroundColor = 'DarkGray'
$Host.PrivateData.DebugBackgroundColor = 'DarkGray'
$Host.PrivateData.VerboseBackgroundColor = 'DarkGray'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.