vim-buffet icon indicating copy to clipboard operation
vim-buffet copied to clipboard

Refactor

Open bagrat opened this issue 5 years ago • 3 comments

  • Rethink how to store/cache the state of the buffer or fetch the list every time if the performance allows
  • Make the code more readable by splitting the long functions into smaller units

Related to and will solve https://github.com/bagrat/vim-buffet/issues/24

bagrat avatar Jul 15 '19 15:07 bagrat

Seem like you guys kind of busy. I just refactored the logic for vim-buffet here: https://github.com/baIIoon/vim-buffet/tree/cleaning

I'm pretty new to Vimscript, so if you guys don't like it then I just want to contribute with some ideas:

  • We should split the Logic and UI to 2 files
  • Make a good code docs to easy add or tweak features in the Logic or in the UI
  • The UI kind of really hard to understand the numbers

hewcaw avatar Dec 09 '19 07:12 hewcaw

Hey @baIIoon! Thanks for all your contributions and for raising the #39. Indeed, the code is messy and I also have hard time reading it when coming back after a while. Unfortunately, I won't have the time to work on it for a while, but I would be more than happy to review your suggestions and updates.

If you feel like working on it further, I would be happy to add you to the contributors so that you can work directly on this repo. Until then, can you please create a PR from your fork, so the changes are easier to review?

It's not that I'm good at Vimscript either, but what you have suggested, sound solid to me and I'd be glad to see all of that done.

Thanks again!

bagrat avatar Dec 10 '19 16:12 bagrat

@bagrat, i just created PR, it's actually pretty cumbersome. Please don't merge it.

I just want to show you the idea. The reason why it's so bloated is because: I think we don't have a lot of time to develop vim-buffet, so the code must be easy to understand and in well organized, that will let us add or fix something more easier.

Here are some of my ideas:

  • The flow of reading the code is from top to bottom, so I think we should only call functions inside buffet#update(), buffet#render(), ...
  • plugin/buffet.vim - Only contain global variables, init code, mappings, ... Just not any code implementation.
  • doc/duffet.vim - For who want to add or contribute something (README.md is for users):
    • We can write a basic guidance, the intents
    • Some coding rules for easy maintaining.
    • A dev status block to contains something like: bugs, fixme, future features(reorder buffers, two ends separator), ideas ... anything you guys want.
  • . . . . .

I'm working on all of that (temporary finish refactoring autoload/buffet.vim, intents explaining), you guys can checkout it at: https://github.com/baIIoon/vim-buffet/tree/im_breaking_the_ui

Now I don't have time to develop maybe around a month later, hic :cry: . Man, I love this plugin and you guys so much.

hewcaw avatar Dec 15 '19 11:12 hewcaw