Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] I try to add the root path from neo-tree to cokline sep #1360

Open
1 task done
cuattoo opened this issue Feb 22, 2024 · 11 comments
Open
1 task done

[QUESTION] I try to add the root path from neo-tree to cokline sep #1360

cuattoo opened this issue Feb 22, 2024 · 11 comments
Labels
enhancement New feature or request idea question Further information is requested

Comments

@cuattoo
Copy link

cuattoo commented Feb 22, 2024

Did you check the docs?

  • I have read all the docs.

Is your feature request related to a problem? Please describe.

  • My question is how to grab the root path from neo tree and place it in the cokeline separator so that the path in the cokeline updates itself at any time.
  • And disable the root path at the top in neo-tree.

If anyone knows how, please tell.

ty

Describe the solution you'd like.

I like the api in nvim-tree. I would be happy about an api and a api documentation.

Describe alternatives you've considered.

No response

Additional Context

No response

@cuattoo cuattoo added the enhancement New feature or request label Feb 22, 2024
@pysan3
Copy link
Collaborator

pysan3 commented Feb 22, 2024

These lines might be useful for you.

add_blank_line_at_top = false, -- Add a blank line at the top of the tree.

hide_root_node = false, -- Hide the root node.
retain_hidden_root_indent = false, -- IF the root node is hidden, keep the indentation anyhow.
-- This is needed if you use expanders because they render in the indent.

Regarding cokeline, may I ask what you've got so far? There are various degrees that needs to be explained so I'd like to know that you don't understand.

Have you read the sidebar section?

@cuattoo
Copy link
Author

cuattoo commented Feb 22, 2024

yes, I had read many pages of code and issues to find that, what I need. So that was my first question/comment on github.

I have a sidebar for coke but only a normal text and I wish so cool functions.

    sidebar = {
        filetype = {'NvimTree', "neo-tree"},
        components = {
            {
                text = 'File Explorer',
                fg = title,
                bg = bg,
                style = 'bold',
            },
        },
    },

Idk, I would like to add some code for the empty line so that if I want a new file or something with a keybind to write in the blank line instead of a popup, for a new file. That would be nice.
and then add an integration for cokeline.

I find my idea useful
pls give feedback.

@pysan3
Copy link
Collaborator

pysan3 commented Feb 24, 2024

I don't quite understand what you want but I think this will help you.

Could you give me your nvim-tree example (as you said you liked the nvim-tree api)?
I don't fully understand what your goal looks like.

        {
          text = function(buffer)
            local mgr = require("neo-tree.sources.manager")
            if not vim.api.nvim_buf_is_valid(buffer.number) then
              return "File Explorer"
            end
            local winid = vim.b[buffer.number].neo_tree_winid
            local state = mgr.get_state_for_window(winid)
            if not state then
              return "File Explorer"
            end
            return state.path
          end,
          style = "bold",
        },

@cuattoo cuattoo closed this as completed Mar 3, 2024
@cuattoo cuattoo reopened this Mar 3, 2024
@pysan3
Copy link
Collaborator

pysan3 commented Mar 3, 2024

Mate, you might be interested in config.source_selector.show_scrolled_off_parent_node with a combination of this trick.

Idk if cokeline has a raw field that can be passed, but I think it is worth a Feature request on their side as I said in the issue for bufferline.

@pysan3 pysan3 added question Further information is requested idea labels Mar 3, 2024
@pysan3
Copy link
Collaborator

pysan3 commented Mar 3, 2024

If you are satisfied, plz close this issue @cuattoo

@cuattoo
Copy link
Author

cuattoo commented Mar 3, 2024

Ik, can I edit the gui like this?
preview

I find this important because otherwise my GUI doesn't match up.

@pysan3
Copy link
Collaborator

pysan3 commented Mar 3, 2024

I don't understand what you mean.

@cuattoo
Copy link
Author

cuattoo commented Mar 3, 2024

The borders
here

@pysan3
Copy link
Collaborator

pysan3 commented Mar 3, 2024

Did you check the config.source_selector.show_scrolled_off_parent_node option?

I don't think it has any borders at all, so I don't know what you are talking about.

If you want to modify the borders in the winbar selector, please read the help file. You've got options like config.source_selector.separator / separator_active / highlight_tab etc

Do you know how to decorate tabline without any plugin? As you can see in #1368 (comment), you can decorate the raw field as muchas you like.

          raw = "<decorate-here>%{%v:lua.__get_selector()%}<and-here>",

@cuattoo
Copy link
Author

cuattoo commented Mar 3, 2024

I don't quite understand how it works,
I am using cokeline and I am trying to implement this.
Idk how. My brain is dead now ^ ^

@cseickel
Copy link
Contributor

cseickel commented Mar 3, 2024

Just to clarify, the "scrolled off parent node" stuff only applies when the window is scrolled down. In that situation, it proves the parent path of the node which is at the top of the visible screen. It really only makes sense to place this in the winbar of neo-tree.

If you haven't changed any of the default settings regarding paths, the root path of neo-tree is just going to be the current working directory of the neovim tab. That means all you need to do is to use a generic "current working directory" component, which is a question for the cokeline project. If you want a raw statusline code, I use this:

%#StatusLineCwd#  %{fnamemodify(getcwd(), ":~")}/%*

There is a config option in neo-tree to hide the root folder, just set hide_root_node = true in your config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request idea question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants