Giter VIP home page Giter VIP logo

kaktree's Introduction

kaktree

kaktree

This plugin displays the interactive file tree. It requires Perl, as well as ls command that supports at least -1, -F, -b, -L, and -A flags. Works best with Tmux.

Installation

You need latest Kakoune build from master in order to use this plugin.

Add this to your kakrc:

plug "andreyorst/kaktree" config %{
    hook global WinSetOption filetype=kaktree %{
        remove-highlighter buffer/numbers
        remove-highlighter buffer/matching
        remove-highlighter buffer/wrap
        remove-highlighter buffer/show-whitespaces
    }
    kaktree-enable
}

Restart Kakoune or re-source your kakrc and call plug-install command.

Without plugin manager

Clone this repository to your autoload directory, or source kaktree.kak file from your kakrc.

It's strongly recommended to disable line numbers and wrap highlighters as shown in the plug.kak example above.

Configuration

There are set of options that affect how kaktree works:

  • kaktreeclient - the name of the client that will be used to display kaktree buffer.
  • kaktree_split - how to split TMUX (horizontally or vertically).
  • kaktree_side - the side where kaktree buffer will be displayed in TMUX.
  • kaktree_size - size of the split.
  • kaktree_dir_icon_close - icon for closed directory.
  • kaktree_dir_icon_open - icon for opened directory.
  • kaktree_file_icon - icon for files.
  • kaktree_show_hidden - whether to show hidden files
  • kaktree_hlline - configures highlighting of current line in the tree.
  • kaktree_sort - whether to sort items in the tree.
  • kaktree_double_click_duration - amount of time Kakoune waits to register double clicks in the Kaktree.
  • kaktree_show_help - whether to display help box on first launch of Kaktree.
  • kaktree_tab_open_file - whether Kaktree should open file if Tab key was pressed over it.

For example, to have nice folder and file icons as on the screenshot add this to your configuration (assuming that your font has these characters and your terminal can handle wide Unicode symbols):

plug "andreyorst/kaktree" defer kaktree %{
    set-option global kaktree_double_click_duration '0.5'
    set-option global kaktree_indentation 1
    set-option global kaktree_dir_icon_open  'โ–พ ๐Ÿ— '
    set-option global kaktree_dir_icon_close 'โ–ธ ๐Ÿ—€ '
    set-option global kaktree_file_icon      'โ €โ €๐Ÿ–บ'
} config %{...}

If you're not using plug.kak, replace defer with hook global ModuleLoaded. Beware that 'โ €โ €๐Ÿ–บ' the first two characters here are not ordinary spaces, but invisible Unicode symbols. Currently Kaktree handles tree structure based on indentation, so in order to do alignment of icons you should use something that doesn't match \s regexp atom.

kaktree's People

Contributors

andreyorst avatar jjk96 avatar p1gp1g avatar topisani 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

Watchers

 avatar  avatar  avatar

kaktree's Issues

Symbolic links to directories are shown as files

Because tree generated by kaktree is built from information provided by ls -1p it can't distinguish links to files and links to directories, because they use identical symbol @ at the end of the filename.

Parsing ls -lF output would be better solution, but harder to do and may not be portable?

Error message when toggling show_hidden_files

Problem description

Error message when toggling show_hidden_files with h or set-option. It works, but an error message is printed into *debug*

plug "andreyorst/kaktree" config %{
    hook global WinSetOption filetype=kaktree %{
        remove-highlighter window/number-lines
        map window normal l ''
    }
    kaktree-enable
    kaktree-toggle
    nop %sh{
        tmux select-pane -R
    }
    set-option global kaktree_show_hidden false
}

Steps to reproduce

  1. Press 'h' in kaktree window

What should happen

No error message should be triggered

What happens instead

In *debug* buffer:

error running command 'evaluate-commands -client %opt{kaktreeclient} %{ select  }
': 1:1: 'evaluate-commands': 1:2: 'select': wrong argument count

My guess is that the variable fed to select is empty, which gets handled as an absence of argument without proper quoting

Environment information

Kakoune v2021.11.08
Calculate linux
zsh 5.8 (x86_64-pc-linux-gnu)

Open kaktree in current buffer.

Hi, first of all, thanks for writting this plugin.

I would like to be able to turn my current buffer into kaktree, right now if I open it with panes that are split horizontally, their width is altered when I toggle kaktree (this is for tmux), so I thought it would be ok for me to turn my current buffer into kaktree and use it that way, which leds me to wonder if one could somehow display a file preview in a wider UI for kaktree, maybe a simple implementation like runing head or ls depending on the type of the entry bound to some free key.

I'm just wondering, but the thing with the width would be a bug right?

thanks again, have a nice day.

[Feature Request] option for return key to just open the directory

It would be nice if there were an option to be able to have the return key simply open a directory tree when the selection is a directory, and open the file when it is a file, similar to how vim's nerdtree plugin works. Changing the root could be bound to a different key in this mode as well.

Changing root doesn't move cursor to the top of the buffer

Problem description

When you change root of the tree by pressing enter, the marked line moves to the top of the buffer, but there is also a white cursor showing the "real" position. Pressing "j" moves the blue marked line and the cursor below the position of the cursor and pressing enter opens the file or folder under the cursor.

Steps to reproduce

  1. Open kaktree
  2. Press enter on a folder
  3. Move up or down using j or v

What should happen

Both the cursor and the marked line should be at the same row, avoiding confusion. I would personally prefer if both would be at the top of the buffer.

What happens instead

The "real" position of the cursor is where it was previously.

Step 1
After I pressed enter
Step 2
After I pressed "j" once
Step 3

Environment information

Kakoune version: Kakoune v2020.09.01-339-g7c321e12
OS version:
DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=20.2.1
DISTRIB_CODENAME=Nibia
DISTRIB_DESCRIPTION="Manjaro Linux"

sh executable version: GNU bash, version 5.1.0(1)-release (x86_64-pc-linux-gnu)
Running in TMUX

kaktree--refresh moves cursor to the first line

Problem description

The function kaktree--refresh is called after moving, creating or deleting a file. Every time kaktree--refresh is called, the cursor goes to the first line. It would be preferable for this cursor to not move in this scenario. (For instance, creating multiple file in a directory)

Steps to reproduce

  1. Create multiple directory mkdir a b c d and open kakoune
  2. Go on the c on kaktree and create a new file : N c/test

What should happen

The cursor should still be on c

What happens instead

The cursor has moved to the first line

Environment information

Kakoune version: 2021.08.28
OS version: Fedora 34
sh executable version: fish, version 3.3.1

No window appears when running kaktree-enable

I don't know if it's bugged or if I'm just doing something wrong, but when I open kakoune and run kaktree-enable, no window appears. The new commands such as kaktree-focus do show up, but the tree itself is nowhere to be found.

I installed by cloning the repo to ~/.config/kak/autoload, and haven't made any changes to my kakrc or anything else. I've checked that my ls supports all the mentioned options, and perl is installed. My kakoune is version v2020.09.01.

[Feature Request] Real tree support

Currently kaktree only imitates the tree, by doing requests to the filesystem only when user expands the directory, and replacing the contents of the buffer with Kakoune. This means that we currently are not able to refresh the whole tree, and if we fold something that has unfolded directories inside it, on unfolding it again those directories will not be unfolded.

This FR proposes to create and maintain real filetree in some kind of variable, and make all requests based on the information of that tree. This way folding and unfolding can still be done by Kakoune replacement commands, but correct trees will be obtained. This will also allow refreshing full tree from top to bottom.

Work on this feature will be going in real-tree branch.

[Feature Request] POSIX ls usage

Right now kaktree needs a bunch of non-POSIX ls command line options to work. It would be great to POSIX-fy the ls usage in order to enable the plugin to be used on busybox or BSD systems.

Kaktree not opening with the kitty terminal

Problem description

Kaktree doesn't open when using the kitty terminal emulator. From my testing I think the problem might be in kaktree--display, the variable $kak_opt_termcmd is empty, thus not running the shell command on line 192 in rc/kaktree.kak which should create a new buffer called *kaktree* and client.

Steps to reproduce

  1. Open kakoune (with kaktree installed) in kitty
  2. Type :kaktree-toggle<ret>
  3. Nothing happens

What should happen

A new window containing the filetree should open.

What happens instead

The first time :kaktree-toggle is run nothing happens, after the first time the command gives the error:

Error: 1:1: 'kaktree-toggle' 1:2: 'evaluate-commands' 2:28: 'evaluate-commands' no such client 'kaktreeclient'

in the *debug* buffer.

Environment information

Kakoune version: Kakoune v2020.09.01-339-g7c321e12
OS version: Manjaro Linux 20.2.1 Nibia
`sh` executable version: GNU bash, version 5.1.0(1)-release (x86_64-pc-linux-gnu)

[Feature Request] Open file in arbitrary kakoune instance

I usually have at least two files open simultaneously at all times and I haven't found a nice way of opening a file with kaktree in any other kakoune instance than the one that started kaktree.

I am not sure whether should do this already. I at least did not get it to work.

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.