rcmdnk / sentaku

Utility to make sentaku (selection, 選択(sentaku)) window with shell command.
http://rcmdnk.github.io/blog/2014/01/24/computer-bash-zsh/
MIT License
140 stars 6 forks source link

File content preview #9

Closed notdodo closed 7 years ago

notdodo commented 7 years ago

Hi! :) Great work.

What do you think about making a view of the content of the file or a preview right or after the selection list? It will be difficult to implement?

rcmdnk commented 7 years ago

It could be like:

https://gist.github.com/rcmdnk/d7a29b8c9e16fd4cada19cc74832f94b

Usage is same as sentaku, like:

$ ls |  /PATH/TO/file_selector

(if file_sleector is under $PATH, /PATH/TO/ is not needed.)

This wrapper script shows the file content below, and shows more content when you push s.

or simpler implementation only s function (much faster):

https://gist.github.com/rcmdnk/ba0b97f94b290ced8bc8ca6657981b9a

notdodo commented 7 years ago

Yeah! The first one is great, thanks! :D

Is it possibile to achieve something like ranger? Maybe choosing where to show the preview...

ranger

rcmdnk commented 7 years ago

file_selector has been added in the repository:

https://github.com/rcmdnk/sentaku/blob/master/bin/file_selector

Now, you can use "--right" or "--under" option, showing a content in the right or under the list, respectively. Default is "right". Can be changed by _SENTAKU_CONTENT_SHOW_UNDER variable, like

$ ls |_SENTAKU_CONTENT_SHOW_UNDER=1 ./file_selector

This is same as ./file_selector --under. Or set

$ export  _SENTAKU_CONTENT_SHOW_UNDER=1

How about it?

notdodo commented 7 years ago

OMG! 😃 You're great!!

screenshot from 2016-12-04 19-32-24

Thank you so much 🍺

rcmdnk commented 7 years ago

I have updated the script in the different repository: shell-explorer