Giter Club home page Giter Club logo

k's People

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

k's Issues

Listing of the filetype, perhaps using `file`

Something I've wanted out of ls for a very, very long time, is display of the file-invocation results for each file.

For instance:

> file -bz ~/Downloads/*
PDF document, version 1.4
JPEG image data, JFIF standard 1.02, aspect ratio, density 1x1, segment length 16, progressive, precision 8, 1536x2048, frames 3
PDF document, version 1.6
directory
Zip archive data, at least v1.0 to extract
VAX COFF executable not stripped
VAX COFF executable not stripped
Zip archive data, at least v2.0 to extract
zlib compressed data
WebM
PDF document, version 1.4
Microsoft PowerPoint 2007+

This invocation was blazing-fast on my machine; it seems very reasonable to include this information in k, especially if it's behind an option? (file can be instructed to spit out only the mime-types with --mime-type; this might be the best output format for a columnar-display like k.)

Weird stuff getting dumped out

 19:05:41  dan.kaplun@localhost:~/asdf 
$ k
total 0
bar  foo
workon_cwd:2: scalar parameter WORKON_CWD created globally in function
workon_cwd:4: scalar parameter PROJECT_ROOT created globally in function
-rw-r--r-- 1 dan.kaplun staff 0 27 Apr   19:05   bar
bar  foo
workon_cwd:2: scalar parameter WORKON_CWD created globally in function
workon_cwd:4: scalar parameter PROJECT_ROOT created globally in function
-rw-r--r-- 1 dan.kaplun staff 0 27 Apr   19:05   foo

OSX: "'numfmt' command not found, human readable output will not work"

As mentioned in #21, numfmt is not available in OSX, so when running k -h I get:

'numfmt' command not found, human readable output will not work.
    Falling back to normal file size output

BUT numfmt is included in coreutils which I think I got from Homebrew originally (brew install coreutils?). The caveat is that it is named gnumfmt.

Would it be possible for k to look for gnumfmt if numfmt is not available? Or is it just down to me somehow telling my machine where to find it?

I tried alias numfmt='gnumfmt', but that didn't work - I'm guessing because k doesn't have access to that alias?

CC @chrstphrknwtn @sattellite

add support for light shell/terminal themes

I'm using papercolor (light theme) on iTerm2 and have just installed k. It seems that k doesn't play nice with light themes.

I'm using OSx with coreutils installed so my ls command should behave as in GNU/Linux.

my full shell config can be seen here.
k-on-light-theme

stat: can not read file system information

stat: cannot read file system information for ‘%b~#~%Sp~|~%l~|~%Su~|~%Sg~|~%Z~|~%Sm~|~%N~|~%Y’: No such file or directory
stat: cannot read file system information for ‘%s^%d^%b^%H:%M^%Y’: No such file or directory
k:37: bad floating point constant

I see this on F20 and Ubuntu 13.10. I'm very much a new zsh user so perhaps I am missing some config or dependency?

awk: can't open file STAT_RESULTS

I got an error, and directories weren't displayed.

in ~github/creasty/dotfiles on master *+
❯ k
awk: can't open file STAT_RESULTS
 source line number 1
total 32
-rwxr-xr-x  1 ykiwng staff 4389  8  7    19:18 | Brewfile
-rw-r--r--  1 ykiwng staff  685 30  5    19:45 | README.md
drwxr-xr-x  9 ykiwng staff  306 16 11     2014 |
drwxr-xr-x  5 ykiwng staff  170  2  6    21:51 |
drwxr-xr-x  5 ykiwng staff  170 31  5    22:41 |
drwxr-xr-x 34 ykiwng staff 1156  8  7    19:25 |
-rwxr-xr-x  1 ykiwng staff 2228  3  6    23:37 | bootstrap
drwxr-xr-x  9 ykiwng staff  306  7  6    21:40 |
drwxr-xr-x  9 ykiwng staff  306  7  6    21:40 |
drwxr-xr-x  8 ykiwng staff  272  9  5    14:32 |
drwxr-xr-x  5 ykiwng staff  170 30  5    19:45 |
drwxr-xr-x  3 ykiwng staff  102 31  5    13:04 |
drwxr-xr-x  4 ykiwng staff  136 16  6    10:15 |
drwxr-xr-x  3 ykiwng staff  102 11  7    19:35 |
drwxr-xr-x  3 ykiwng staff  102 30  6    22:57 |
drwxr-xr-x  6 ykiwng staff  204  8  7    21:08 |
drwxr-xr-x  3 ykiwng staff  102 31  5    12:43 |
drwxr-xr-x  3 ykiwng staff  102 30  5    19:45 |
drwxr-xr-x  4 ykiwng staff  136 30  5    19:45 |
drwxr-xr-x  3 ykiwng staff  102 31  5    12:53 |
drwxr-xr-x  3 ykiwng staff  102 30  5    19:45 |
drwxr-xr-x  9 ykiwng staff  306 31  5    13:06 |
drwxr-xr-x  6 ykiwng staff  204 30  5    19:45 |
drwxr-xr-x  3 ykiwng staff  102  5  7    19:04 |
drwxr-xr-x  6 ykiwng staff  204  8  7    19:18 |
drwxr-xr-x 19 ykiwng staff  646 11  7    20:04 |
drwxr-xr-x 14 ykiwng staff  476 14  7    13:03 +

Here's my environment:

in ~github/creasty/dotfiles on master *+
❯ zsh --version
zsh 5.0.8 (x86_64-apple-darwin14.3.0)

in ~github/creasty/dotfiles on master *+
❯ git --version
git version 2.4.5

in ~github/creasty/dotfiles on master *+
❯ ls -la
total 80
drwxr-xr-x  35 ykiwng  staff  1190  7 14 13:02 .
drwxr-xr-x  44 ykiwng  staff  1496  7 14 12:16 ..
-rw-r--r--@  1 ykiwng  staff  8196  7  5 19:04 .DS_Store
drwxr-xr-x  20 ykiwng  staff   680  7 14 13:05 .git
-rw-r--r--   1 ykiwng  staff   186  5 30 19:45 .gitignore
-rw-r--r--   1 ykiwng  staff   721  7 14 13:02 .gitmodules
-rw-r--r--   1 ykiwng  staff     6  2  7 22:40 .ruby-version
drwxr-xr-x   3 ykiwng  staff   102  4 25 21:32 .vagrant
-rwxr-xr-x   1 ykiwng  staff  4389  7  8 19:18 Brewfile
-rw-r--r--   1 ykiwng  staff   685  5 30 19:45 README.md
drwxr-xr-x   9 ykiwng  staff   306 11 16  2014 app
drwxr-xr-x   5 ykiwng  staff   170  6  2 21:51 aws
drwxr-xr-x   5 ykiwng  staff   170  5 31 22:41 bash
drwxr-xr-x  34 ykiwng  staff  1156  7  8 19:25 bin
-rwxr-xr-x   1 ykiwng  staff  2228  6  3 23:37 bootstrap
drwxr-xr-x   9 ykiwng  staff   306  6  7 21:40 bootstrap.d
drwxr-xr-x   9 ykiwng  staff   306  6  7 21:40 config
drwxr-xr-x   8 ykiwng  staff   272  5  9 14:32 docs
drwxr-xr-x   5 ykiwng  staff   170  5 30 19:45 dotssh
drwxr-xr-x   3 ykiwng  staff   102  5 31 13:04 elasticsearch
drwxr-xr-x   4 ykiwng  staff   136  6 16 10:15 git
drwxr-xr-x   3 ykiwng  staff   102  7 11 19:35 golang
drwxr-xr-x   3 ykiwng  staff   102  6 30 22:57 haskell
drwxr-xr-x   6 ykiwng  staff   204  7  8 21:08 lib
drwxr-xr-x   3 ykiwng  staff   102  5 31 12:43 lua
drwxr-xr-x   3 ykiwng  staff   102  5 30 19:45 nodejs
drwxr-xr-x   4 ykiwng  staff   136  5 30 19:45 peco
drwxr-xr-x   3 ykiwng  staff   102  5 31 12:53 python
drwxr-xr-x   3 ykiwng  staff   102  5 30 19:45 r
drwxr-xr-x   9 ykiwng  staff   306  5 31 13:06 ruby
drwxr-xr-x   6 ykiwng  staff   204  5 30 19:45 tags
drwxr-xr-x   3 ykiwng  staff   102  7  5 19:04 tex
drwxr-xr-x   6 ykiwng  staff   204  7  8 19:18 tmux
drwxr-xr-x  19 ykiwng  staff   646  7 11 20:04 vim
drwxr-xr-x  14 ykiwng  staff   476  7 14 13:03 zsh

Incompatible with enhancd

So, it looks like any plugin which overrides the cd builtin will break this. (as of #32, at least.)

Any chance of using command cd instead, or similar, so Enhancd and k can coexist?

how to disable git status

I noticed that k is order of magnitude slower than ls #28
After a quick reading of the issues seems that the slowliness is from git status.
How i disable the git status check? I'm interested in file size and time only.

Clearer git status

First of all: Awesome job with the little script 👏

As much as I love the git integration, it's kind of hard to take advantage of it. What I would expect from such a feature would be to have an instant overview of the state of a repository. Right now the representation is too minimalistic and a bit unclear. I'm still thinking about potential solutions to suggest something, I'll update this issue as soon as I think of something.

Handle sockets and fifos

These don't get marked in anyway in the output. In addition, if these are passed explicitly on the command line, nothing ends up being shown.

Add new installation with zplug

Hi,

Your k is an amazing zsh plugin! I appreciate it.
BTW, by using zplug, we can easily install this plugin.

Would you add this installation method to your README?

$ zplug "rimraf/k"

Calling `k` breaks `cd -`

Hi,

Thanks for your plugin, it's amazing.

I noticed a small bug annoying for people having the habit of using cd -. It is used to switch back to the previous directory. Your function is using some cd that are not done in a subshell – not within (...) or $(...) – and because of this the shell keep trace of all visited folders within the function.

To reproduce:

  1. Preparation

    mkdir -p ~/TEMPFOLDER
    cd ~/TEMPFOLDER
    mkdir AAA BBB
  2. Normal case

    cd ~/TEMPFOLDER
    cd AAA
    cd -  # Go back to TEMPFOLDER
    cd -  # Go back to AAA
    cd -  # Go back to TEMPFOLDER
    cd -  # Go back to AAA
    # Etc...
  3. Wrong case

    cd ~/TEMPFOLDER
    cd AAA
    cd -  # Go back to TEMPFOLDER -> OK
    k
    cd -  # Go back to BBB -> not what i want...

I tried to look for correcting it, but the construction of the code doing the cd doesn't allow an easy fix, at least up to my knowledge. I can contribute if needed but before taking time on it I decided to open this issue to discuss the best way to solve it.

Glob input yields additional output.

Not sure if this is intentional or not, but I'm not sure why this behavior would be desired. Example:

$ k
total 0
-rw-r--r-- 1 ryne ryne 0 18 May   15:46   onemorefile.py 
-rw-r--r-- 1 ryne ryne 0 18 May   15:46   somethingelse.py 
-rw-r--r-- 1 ryne ryne 0 18 May   15:45   something.py

$ k *.py
onemorefile.py:
total 0
-rw-r--r-- 1 ryne ryne 0 18 May   15:46   onemorefile.py 

somethingelse.py:
total 0
-rw-r--r-- 1 ryne ryne 0 18 May   15:46   somethingelse.py 

something.py:
total 0
-rw-r--r-- 1 ryne ryne 0 18 May   15:45   something.py 

Very slow

Can speed be improved? Takes a full 1.35 second to run in in my project root. git status only takes 0.04 second.

Allow custom colors

First of all, thanks for your work! I really like k.

It would be great to have the chance to define custom colors, with environmental variables, as the predefined ones may not be suitable for every terminal color scheme

k isn't working...

I downloaded k.
curl https://raw.githubusercontent.com/supercrabtree/k/master/k.sh -o k.sh

I sourced it:
source /usr/local/bin/k.sh

I sourced my .zshrc file:
source ~/.zshrc

I hit k:

drwxr-xr-x  11 amatthews  admin    374 28 Mar 08:41   .git
-rw-r--r--   1 amatthews  staff  15099 22 Jun  2012 | LICENSE-GPL
-rw-r--r--   1 amatthews  staff   1057 22 Jun  2012 | LICENSE-MIT
-rwxrwxrwx   1 amatthews  admin   1593 26 Mar  2013 | README.md
drwxr-xr-x   4 amatthews  admin    136 24 Sep  2012 | dist
-rw-rw-rw-   1 amatthews  admin   1297 26 Mar  2013 | grunt.js
-rw-r--r--   1 amatthews  staff   2228 22 Jun  2012 | index.html
drwxr-xr-x   4 amatthews  admin    136 24 Sep  2012 | libs
-rw-r--r--   1 amatthews  staff    884 22 Jun  2012 | package.json
drwxr-xr-x   4 amatthews  admin    136 26 Mar  2013 | src
drwxr-xr-x   4 amatthews  admin    136 26 Mar  2013 | test

But I have yet to see any profit. Can you indicate how long of an interval there might be between installation and profit? Am I just not waiting long enough? Could you also indicate in which form the profit might occur? Do I need to provide bank account information as an ENV variable to the script?

minimum version of coreutils?

mshertzberg@forge ~/git/k (master) $ date -j test
date: invalid option -- 'j'
Try 'date --help' for more information.
mshertzberg@forge ~/git/k (master) $ uname -a
Darwin forge.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64 i386 MacBookAir4,2 Darwin
mshertzberg@forge ~/git/k (master) $ date --version
date (GNU coreutils) 8.22

Add sort options

Would be great if I could change sorting options or group directories first.

unexpected chpwd() calls from cd inside the command

The new update is awesome! Thanks to all the contributors.

Everything is working fine, but when it lists directories, it shows what's inside too.
It's not that pretty, but it's working, so that is not that big of a deal.
But the concerning part is that it's occuring because I'm setting my own chpwd() to show the directory contents when moving into a directory. This means that the command will call chpwd() even when we didn't change working directory.

When we use this command, we are listing the directory contents, but not actually changing directories.
So changing directory inside a command, even if going back to the original directory, might cause unexpected things to happen.

I don't quite know how we can work it around though.
Are there any possible solutions for this?

Total files

Total files has broken along the way, now just shows 0

Lots of junk in output

k was working fine for me at first, but at some point it started outputting a bunch of extra junk before each listing...

$ k
total 0
/Users/adam/.rvm/scripts/initialize:59: array parameter rvm_rvmrc_files created globally in function
/Users/adam/.rvm/scripts/initialize:112: scalar parameter rvm_user_install_flag created globally in function
/Users/adam/.rvm/scripts/hook:32: array parameter _hooks_list created globally in function
drwxr-xr-x  11 Guest _guest  374  5 Jun    2014   Guest
/Users/adam/.rvm/scripts/initialize:59: array parameter rvm_rvmrc_files created globally in function
/Users/adam/.rvm/scripts/initialize:112: scalar parameter rvm_user_install_flag created globally in function
/Users/adam/.rvm/scripts/hook:32: array parameter _hooks_list created globally in function
drwxrwxrwt  35  root  wheel 1190 23 Dec   12:26   Shared
/Users/adam/.rvm/scripts/initialize:59: array parameter rvm_rvmrc_files created globally in function
/Users/adam/.rvm/scripts/initialize:112: scalar parameter rvm_user_install_flag created globally in function
/Users/adam/.rvm/scripts/hook:32: array parameter _hooks_list created globally in function
drwxr-xr-x 104  adam  staff 3536 20 Mar   10:56   adam

I can't remember what I did, but I tried different versions of ruby and they're all doing the same thing.

Passing arguments through to ls

I noticed that k doesn't accept any arguments, even a path. I also often use options like -h and -tr. Would it be possible to pass these arguments through to ls? Thanks :)

Call git status just once

We should just call git status once and store the results in a hash. Currently we are calling it once for each file, I think this could reduce the speed problems a lot.

An option to disable the git features?

Hi George,

k is a really nice script, but it gets really slow in git repositories. Would it be possible to add an option to disable the git features?

Thanks,
Anton

sort by date

Would be real nice to port the equivalent of the -t flag in ls to sort by date (most recent last).

Very useful for messy home dirs like mine 😅

lsattr like info

Since I use a compressed btrfs filesystem, it would be nice if I can see file attributes (especially "c") with k.

size of directories

k shows the size of directories to be 4.1k
while this is technically correct, it is a little confusing. i would prefer to not see any size of directories (e.g. display a - symbol instead).

Files that start with `-` are interpreted as options to zstat

I have a directory named -v in my current directory. When I run k, k prints k:zstat:73: bad option: -v and then proceeds to print the directory correctly except for the -v directory. -v is printed as a blank line like this:

-rw-r--r--  1 user group      348 30 Nov  2012   somefile.txt 
-rw-r--r--  1 user group     3740 30 Nov  2012   uneventfulfile.bnk 

drwxr-xr-x  3 user group     4096 20 Nov 13:08   .vim 
-rw-------  1 user group    26730  4 Apr 09:09   .viminfo 

This is using the current master commit a39c13c. Naming a directory -v does work in b6d2084 and has no errors. This makes sense since zstat wasn't used then.

best way to make an alias for 'k'?

I want to change 'k' to be 'l'.

I would think that alias l='k' would work and it does but I want to also assign k to 'ack' and there are conflicts there. What is the best way to set up an alias for k or change key mapping for k?

Thank you for any help.

Customizations and/or options/flags

It would be great if one could customize the behavior / looks of k. Here are some aspects that I would personally like to tweak without hacking the script directly:

  • Verbosity
    • In some cases, I would like to hide some of the info (e.g.: the permissions, ownership and modification date and time).
    • Also, I think k should mimic the behaviour of ls -Al instead of ls -al (do not show . and ..) (Same as #21)
  • Looks
    • Colors (potentially)
    • Looks (e.g.: representation of the git status)

The customizations should be applied either via options on the command line (which would enable the use of aliases) or environment variables.

I don't want warnings about permission for symlinks

Hi! I'm a newbie to this program.
Thanks for the program! It's awesome.

I found out that this program warns you if you got a file with a bad permission setting, but symlinks don't need that, and besides, I can't chmod the symlinks either.

If you could put a logic before putting out the warning that will be great :)

Passing a path returns incorrect git status

Fixes for 0.0.4 has broken passing a path to k:

k some/path/elsewhere

If you're outside a git repo, then it works as expected, however if you do it from inside a git repo the results are incorrect.

Correct

screen shot

From a location that isn't a git repo (works properly)

screen shot 1

From inside git repo

screen shot 2

support for fish shell

would you be open to creating a version (or making the current version) compatible with the fish shell?

i love k and it is the only thing I miss since moving from ZSH to fish.

Cant handle filename or dirname contain spaces?

→ touch k\ k\ k\ k\ k

→ k
k:zstat:250: ./k: no such file or directory
k:zstat:250: k: no such file or directory
k:zstat:250: k: no such file or directory
k:zstat:250: k: no such file or directory
k:zstat:250: k: no such file or directory
total 0
                
                
                
                
                

→ la
total 8.0K
drwxr-xr-x 2 kyra users 4.0K Nov 27 12:43 ./
drwx------ 4 kyra users 4.0K Nov 27 12:42 ../
-rw-r--r-- 1 kyra users    0 Nov 27 12:43 'k k k k k'

la alias for ls -lahF

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.