0

I have my .vimrc file in a custom location (~/dotfiles/vim/.vimrc). When I type i:

vim 'filename'

I would like to execute the command:

vim -u ~/dotfiles/vim/.vimrc 'filename'

I put this function in my .bashrc:

function vim() {
    vim -u  ~/dotfiles/vim/.vimrc $1
}

However, I don't see the changes from my .vimrc, pretty sure the standard vim is opened.

8
  • 1
    did you do a source .bashrc after adding the function? Or close and re-open the file again?
    – Inian
    Mar 27, 2018 at 12:02
  • No, but I tried it now. It still does not work.
    – cmplx96
    Mar 27, 2018 at 12:09
  • But the syntax is correct?
    – cmplx96
    Mar 27, 2018 at 12:09
  • 1
    Could you change the function name to be slightly different then actual vim name something like vimf? and open the file as vimf <filename>
    – Inian
    Mar 27, 2018 at 12:10
  • 2
    You should probably use command vim to avoid recursion in your function. Mar 27, 2018 at 12:13

1 Answer 1

0

If it is not necessary to use bash for this, it can be accomplished through a symlink. It would be a file reference from the default location to your custom location.

ln -s ~/dotfiles/vim/.vimrc ~/.vimrc

This method will still allow you maintain everything in ~/dotfiles, editing such as vim ~/.vimrc will be the same as vim ~/dotfiles/vim/.vimrc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .