preservim / vimux

easily interact with tmux from vim
MIT License
2.19k stars 158 forks source link

Define options once at startup #183

Closed mvanderkamp closed 3 years ago

mvanderkamp commented 3 years ago

This also removes a couple of "getter" functions that were being used to look up options and fall back to their defaults.

I'm excited to see that this is starting to be actively maintained again! This is just a refactor suggestion so that the use of options in this plugin follows a more common idiom and such that options are easier to work with. (No need to recall the defaults every time you need to look one up).

mvanderkamp commented 3 years ago

Along a similar vein, it looks like everything got moved to the g: global namespace where previously in a few cases it may have been possible to get buffer-local settings to stick if they were set at the right time. This may not have been utilized either because the way I think it could have been done is pretty convoluted, but before we introduce a regression like this lets make sure we have a way to set values in an non-global way. One example where this might matter, I have projects with code in several language. I'd like to configure my runners differently depending on what language the current bufffer is.

Okay I think I've got this supported easily now, just by looking up the b: dictionary first. The neat thing here is if we also convert VimuxLastCommand and VimuxRunnerIndex to use the b: dictionary you could have buffer-local runners! My thinking for how this would work is to set both b: and g: when setting these options. So if you've set it from the current buffer you get the current buffer's runner/command, and if you didn't, you get the most recently set runner/command.

mvanderkamp commented 3 years ago

Also let me know if you want this squashed / otherwise rebased down. The fixup commits are piling up...