Why ~/.vimrc is not working for vim on ubuntu server - vim

I installed ubuntu server on vmware player. I want to use vim, so I put .vimrc file under my home directory.
But when I open vim, vim is not using the configuration from the file ~/.vimrc.
If I do it the same way on a ubuntu desktop virtual machine, everything works fine.
What did I do wrong in the server environment? What else should I do?

In order to tell if your .vimrc is running at all, put
echom ".vimrc message 1"
On the first line of ~/.vimrc
Then launch vim and type
:messages
in regular mode. If you see ".vimrc message 1", you know that the .vimrc is at least being read ... it may be stopping before it does anything useful, but at least vim is picking it up.
I would also try which vim to see which program is being called when you type vim.

You can capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog log file. It will show where Vim searched.
Does Vim correctly detect your home directory? :echo $HOME will tell you.
Also, read :help .vimrc for details on the resolution and locations of .vimrc.

Related

SPF VIM syntax on by default

I just installed spf13 vim on my machine with CentOS. One thing I noticed is that I was not able to set "syntax on" by default.
The difference are the parenthesis color and the GLOB color. The default color is very light on my monitor, so really want to set syntax on by default.
I am not sure what went wrong. Here is my ~/.vimrc.local
filetype plugin on
syntax on
Setting up vim defaults can be funky on new installs.
First, confirm that the rc is being sourced.
Place the line echom "file is sourced on startup" into your .vimrc.
Open a new instance of vim. Type :messages then <return>. If you don't see that line, the file isn't being sourced.
To find out where vim is looking for your .vimrc:
Enter the command :echo $HOME. The folder it outputs is a good place to try putting a .vimrc or .vimrc.local file. Try both of those.
Also try :e $MYVIMRC, which might find the file you need to edit anyway.
Finally, make sure to put set nocompatible in your rc.

vundle: ConqueTerm: not an edit command

I tried to install Conque-Shell via Vundle, and when I input :ConqueTerm bash in vim, it showed 'ConqueTerm: Not an edit command'. I thought there was something wrong with my path. But I did write set rtp+=~/.vim/bundle/vundle in my .gvimrc. And the configure of Vundle is at the beginning of the .gvimrc.
I copied the .vim/bundle/Conque-Shell/plugin/conque_term.vim to .vim/plugin/conque_term.vim and then it worked.
So, is there anything wrong with my .gvimrc?? Thanks!
My .gvimrc: https://gist.github.com/guori12321/5506991
If you observe the output of :scriptnames (the list of scripts sourced during startup), you'll note that .gvimrc comes last, after .vimrc and the plugins. Therefore, any changes to the 'runtimepath' there are too late; plugins (like ConqueTerm) have already been loaded. You can read more about the startup process at :help initialization.
Even if you only use the GUI GVIM, put the common settings into ~/.vimrc; the ~/.gvimrc file is for GUI-only stuff that doesn't apply to the terminal Vim, e.g. setting 'guifont' and similar options.

MacVim: slimv does not start

I'm using MacVim (kind of gvim for OSX) and try to get the slimv plugin running.
Sadly it's not working out of the box. In fact, it does not start up at all.
My setup:
MacVim (32bit cause of this) (vim 7.3)
:scriptnames does not list ftplugin/slimv.vim while plugin/paredit.vim is listed
:set ft? shows filetype=lisp for .lisp files
:messages shows no errors
:filetype filetype detection:ON plugin:ON indent:ON
:echo g:paredit_loaded 1
:echo g:slimv_loaded E121: Undefined variable: g:slimv_loaded \ E15: Invalid expression: g:slimv_loaded
compiled with +python (2.7)
SBCL and slime are installed - works flawless with emacs.
I tried it with and without let g:slimv_swank_cmd = ... in .vimrc and changed the line recommended on the plugin page from
let g:slimv_swank_cmd = '!osascript -e "tell application \"Terminal\" to do script \"sbcl --load ~/.vim/slime/start-swank.lisp\""'
to
let g:slimv_swank_cmd = '!sh -c "sbcl --load /Applications/MacVim.app/Contents/Resources/vim/runtime/slime/start-swank.lisp" &'
since the osascript was not working and I don't know how to fix it. But a similar call to xterm is sufficient for Linux so my sh call should be fine.
Well, I got no idea what to try next. :/
The problem got solved by installing slimv to ~/.vim instead of the vim ebedded in MacVim. Maybe some kind of bug? However, Common Lisp + vim - I just love it.
Because moving the slimv plugin to ~/.vim fixed it, I suspect the problem is that MacVim's default /Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin/lisp.vim is being sourced before the ftplugin/lisp/slimv-lisp.vim file provided with slimv.
Both of those files (lisp.vim and slimv-lisp.vim) start with code like this:
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
and so whichever file gets sourced first will prevent the other file from running since vim does finish (exits the script) if it detects that another *lisp*.vim script was run previously and therefore set the b:did_ftplugin buffer-local variable.
You can tell this is happening by running MacVim from the command line with the arguments:
-V20macvim-log.txt hello.lisp
Then quit the MacVim session that starts up, and look at the macvim-log.txt file it created.
Search for b:did_ftplugin and you'll see it referenced each time lisp.vim or slimv-lisp.vim runs, and you can see that lisp.vim runs first, which prevents slimv-lisp.vim from working.
Moving your slimv install from the /Applications/MacVim.app/ dir to your ~/.vim dir will change the order so that slimv-lisp.vim is sourced before lisp.vim, and then slimv will work.
If slimv.vim is not listed in :scriptnames and g:slimv_loaded is undefined then you don't have the plugin loaded at all. I guess you don't have filetype plugins enabled. Paredit is a general plugin but slimv.vim is a filetype plugin and filetype/indent plugins must explicitly be enabled. Try to add these lines to your .vimrc:
filetype plugin on
filetype indent on
The problem got solved by installing slimv to ~/.vim instead of the vim ebedded in MacVim. Maybe some kind of bug?
However, Common Lisp + vim - I just love it.

Trouble with vimrc file recognition with MacVim

I'm having difficulty getting MacVim (7.3-64) to recognize my .vimrc and .gvimrc files since upgrading to OS X 10.7.3. Previous, I've simply symlinked my .vimrc and .gvimrc using these commmands:
$ ln -s ~/.vim/vimrc /usr/local/Cellar/macvim/7.3-57/MacVim.app/Contents/Resources/vim/.vimrc
$ ln -s ~/.vim/gvimrc /usr/local/Cellar/macvim/7.3-57/MacVim.app/Contents/Resources/vim/.gvimrc
However, when I currently symlink my rc files, I can not get MacVim to recognize them. I've installed MacVim via Homebrew. Does anyone have any suggests as to what the problem could be?
The ~/.vim/ folder (for colorschemes and scripts) and the ~/.vimrc file (for custom settings and mappings) are guaranteed to work on every UNIX-like systems but neither of these are required for Vim (and MacVim) to work properly.
Start without symlinks or whatever : no .vim folder and no .vimrc or .gvimrc in your home folder. Does MacVim work? You are supposed to see a window with some introductory text, do you see that?
Quit MacVim and turn to the original .(g)vimrc files you want to use: where are they located? Where did you get them from? What is their content? Do you actually, really need them? Do their names actually start with a dot (do you see them or not in the Finder)? What is their encoding (in vim, :set fileencoding? and in the terminal, $ file /path/to/original/.vimrc)? Please, paste the content of the .vimrc file you want to use in your question.
If you are absolutely certain you need these files to work efficiently in Vim and assuming you actually have a custom .vimrc somewhere on your Mac, open Terminal.app and type this command (without the $):
$ cp /path/to/original/.vimrc ~/.vimrc
to copy your .vimrc to the canonical location.
Now launch MacVim. What do you see? You are supposed to see a window with some introductory text, is that what you see?
If MacVim doesn't work correctly with your ~/.vimrc you might want to comment its content, relaunch MacVim, uncomment a few lines and so on until you eventually find a bad setting.
Just put your .vimrc and .gvimrc into your home directory, i.e. ~/ It's picked up there allright.
BTW, you don't need to link to the homebrew dir. Those rc files are default files which you can override with your local user files.

Vim commands :Explore :Sexplore :Hexplore doesn't work in cygwin

3.3 in cywing 2.721, the installation was made using cywing, every thing works but when I try to use the following command.
:Explore
vim said E492: Not an editor command
also neither :Sexplore or :Hexplore works.
is there any way to activate this functionality?
This is in machine with windows xp.
Well I solved reading the
:help usr_01.txt
It said that is necessary to run this command !cp -i $VIMRUNTIME/vimrc_example.vim ~/.vimrc inside vim, it just copy a .vimrc to home user.
I close and opened vim and :Explore, Hexplore, Vexplore worked.
I had the same problem as well. Since it's a fresh install of Vim you don't have a .vimrc (or _vimrc on Windows). A vimrc is Vim's configuration file, and once you have one Vim will no longer try to be compatible with Vi (usually what you want).
So all you have to do is create a vimrc file and you should be ready to :Explore all you want. Below are locations you can put your vimrc file, and the filename to use for it. (depending on your system)
Unix/Linux/OSX: $HOME/.vimrc or $HOME/.vim/vimrc
MS-Windows: $HOME/_vimrc, $HOME/vimfiles/vimrc
or $VIM/_vimrc
sources:
* :help 'compatible'
* :help 'vimrc'
I also recommend following atomsfat's answer as well to give you a simple vimrc to start out with.
Those commands are provided by the netrw plugin. Check :scriptnames to see if that plugin is loaded.

Resources