Oni: init.vim not loaded despite loadInitVim: true

Created on 12 Apr 2018  路  2Comments  路  Source: onivim/oni

Hello,

I have a very simple init.vim configuration:

set nonumber
set ignorecase
set smartcase
set norelativenumber
set expandtab
set tabstop=2
set shiftwidth=2

saved in ~/.config/nvim/init.vim,

and "oni.loadInitVim": true, in config.tsx.

Still, my vim settings are not being imported unless I also set "oni.useDefaultConfig": false, but then I lose the default Vim plugins.

I'm using Oni v.0.3.3

insider

Most helpful comment

At a guess, your settings might be being loaded but being overwritten by our default settings which can be seen here : https://github.com/onivim/oni/blob/master/vim/default/bundle/oni-vim-defaults/plugin/init.vim.

We have #973 to improve this, and hopefully soon the tab settings will be removed.

I've commented on what I think is happening to your settings:

set nonumber         "Overwritten most likely by the default set number
set ignorecase       "Set smartcase will overwrite set ignorecase I think?
set smartcase        "You'd need to pick between this and ignorecase.
set norelativenumber "Should be fine?
set expandtab        "Should be fine? Set in the default.
set tabstop=2        "Both of these are being over written by the default config.
set shiftwidth=2     "The default config sets them to 4.

We do actually provide an Oni specific way of setting these values too, which shouldn't be overwritten.
That can be done with "vim.setting.number": false, to set nonumber etc. That would look like:

    "vim.setting.number": false,
    "vim.setting.tabstop": 2,
    "vim.setting.softtabstop": 2,
    "vim.setting.shiftwidth": 2,

That said, the easiest way around this is like you've said with "oni.useDefaultConfig": false, and then installing the plugins Oni gives yourself.

That can either be done with a manual install to the plugin folder, use of a plugin manager like vim-plug, or soon Oni will be exposing a plugin API in the config.tsx that will automate the install to the plugin folder.

All 2 comments

At a guess, your settings might be being loaded but being overwritten by our default settings which can be seen here : https://github.com/onivim/oni/blob/master/vim/default/bundle/oni-vim-defaults/plugin/init.vim.

We have #973 to improve this, and hopefully soon the tab settings will be removed.

I've commented on what I think is happening to your settings:

set nonumber         "Overwritten most likely by the default set number
set ignorecase       "Set smartcase will overwrite set ignorecase I think?
set smartcase        "You'd need to pick between this and ignorecase.
set norelativenumber "Should be fine?
set expandtab        "Should be fine? Set in the default.
set tabstop=2        "Both of these are being over written by the default config.
set shiftwidth=2     "The default config sets them to 4.

We do actually provide an Oni specific way of setting these values too, which shouldn't be overwritten.
That can be done with "vim.setting.number": false, to set nonumber etc. That would look like:

    "vim.setting.number": false,
    "vim.setting.tabstop": 2,
    "vim.setting.softtabstop": 2,
    "vim.setting.shiftwidth": 2,

That said, the easiest way around this is like you've said with "oni.useDefaultConfig": false, and then installing the plugins Oni gives yourself.

That can either be done with a manual install to the plugin folder, use of a plugin manager like vim-plug, or soon Oni will be exposing a plugin API in the config.tsx that will automate the install to the plugin folder.

Thank you so much @CrossR, all that worked perfectly! I've set the options via the "vim.setting." properties so that I can still enjoy the rest of the default config.

So my init.vim was loaded but just all the settings overwritten either by itself (smartcase) or the default Oni config!

One more thing: I noticed that set shiftwidth=2 really helps a lot with the folding when it's set to indent. But it's probably because the way my files are indented...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Melkor333 picture Melkor333  路  23Comments

jordan-arenstein picture jordan-arenstein  路  22Comments

bryphe picture bryphe  路  19Comments

saibing picture saibing  路  21Comments

bryphe picture bryphe  路  22Comments