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

Mini.files spaces after and before Title #1062

Closed
2 tasks done
6H075T2 opened this issue Jul 16, 2024 · 11 comments
Closed
2 tasks done

Mini.files spaces after and before Title #1062

6H075T2 opened this issue Jul 16, 2024 · 11 comments
Labels
mini.files question Further information is requested

Comments

@6H075T2
Copy link

6H075T2 commented Jul 16, 2024

Contributing guidelines

Module(s)

mini.files

Description

Really liked this plugin a lot and configuring this plugin to my liking but I couldn't figure out on how I can configure this plugin to add spaces with its Title to make it look like the Footer below.

image

I'm currently learning how to code in Lua and please have patience with me.

@6H075T2 6H075T2 added the feature-request Feature request label Jul 16, 2024
@echasnovski echasnovski added mini.files question Further information is requested and removed feature-request Feature request labels Jul 17, 2024
@echasnovski
Copy link
Owner

If possible, it would be something along the lines of customizing window example, but with MiniFilesWindowUpdate event (because title can change after window is opened).

However, quick tests showed that title is somewhat special, as it indeed updates when navigating horizontally. I am afraid, declaring title "special" and not designed to be customized is a reasonable approach here.

@6H075T2
Copy link
Author

6H075T2 commented Jul 31, 2024

@echasnovski, Thanks for atleast trying to help me I just want to make the title/path to be more emphasized and make it look appealing to me. :) btw I really loved your plugins but is it possible to add a "padding" so that the Icons itself is not really close to the border?

@echasnovski
Copy link
Owner

Icons are the result of applying default_prefix() which is used by default as config.content.prefix.

Here is an example of how to override it so that there is an extra space before an icon:

local prefix = function(fs_entry)
  local icon, hl = MiniFiles.default_prefix(fs_entry)
  return ' ' .. icon, hl
end
require('mini.files').setup({ content = { prefix = prefix } })

@6H075T2
Copy link
Author

6H075T2 commented Jul 31, 2024

@echasnovski, Thanks for very fast response now it works as I intended and looks nice. But my current concern is about the link you've provided in customizing window example why is it that the "Title" property when assigned by a function that returns the current working directory as a title doesn't automatically add spaces like the a normal title would do.

@echasnovski
Copy link
Owner

But my current concern is about the link you've provided in customizing window example why is it that the "Title" property when assigned by a function that returns the current working directory as a title doesn't automatically add spaces like the a normal title would do.

I don't really understand the question. By default titles in floating windows are not padded with spaces.

The reason customization doesn't apply for titles is because they are a bit special as described in the original response:

However, quick tests showed that title is somewhat special, as it indeed updates when navigating horizontally. I am afraid, declaring title "special" and not designed to be customized is a reasonable approach here.

echasnovski added a commit that referenced this issue Aug 12, 2024
Previously these events were not triggered during cursor movement. This
resulted in a better performance for anyone wanting to create an
autocommand for them (less triggers is better).

However, this resulted in too much constraints put on *what exactly* can
be customized in window outlook. For example, customizing how title
looks or even window height was not really possible because those get
overridden by the internal logic.

It looks like "emit `MiniFilesWindowUpdate` event whenever window config
is updated" is a better approach.

Resolve #1140

Resolve #1062
@echasnovski
Copy link
Owner

@6H075T2, after some recent changes, I think adding space padding to title now should be possible. You can follow the newly added example (without the config.height part) and it should work.

This use case even has a dedicated test in the hope that it will keep working.

I changed my mind about this issue because height also could not be customized (see #1140). As the root cause has revealed to be the same (intentional blocking of too frequent MiniFilesWindowUpdate event triggering), it seems to be more reasonable to change the balance here (from preferring performance to preferring actual customization with heavy warning that it is triggered frequently.

@6H075T2
Copy link
Author

6H075T2 commented Aug 13, 2024

@echasnovski, I never thought you'll give my request some attention since it's I've considered it silly because I don't think anyone even want this feature and possibly even go againts your project principle, I really appreciate your effort to make this possible. <3

Here's what it looks now.
image

I'm looking forward to your mini.statuscolumn plugin 😊

@echasnovski
Copy link
Owner

@echasnovski, I never thought you'll give my request some attention since it's I've considered it silly because I don't think anyone even want this feature and possibly even go againts your project principle, I really appreciate your effort to make this possible. <3

To be perfectly honest, I indeed did not intend to account for this (because they indeed are special). It was somewhat of a coincidence that the key problem that blocked this also happened to block other customizations. That felt a bit too much, so decided to address it.

Besides, I briefly tried it, and can confirm that it indeed looks beautiful :)

I'm looking forward to your mini.statuscolumn plugin 😊

Me too. However, quick tests couple of weeks ago showed that it might be reasonable to wait until 0.11 release, because current Nightly has some significant quality of life improvements in 'statuscolumn'. We'll see.

@6H075T2
Copy link
Author

6H075T2 commented Sep 10, 2024

Hi, @echasnovski I've noticed this visual bug ↓
Untitled
This only happens when a floating window has a long directory title, becomes contracted and unfocused makes the padding on the right gone and not consistent with the left padding as it doesn't appends an empty space in the end.

Thank you for this wonderful update with bookmarks, its nice to have :>

@echasnovski
Copy link
Owner

This only happens when a floating window has a long directory title, becomes contracted and unfocused makes the padding on the right gone and not consistent with the left padding as it doesn't appends an empty space in the end.

That's expected because width of windows are fixed and can be configured inside config.windows. So it looks like just a coincidence of the title length being strictly on character less than window width.

@6H075T2
Copy link
Author

6H075T2 commented Sep 11, 2024

I forgot to include that the Neovim's window is minimize and not in Fullscreen that's why it happens. 🤦
Thanks for the response :3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mini.files question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants