laktak / extrakto

extrakto for tmux - quickly select, copy/insert/complete text without a mouse
MIT License
878 stars 45 forks source link

(Related to issue #72) Added configuration variable for defining the order of filter modes #81

Closed nhatanh002 closed 2 years ago

nhatanh002 commented 2 years ago

Originally from issue #72 [How to make the default filter as "lines"?]. but it seems better to generalize the config to not just simply let the user define the "default" (or in fact the first) filter in the list, but the whole filter list in order as well.

Feel free to comment on any change needed, I would really appreciate that. I wouldn't call myself a bash expert, most of the time I just use bash as my go-to quick fix duck tape so can't be confident what I wrote doesn't deviate much from best practices (if bash even has those). The readarray builtin for example was something I found convenient here, but it wasn't available until bash 4.0 or so, if backward compatibility with older bash versions was important for this project then I'd change it to good old read instead.

laktak commented 2 years ago

This looks great, thank you!

Your bash looks fine to me. I'd only suggest that you move your code to helpers.sh and only call mode=$(get_next_mode "initial") and mode=$(get_next_mode "$mode") from extrakto.sh.

nhatanh002 commented 2 years ago

This looks great, thank you!

Your bash looks fine to me. I'd only suggest that you move your code to helpers.sh and only call mode=$(get_next_mode "initial") and mode=$(get_next_mode "$mode") from extrakto.sh.

Almost forgot to reply, it was late here and I went to sleep right after I pushed the commit, but it's done :))

laktak commented 2 years ago

Thank you, I just tested it and it works very well!

nhatanh002 commented 2 years ago

Glad you found it useful!