[WIP] Allow the passing of a custom init.vim path. #784
Conversation
This could help with #436. |
browser/src/neovim/NeovimInstance.ts
Outdated
const customInitVimPath = configuration.getValue("oni.customInitVimPath") | ||
|
||
if (customInitVimPath) { | ||
return this.command(`e! ${customInitVimPath}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should probably refactor this to just use the open command, so the logic isn't duplicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea 👍
@@ -53,7 +53,7 @@ export const registerBuiltInCommands = (commandManager: CommandManager, pluginMa | |||
// Menu commands | |||
new CallbackCommand("oni.config.openConfigJs", "Edit Oni Config", "Edit configuration file ('config.js') for Oni", () => openDefaultConfig(neovimInstance)), | |||
|
|||
new CallbackCommand("oni.config.openInitVim", "Edit Neovim Config", "Edit configuration file ('init.vim') for Neovim", () => neovimInstance.open("$MYVIMRC")), | |||
new CallbackCommand("oni.config.openInitVim", "Edit Neovim Config", "Edit configuration file ('init.vim') for Neovim", () => neovimInstance.openInitVim()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you factored this out to a separate method, thanks!
Cool, thanks for submitting this @CrossR ! I definitely think it makes sense to be able to override the The only concern I have is that the configuration settings we have today are already confusing - A couple of options I'm thinking about:
I'd lean towards the first one, just because it is simplest... but I'm sure there are other ways we could consolidate this and simplify the relationship between |
Yep, totally agree! I'll have a look at implementing it now. |
Also refactored the opening of the init.vim to use the existing open command.
Consolidated those two options together now and seems to work well! There is still some oddness with the interactions with |
Excellent, looks great! I just tried it and it works well - thanks for making the changes!
Definitely, I'd like to see how to consolidate this at some point. But as you mentioned at least this change doesn't introduce any new issues, the problems are pre-existing 😄 I'll go ahead and bring this in. I made a quick edit to the wiki to detail that a |
This PR should allow the defining of a custom init.vim path in the Oni config file.
I need to check into some error checking, ie if an incorrect path is given, as well as some testing outside of Windows (Mac or Linux users would be useful, since I've only got Window + a few Linux VMs).
Also, is it acceptable to assume the user will sufficiently escape the path they provide?
Ie if they are on Windows and their init.vim is at
"C:\Users\CrossR\init.vim"
, they would need to set it with escaped back slashes as follows:"oni.customInitVimPath" : "C:\\Users\\CrossR\\init.vim"
.Also since this is applied as an argument at startup, setting a custom path isn't applied until restarting oni currently. Is it worth looking into applying it straight away, or should that be a separate PR?