Add support for multiple files, line number, -o -O -p cmd line arguemnt
In This PR which add some cmd line option parsing capabilities
Added:
- new config g.unception_multi_file_open_method that will control how successive file will be opened (default still argadd)
- cmd line option -o -O -p is detected to overwrite config
vim.g.unception_multi_file_open_methodso for example by default the argadd method is used, so only one file will be visisble but if you typenvim file1 file2 -Oboth file will be open in a vsplit - cmd line option -d is detected this will open all file in a vsplit and mark them for diff using :diffthis
- cmd line option +{number} is detected to open specified file at a given number (this currently doesn't work with argadd method)
Fixed:
- when using --cmd to set global with viml like this
nvim --cmd "let g:unception_disable=0"now 0 is set to false so lua code handle it properly all boolean config value can be set to 0 in viml this will be handled as false
Example usage
# type this
nvim file1 file2 +2 -o
nvim -d file1 file2 +2
# enjoy
What's remaining to do:
- [ ] find better name for unception_multi_file_open_method
- [ ] update the README
- [ ] update doc
- [X] clean up/refacto code + better naming for config and functions
- [ ] add better unit tests
- [X] check potential compatibility issue with vim.fn.rpcrequest vs vim.rpcrequest Actualy vim.fn.* will do this lua/viml translation, so it's seems better to use vim.rpcrequest/notify
Hi lguarda! Thanks for the PR! I appreciate that you took some time to dedicate to looking into potential improvements for the plugin.
I want to be upfront that at the moment, I'm quite low on bandwidth, and may not be able to review for a while. I hope to get to it eventually, but it could take some time.
Regarding argadd, I believe I initially used it because it mimics how Neovim behaves when you give it multiple file arguments directly (without using any plugins). Neovim adds each file to the args list, and you can switch between them using :next and :prev. One of my goals was to have it integrate with the vanilla behavior as seamlessly as possible, and that's what I came up with.
Ok thanks it something that i never used so i didn't even think of next/prev, i will continue to update this PR and keep the default behavior with argadd + next/prev