GithubHelp home page GithubHelp logo

gardebring / powercolorls Goto Github PK

View Code? Open in Web Editor NEW
60.0 3.0 3.0 794 KB

PowerShell script to display a colorized directory and file listing with icons

License: MIT License

PowerShell 100.00%
color icons ls terminal dir cli command-line command-line-tool powershell powershell-module

powercolorls's People

Contributors

gardebring 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

Watchers

 avatar  avatar  avatar

powercolorls's Issues

Which font?

Which font at Nerd Fonts do I install? There are dozens.

For some cases, icons are not displayed

Hi! 😃

For some reason, in some cases, icons in folders are not displayed.

I am using PowerColorLS version 1.0.2 and terminal-icons version 0.5.1

I'm using PowerShell 7.2.0-preview.6

Here is my powershell profile file with the settings:

# $global:DefaultUser = [System.Environment]::UserName
$env:POSH_SESSION_DEFAULT_USER = [System.Environment]::UserName

Import-Module posh-git

Import-Module oh-my-posh

Set-PoshPrompt -Theme ~/.oh-my-posh.omp.json

Import-Module PSReadLine

Import-Module Terminal-Icons

Import-Module PowerColorLS

# Shows navigable menu of all options when hitting Tab
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete

# Autocompleteion for Arrow keys
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward

Set-PSReadLineOption -ShowToolTips
Set-PSReadLineOption -PredictionSource History

#Set the color for Prediction (auto-suggestion)
Set-PSReadlineOption -Colors @{Prediction = "#0bda51" }

Set-PSReadLineOption -Colors @{
  Command            = '#00ff00'
  Number             = '#0ee7ff'
  Member             = '#ffff00'
  Operator           = '#08e8de'
  Type               = '#c72fff'
  Variable           = '#c0ff2f'
  Parameter          = '#fde910'
  ContinuationPrompt = 'DarkGray'
  Default            = '#30d5c8'
}

# Import-Module Get-ChildItemColor

function PowerColorLSWithParams([string] $query = ".") {
  PowerColorLS $query -l -ds -sd -a
}

Set-Alias -Name ls -Value PowerColorLSWithParams -Option AllScope
Set-Alias -Name which -Value Get-Command
# If (-Not (Test-Path Variable:PSise)) {
#   # Only run this in the console and not in the ISE
#   Import-Module Get-ChildItemColor

#   Set-Alias l Get-ChildItem -option AllScope
#   Set-Alias ls Get-ChildItemColorFormatWide -option AllScope
# }

# Import-Module PoshColor

Import-Module z

WindowsTerminal_m5ZBuGI2QC
WindowsTerminal_Xi9MBcSqxI

Ignore symlinks when calculating directory sizes

I noticed it's showing ~2x the size of a particular folder when compared to the Explorer's Properties dialog. Upon inspecting, I found out that the folder contained symlinks to some other folders.

The --show-directory-sizes flag should ideally ignore symlinked (soft linked) folders and should not recurse into them to add their size to the output.

Symbolic linked files are not listed when by PowerColorLS

Script I used for testing:

mkdir test_folder
echo "some test text" >> test_file.txt
cd test_folder
New-Item -Name the_link -ItemType SymbolicLink -Value ../test_file.txt
PowerColorLS
Get-ChildItem

Calling PowerColorLS doesn't output anything:
image

Get-ChildItem output:
image

Modules and versions:
image

Using:

  • Theme = honukai
  • microsoft-windows-terminal 1.10.2714.0
  • PowerShell 5
  • Windows 10

Add an (optional) flag to disable icons

Hi!

It's so nice that PowerColorLS provides so many flags for output. Is it possible to have a flag to display the items with colors but without icons? Some terminals don't have icon support and I currently use https://github.com/JRJurman/PowerLS to have unix-like ls there.

It'd be great if I just install one module instead of two.

Thanks!

How to configure alias for the PowerColorLS command with options?

Hi!

Thank you for your wonderful script!

Please tell me how to configure alias for the PowerColorLS command with options:

-l -ds -sd -a?

In other words, I want the command "ls" to be a replacement for such a command:

ls -l -ds -sd -a

I have tried to investigate this issue and the only thing I have understood is that there is no way to pass the parameters of the cmdlet into the alias. To execute an alias with parameters, you need to use a function to do this.

But I don't understand how to write such a function for my case, because I'm completely unfamiliar with the language Powershell.

Help me, please.

Import-Module failed at $glyphs["nf-fa-check"]

The script fails at line 119 char 30, which is $gitGlyph = $glyphs["nf-fa-check"]
I DID install Terminal-Icons and it WORKS pretty fine

Import-Module : 所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerColorLS\1.0.4\Private\GitFunctions.ps1:119 字
符: 30
+         $gitGlyph = $glyphs["nf-fa-check"]
+                              ~~~~~~~~~~~~~
表达式或语句中包含意外的标记“nf-fa-check"]
    }
    $gitColor = (ConvertFrom-RGBColor -RGB ("00FF00"))
    foreach($gitStatusItem in $gitInfo.gitStatusItems){
        $updateGitStatus = $false
        $currentItemForGitCompare = $fileSystemInfo.FullName -Replace "\\", "/"
        if($currentItemForGitCompare -eq $gitStatusItem.path){
            $updateGitStatus = $true
        }elseif($isFolder -and ($gitStatusItem.path.StartsWith($currentItemForGitCompare,'CurrentCultureIgnoreCase'))){
            $updateGitStatus = $true
        }
        if($updateGitStatus){
            switch($gitStatusItem.status){
                "??" {
                    if($hideIcons){
                        $gitGlyph = "?";
                    }else{
                        $gitGlyph = $glyphs["nf-fa-question"]
                    }
                    $gitColor = (ConvertFrom-RGBColor -RGB ("FF0000"))
                }
                default{
                    $gitGlyph = $gitStatusItem.status
                    $gitColor = (ConvertFrom-RGBColor -RGB ("FFFF00"))
                }
            }
        }
    }
    $gitColorAndIcon = "${gitColor}${gitGlyph}”。
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerColorLS\1.0.4\Private\GitFunctions.ps1:149 字符: 48
+     $gitColorAndIcon = "${gitColor}${gitGlyph} "
+                                                ~
字符串缺少终止符: "
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerColorLS\1.0.4\Private\GitFunctions.ps1:116 字符: 19
+     if($hideIcons){
+                   ~
语句块或类型定义中缺少右“}”。
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerColorLS\1.0.4\Private\GitFunctions.ps1:97 字符: 29
+ function Get-GitColorAndIcon{
+                             ~
语句块或类型定义中缺少右“}”。
所在位置 行:1 字符: 1
+ Import-Module PowerColorLS
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Import-Module], ParseException
    + FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.ImportModuleCommand

Updated As mentioned in Pull Request #15 , change encoding of GitFunctions.ps1 from UTF-8 to GBK/GB2312 (system's default encoding)

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.