Moved .vimrc in a new dir, trying to get it to work

472 views Asked by At

Disclaimer: I'm new to vim/tmux. I'm on a Mac using MacVim I was told to use version control on my dotfiles.

Before my dot files were all placed in my root ~ like so:

~/
  .vimrc
  .tmux.conf
  .vim
    /bundle
    /autoload 
  .viminfo
    etc

But then I figured it would be a good idea to make a folder named "dotfiles", and house them all in there and then upload it to github so I can have them anywhere.

Like so:

~/
   /dotfiles
      .vimrc
      .tmux.conf
      .vim
        /bundle
        /autoload 
      .viminfo
        etc

At first I thought everything was okay, becuase I never closed Vim, but when I reloaded it later, I realized none of my commands were working anymore. So I went in an changed some paths in my .vimrc and in my .tmux.conf in hopes that it would work again, but no luck.

Here is my full .vimrc:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/dotfiles/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'christoomey/vim-tmux-navigator'
" " All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" " To ignore plugin indent changes, instead use:
" "filetype plugin on
" "
" " Brief help
" " :PluginList       - lists configured plugins
" " :PluginInstall    - installs plugins; append `!` to update or just
" :PluginUpdate
" " :PluginSearch foo - searches for foo; append `!` to refresh local cache
" " :PluginClean      - confirms removal of unused plugins; append `!` to
" auto-approve removal
" "
" " see :h vundle for more details or wiki for FAQ
" " Put your non-Plugin stuff after this line


execute pathogen#infect()
syntax on
filetype plugin indent on
set mouse=a

let g:tmux_navigator_no_mappings = 1

nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
nnoremap <silent> <c-l> :TmuxNavigateRight<cr>
nnoremap <silent> <c-/> :TmuxNavigatePrevious<cr>

let g:tmux_navigator_save_on_switch = 1

vnoremap <C-c> "*y

set runtimepath^=~/dotfiles/.vim/bundle/ctrlp.vim

As you can see, the paths have been corrected to incorporate the /dotfiles/ directory, yet anytime I try to run a plugin or something in my .vimrc, I get a generic 'Not an editor command' error.

Incidentally, tmux and all its configuration seems to be working fine after it being moved around.

Any Ideas?

2

There are 2 answers

0
romainl On BEST ANSWER

I was told to use version control on my dotfiles.

Maybe you should turn to the people who told you to do that for support, don't you think?

  1. Putting all your dotfiles in a single repo is not a requisite or even an objectively good idea. It could work for some people but only if you manage to point your programs to that centralized place (great) or if you symlink those files to their regular location (which kind of defeats the point). The people who told you to use version control on your dotfiles should have told you how to do that from start to finish.

  2. Vim expects your vim directory and your vimrc to be in default locations:

    ~/.vim
    ~/.vimrc or ~/.vim/vimrc
    

    It won't look elsewhere so you'll have to symlink them from your repo to their expected location:

    $ ln -s /Users/username/dotfiles/.vim /Users/username/.vim
    $ ln -s /Users/username/dotfiles/.vimrc /Users/username/.vimrc
    
0
statox On

This idea to put all of your dotfiles in a same directory is not bad as @romainl said in his answer you have to symlink them to their original place.

That's what I did so you may be interested in the script I created to automatically save the current dotfiles in my home directory and replace them with a simlink to the dotfiles in my repo. (You can also clone my repo, replace the dotfiles by yours and execute the script. I tried to make the readme as clear as possible but if you're interested in using my solution don't hesitate to message me for support)