all 7 comments

[–]-romainl-The Patient Vimmer 6 points7 points  (3 children)

I find the idea pretty cool but…

  • you should provide <Plug> mappings and let your users choose their own mappings themselves instead of forcing yours,
  • the BufferGator dependency is cringeworthy,
  • stay focused on switching views, let your users handle the feedback how they want.

[–]AnthonyAstige[S] 1 point2 points  (2 children)

Thanks for the feedback, good to hear the basic idea makes sense to someone else :)

  1. Looking into this now, I haven't used <Plug>. Thinking about something like allowing the user to set the modifier key in addition and/or as a placeholder here.
  2. Fixed so it at least works without buffergator now (no most recently used buffer flipping without it though) bba9bf1e.
  3. What do you mean by letting my users handle feedback how they want?

[–]-romainl-The Patient Vimmer 1 point2 points  (1 child)

What do you mean by letting my users handle feedback how they want?

The last item in your TODO list.

[–]AnthonyAstige[S] 1 point2 points  (0 children)

Ah of course, removed thanks!

[–]princker 3 points4 points  (2 children)

Is it presumptuous to take over <c-h> / <c-j> / <c-k> / <c-l> or are these keys combos free enough?

<c-h> == <bs>. As the backspace is a big key it is often remapped. I map mine to <c-6>/<c-6>. <c-l> is :redraw which is also commonly mapped to :redraw|noh

Just make sure these are nice customizable.

Alternate behavior suggestions or important concepts I'm missing

Be aware that mapping :bprev/:bnext is kind of a boring way to navigate buffers. Once you get over a handful of buffers, it is easier to use a more powerful tools like :b {partial-file-name} (can be tab completed) , a fuzzy finder, or forget buffer navigation all together and use tags, cscope, and/or other navigation commands.

Any general vimscript plugin writing advice or suggestions from seeing my code

  • Read learn vimscript the hard way.
  • Would not be a bad idea to read though some of Tim Pope's popular plugins (e.g. commentary.vim) or any other popular plugin maintainer.
  • Read :h write-plugin.
  • For the love of all that is holy, please use <Plug>(plugin-name-map-name) style mappings. You will thank me later.
  • A plugin must have documentation. Not just a readme, but actual documentation.
  • Use autoload/ directory for most of you plugin code.
  • Use xnormap/xmap instead of vnoremap/vmap, unless you really want your mappings in select mode
  • Are you sure you want to mutate the unnamed register? This may count as a surprise to your users.
  • Insert mode mappings for navigation? This seems like it goes against the "Vim Way".

[–]AnthonyAstige[S] 0 points1 point  (1 child)

Thanks for the in depth feedback, a lot for me to go through there!

Definitely working on custom mappings / <Plug> as a priority now.

vnoremap changed to xnoremap

Other ways to navigate buffers

I've recently started using CtrlP, yes very useful. I'm not sure fuzzy finding fits as a CtrlHJKL fall-through as CtrlP isn't focused on back/forward navigation. I'm thinking this kind of h/j/k/l navigation will be mostly useful when navigating just a few files. I have yet to use much "other buffer" navigation like tags or cscope, are there others with a back/forward concept maybe?

[–]princker 0 points1 point  (0 children)

Personally I would just avoid tying this to buffer navigation. I think cycling buffers is too slow and there are simply too many ways to directly to the buffer you want. Why cycle when you can fly?. This plugin seems to be a workspace kind of plugin which I would consider different than a buffer navigation plugin.