I am trying to set up a .vimrc file in my home directory. The only thing it contains is the following.
" Enable syntax highlighting
syntax on
Whenever I want to source the file running . ~/.vimrc this message is returned.
/Users/username/.vimrc:3: unmatched "
My working environment is the following.
MacOS Lion 10.7.2
zsh 4.3.12 (i386-apple-darwin11.2.0)
oh_my_zsh
Terminal 2.2.1
VIM 7.3
How can I get rid of this warning/error message. What does it mean?!
EDIT
When I try the same from bash it does not work either.
bash-3.2$ . ~/.vimrc
bash: /Users/username/.vimrc: line 1: unexpected EOF while looking for matching `"'
bash: /Users/username/.vimrc: line 3: syntax error: unexpected end of file
bash-3.2$
you can run . ~/.bashrc in console
but you should run :source ~/.vimrc in vim
vim will run ~/.vimrc automatically, you don't need run it manually.
type :ver to check:
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$VIM\_gvimrc"
system menu file: "$VIMRUNTIME\menu.vim"
Put following code on head in your ~/.vimrc.
"return" 2>&- || "exit"
Related
When I try to use . .vimrc it gives and error:
bash: runtime! command not found
bash: syntax: command not found
bash: filetype: command not found
bash: filetype: command not found
It just randomly stopped working for no reason, all other dotfiles seem to work fine. The .vimrc contains this:
runtime! archlinux.vim
set number
set noswapfile
set nobackup
syntax on
set autoindent
set smartindent
set smarttab
filetype plugin on
filetype indent on
set incsearch
set hlsearch
It also gave an error inside a comment when it was there.
The . (or source) command is a bash command which reads a file (which should be a valid bash script) in the context of the current shell instance.
The .vimrc file is not a bash script, it's something that's read and processed by vim rather than bash.
It's no different to trying to compile C code with a Pascal compiler. The file content is not suitable for what you're trying to do with it. The .vimrc file should be automatically picked up next time you run a vim instance.
~/.vimrc is the runtime configuration file for vim i.e. the file will be read by vim when it starts and all the statements are vim specific.
As you are trying to source the file in bash, you are getting the errors as bash has no idea of the vim specific statements like runtime, syntax etc.
use vimorvi instead of source command to activate .vimrc.Because .vimrc is not *.sh like .bashrc and etc.
I'm a new python user. When I was installing postgresql and running the following order:
$vi ~/.bash_profile
Add PATH=/usr/pgsql-9.2/bin:$PATH before export PATH.
$source ~/.bash_profile
My terminal became very strange. It seemed that I could not logout of the .bash_profile environment. When I use any basic comments like cd, open, etc., something strange happens.
This is my output:
MynametekiMacBook-Air:~ Myname$ cd Documents/
-bash: dirname: command not found
MynametekiMacBook-Air:Documents Myname$ open ~/.bash_profile
-bash: open: command not found
MynametekiMacBook-Air:Documents Myname$ easy_install pip
-bash: easy_install: command not found
How would I fix this?
If you enter
$nano ~/.bash_profile
you will be able to edit your bash profile, you can remove the line that you added that is causing problems and try again, or see if there is a syntax error in what was entered. Once you've finished your edits you need to press ctl+o then enter to confirm and ctl+x to exit back to the bash prompt.
run /bin/mv ~/.bash_profile ~/.bp. Close your terminal. Reopen and look at the new .bp file with vim ~/.bp. Fix any errors and run mv ~/.bp ~/.bash_profile to revert.
Try export PATH=$PATH:/usr/pgsql-9.2/bin instead of Add PATH=/usr/pgsql-9.2/bin:$PATH. Because it looks like you made so your paths are being overwritten instead of being updated.
Trying to get Sublime Text 2 to work on my command line (Mac OS X) using the "subl" command.
Followed these simple instructions: https://www.sublimetext.com/docs/2/osx_command_line.html
When I do $ subl ~/.bashrc I get this error: -bash: subl: command not found. However, if I use the full path or even $ ~/bin/subl ~/.bashrc, the file will successfully open in Sublime.
What could cause the shortcut "subl" to not be found? Do I need to set this somewhere (bashrc, bash_profile, etc)?
That's because ~/bin is not set in your PATH. You can set it by adding one line to your .bash_profile:
export PATH=$PATH:~/bin
If you add ~/bin to your PATH environment variable, bash should be able to find subl:
export PATH=~/bin:${PATH}
Add this line to your .bashrc if you want subl available in every new bash session.
i am having a simple vimrc file when i run "source .vimrc" in ubuntu I am getting the following error.
$ source .vimrc
bash: .vimrc: line 3: syntax error near unexpected token `"syntax"'
bash: .vimrc: line 3: `if has("syntax")'
Here is my script file
set term=builtin_ansi
set nu
if has("syntax")
syntax on
endif
I do have syntax installed in my vim.
vim --version | grep syntax
vim: /home/shankaran/src/ns/service/build/dp/lib/libcrypto.so.1.0.0: no version information available (required by /usr/lib/libpython2.7.so.1.0)
vim: /home/shankaran/src/ns/service/build/dp/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/libpython2.7.so.1.0)
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
You tried to source your Vim configuration file from bash. Do it from Vim:
$ vim
:source /path/to/.vimrc
If it's located at ~/.vimrc, Vim will source that file automatically.
I usually do
:so $MYVIMRC
Just type
:so $MY[tab]
and it will autocomplete for you.
When running this in terminal:
$ curl -L https://get.rvm.io | bash -s
It seems to work fine, but in the Upgrade Notes at the end it says
* WARNING: You have '~/.profile' file, you might want to load it,
to do that add the following line to '/Users/steven/.bash_profile':
source ~/.profile
And I can't use RVM, getting the error
-bash: rvm: command not found'
I am pretty new to terminal and Ruby, so any help would be greatly appreciated.
When you install rvm its paths get added to ~/.bash_profile. RVM will warn you about this during installation as you noticed. You could run source ~/.profile each time you load the terminal, but that's a pain in the neck.
From the bash docs:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
What this means is that /.bash_profile is being run, and /.profile and /.bashrc are being ignored.
To resolve this just open .bash_profile and copy the rvm paths at the top and paste them at the top of your .bashrc file. Open a new terminal window and it should be working just fine.
You can either delete .bash_profile, if it's empty, or copy and paste the contents of ~/.profile into it if you choose to keep it.
Do as the instruction said.
From the RVM Troubleshooting page.
If your .bash_profile isn't being correctly loaded on OSX, you need to do one of three things:
Create a file named ~/.bash_profile and add the RVM source line there
Add the RVM source line to ~/.profile
In your terminal preferences, change the shell from the default of /usr/bin/login to /bin/bash.
So, check if you have /Users/steven/.bash_profile in your system. If it is present, open the file and add that line at end of file:
source ~/.profile
else create the file and add it.