matbme / JABS.nvim

Just Another Buffer Switcher for Neovim
GNU General Public License v3.0
280 stars 10 forks source link

add sort_mru and split_filename (+split_filename_path_width) options #34

Closed jeff-dh closed 1 year ago

jeff-dh commented 1 year ago

This branch adds support for sorting the buffers according to :ls t -> most recently used first (sort_mru option).

Furthermore it adds a options to split the filenames into the path and file components and display them separately or omit the path (split_filename and split_filename_path_width options).

To be able to to implement these features with reason the parseLS function was refactored (and the split module was removed because it's not used anymore).

If you consider merging this request, let me know I would add the missing options to the readme.

matbme commented 1 year ago

Hi, thanks for the major improvement! I've fixed some glitches I found and now it's ready to merge

jeff-dh commented 1 year ago
    local ext = filename
    while string.match(ext, "%.(.*)$") do
        ext = string.match(ext, "%.(.*)$")
    end

oops, fixed that one in my branch, but forgot to update the pr.

Buuuuut. would you pls replace those lines with this one:

local ext =  string.match(filename, '%.([^%.]*)$')

you don't have to do it on your own, patterns / regular expressions are mighty!

PS: there's a debug print in line 193

jeff-dh commented 1 year ago

And in the README:

split_filename_path_width = 1 -- If split_filename is true, how many components to show. Default 0.

that's not what this parameter does

split_filename_path_width = 20 -- If split_filename is true, how wide the column for the path is supposed to be, Default 0 (don't show path)
matbme commented 1 year ago

Nice! Merged changes to main.