Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error after 'source ~/.vimrc' after setting up pathogen

Tags:

vim

I get this error when I source my .vimrc file,

> source ~/.vimrc                                                                    
bash: /home/dev/.vimrc: line 1: syntax error near unexpected token `('
bash: /home/dev/.vimrc: line 1: `call pathogen#infect()'

The contents of my .vimrc file are,

call pathogen#infect()
syntax on
filetype plugin indent on

set smartindent
set tabstop=4
set shiftwidth=4
set expandtab

set backupdir=~/.vimbackup
set directory=~/.vimdir

I've also tried using 'execute pathogen#infect()' in the chance that it doesn't like the 'call' keyword.. and I've tried passing in the path to my bundle file as follows,

call pathogen#infect('~/.vim/bundle/{}')

I've also tried just putting 'bundle/{}' as the argument to infect... But I don't understand vim/bash well enough to know what direction to go in, would appreciate any help...

The reason I'm trying to source my .vimrc file is because everytime I use vim to edit a file I get litter from the file in the form of files being left that have this format,

.file_i_just_worked_on.un~

which is really annoying making my dir messy. I've read that I need to have

set backupdir=~/.vimbackup
set directory=~/.vimdir

to not have those files being dropped by vim everywhere... Would appreciate any help with this issue.

like image 246
user772401 Avatar asked Jun 30 '13 14:06

user772401


2 Answers

You're asking bash to read your .vimrc file, but it isn't equipped to parse that.

You instead need to have vim read it. You can either start a new instance of vim, or type :source ~/.vimrc from normal mode within a running vim session.

If vim is still creating backup files in your current directory, that may be because you haven't created the ~/.vimbackup or ~/.vimdir directory.

like image 119
qqx Avatar answered Oct 14 '22 06:10

qqx


As qqx mentioned, I need to ":source ~/.vimrc" inside of vim, not use bash...

To get rid of the .file.un~ files I need to have a

set undodir=path/to/dir

in my vimrc

like image 31
user772401 Avatar answered Oct 14 '22 07:10

user772401