Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend :checkhealth to migrate vimrc #4877

Closed
justinmk opened this issue Jun 5, 2016 · 17 comments
Closed

extend :checkhealth to migrate vimrc #4877

justinmk opened this issue Jun 5, 2016 · 17 comments
Labels
complexity:low Low-risk. Do NOT ask "can I work on this", just read CONTRIBUTING.md enhancement feature request ux user experience
Milestone

Comments

@justinmk
Copy link
Member

justinmk commented Jun 5, 2016

If running interactively, we should:

  • create an init.vim automatically
  • check if ~/.vimrc exists and offer to import it (or link to it? one or the other, not both--keep it simple)
@justinmk justinmk added the enhancement feature request label Jun 5, 2016
@justinmk justinmk added this to the 0.3 milestone Jun 5, 2016
@justinmk justinmk changed the title create init.vim if ran without arguments. create init.vim if invoked without arguments. Jun 5, 2016
@wsdjeg
Copy link
Contributor

wsdjeg commented Jun 5, 2016

@justinmk I think it is nice feature, but all the situation should be considered.for me
both~/.vim and ~/.config/nvim are linked to ~/Dotfiles/config/nvim, and in ~/Dotfiles/config/nvim I have two files init.vim and vimrc.
that means I do not use ~/.vimrc,just use ~/.vim/vimrc instead.

@justinmk justinmk added the ux user experience label Jun 16, 2016
@fmoralesc
Copy link
Contributor

I think this should work like this:

  1. Check for the existence of the init.vim file. If it doesn't exist:

  2. Search for candidate init files: ~/.vimrc, ~/.vim/vimrc, etc. (resolve links)

  3. If no candidates are found, create an empty ~/.config/nvim/init.vim file without prompting the user.

  4. If candidates are found,

    a. if there is only one candidate, ask the user if he wants to use it.
    b. prompt the user, sorting by modification date, preselecting the most recent and marking it at such in the list (so it is obvious).

Should this be done in viml as a plugin or should it be hardcoded?

@justinmk
Copy link
Member Author

autoload VimL function if MYVIMRC is empty?

@jamessan
Copy link
Member

jamessan commented Jun 16, 2016

create an init.vim automatically

👎 for creating stuff in the user's home directory when it isn't needed.

check if ~/.vimrc exists and offer to import it (or link to it? one or the other, not both--keep it simple)

👍 for helping migrate existing settings.

@fmoralesc
Copy link
Contributor

@jamessan We can use the chance to implement some of the "softer" defaults in #2676. Creating an empty file would be necessary also if we didn't want to prompt the user every time they run nvim...

@jamessan
Copy link
Member

No we wouldn't. Other metadata (e.g., the shada directory) is created that can detect whether the user has run nvim before.

But if it came down to a choice between risking prompting the users multiple times or creating unnecessary content, I would come down on the side of doing nothing. We already have better defaults. I don't see a reason to create files the user may not want just because so many other programs have that disease.

@fmoralesc
Copy link
Contributor

Fair enough ;)

@KillTheMule
Copy link
Contributor

I agree with jamessan.

@mhinz
Copy link
Member

mhinz commented Jun 16, 2016

Hmm, feels a bit like too much handholding.

Maybe we should rather go for an explicit command like :Intro (following :Tutor) that interactively explains differences, default values etc. between Vim and Neovim. Somewhere during this Intro linking or creating could be offered.

And :Intro could then be mentioned on the intro screen.

Neovim should be usable without hassle for people who just want to quickly edit config files (without having an own init.vim), like so many admins do.

@wsdjeg
Copy link
Contributor

wsdjeg commented Jun 16, 2016

@mhinz nice idea.

@fmoralesc
Copy link
Contributor

We could actually make :Tutor offer to do this and make it actionable, after all we do mention the init file at the end of the default tutorial.

@justinmk
Copy link
Member Author

justinmk commented Jun 16, 2016

:checkhealth could be extended to do any steps that requiring prompting or migration.

But if it came down to a choice between risking prompting the users multiple times or creating unnecessary content, I would come down on the side of doing nothing. We already have better defaults. I don't see a reason to create files the user may not want just because so many other programs have that disease.

I emphatically agree with that sentiment, my thinking was that silently creating an empty init.vim is no worse than silently creating a viminfo file. Remember this is only for invocations where nvim is started without any arguments. A benefit is that it allows us to use deterministic language with new users:

  • "How do I edit my config?" => :edit $MYVIMRC
  • "Where is my config?" => :echo $MYVIMRC

@jamessan
Copy link
Member

my thinking was that silently creating an empty init.vim is no worse than silently creating a viminfo file.

An empty init.vim has no added benefit to the user experience (unlike an empty vimrc did with Vim), while a viminfo/shada file is beneficial.

A benefit is that it allows us to use deterministic language with new users

I do see the benefit to this, but for me it's still not enough to create unnecessary content in the user's $HOME. Those commands would have worked fine pre-XDG since there wasn't an intermediate set of directories that may need to be created. In a sense, we've made that aspect of the initial UX worse.

@justinmk
Copy link
Member Author

justinmk commented Jun 16, 2016

Those commands would have worked fine pre-XDG since there wasn't an intermediate set of directories that may need to be created. In a sense, we've made that aspect of the initial UX worse.

Isn't that another reason in favor of creating the file by default? To save the user the hassle of bootstrapping that path. :edit $MYVIMRC will work just fine because the stub init.vim will respect XDG_CONFIG_HOME.

@jamessan
Copy link
Member

IMO, no, because it perpetuates the misbehavior of programs creating unnecessary files. It's simple enough to document the default location of the init.vim and people can create it if they want (or have it created by :Tutor as @fmoralesc proposed).

@justinmk justinmk changed the title create init.vim if invoked without arguments. extend :CheckHealth to migrate vimrc Jun 16, 2016
@justinmk justinmk added the complexity:low Low-risk. Do NOT ask "can I work on this", just read CONTRIBUTING.md label Oct 17, 2016
@tbodt
Copy link

tbodt commented Mar 3, 2017

I think that if on startup ~/.vimrc or ~/.vim exists but ~/.config/nvim does not, it should tell the user that the config files have moved and offer to:

  • copy the files
  • move the files
  • create symlinks
  • don't ask again

@sammbeller
Copy link

sammbeller commented Jul 13, 2017

From the nvim-from-vim document, the suggestion is to put the following lines in your init.vim

    set runtimepath^=~/.vim runtimepath+=~/.vim/after
    let &packpath = &runtimepath
    source ~/.vimrc

If there is no init.vim and there exists a .vim or .vimrc, why not offer to create an empty init.vim in the default location and also offer to insert the above lines into it?

sohnryang added a commit to sohnryang/neovim that referenced this issue Feb 5, 2018
@justinmk justinmk changed the title extend :CheckHealth to migrate vimrc extend :checkhealth to migrate vimrc Feb 5, 2018
@justinmk justinmk modified the milestones: 0.4, unplanned Aug 26, 2018
@justinmk justinmk added this to the todo milestone Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity:low Low-risk. Do NOT ask "can I work on this", just read CONTRIBUTING.md enhancement feature request ux user experience
Projects
None yet
Development

No branches or pull requests

8 participants