tags:

views:

220

answers:

3

(I'm new to Linux and Vim, and I'm trying to learn Vim but I'm having some issues with it that I can't seen do fix)

I'm in a Linux installation (Ubuntu 8.04) that I can't update, using Vim 7.1.138.

My vim installation is in /usr/share/vim/vim71/. /home/user/

My .vimrc file is in /home/user/.vimrc, as follows:

fun! MySys()
    return "linux"
endfun

set runtimepath=~/.vim,$VIMRUTNTIME
source ~/.vim/.vimrc

And then, in my /home/user/.vim/.vimrc:

" =============== GENERAL CONFIG ==============
set nocompatible
syntax on

" =============== ENCODING AND FILE TYPES =====
set encoding=utf8
set ffs=unix,dos,mac

" =============== INDENTING ===================
set ai " Automatically set the indent of a new line (local to buffer)
set si " smartindent (local to buffer)

" =============== FONT ========================
" Set font according to system
if MySys() == "mac"
  set gfn=Bitstream\ Vera\ Sans\ Mono:h13
  set shell=/bin/bash
elseif MySys() == "windows"
  set gfn=Bitstream\ Vera\ Sans\ Mono:h10
elseif MySys() == "linux"
  set gfn=Inconsolata\ 14
  set shell=/bin/bash
endif

" =============== COLORS ======================
colorscheme molokai

" ============== PLUGINS ======================
" -------------- NERDTree ---------------------
:noremap ,n :NERDTreeToggle<CR>

" =============== DIRECTORIES =================
set backupdir=~/.backup/vim
set directory=~/.swap/vim

...fact is the command syntax on is not working, neither in vim or gvim. And the strange thing is: If I try to set the syntax using the gvim toolbat, it works. Then, in normal mode in gvim, after activating using the toolbar, using the code :syntax off, it works, and just after doing this trying to do :syntax on doesn't work!!

I have the syntax files in both /usr/share/vim/vim71/ and home folders (in the home there's only a python syntax module). I've run sudo aptitude install vim as well and there's nothing do download, EXCEPT vim-gtk, since I was afraid of some kind of incompatibility.

What's going on? Am I missing something?

A: 

Ubuntu default install doesn't install all of vim.

sudo apt-get install vim
Nick Canzoneri
I've updated my question, I've downloaded all packages except vim-gtk...
Somebody still uses you MS-DOS
A: 

Try adding filetype plugin on before syntax on in your .vimrc.

Randy Morris
I added, and still doesn't work. :(
Somebody still uses you MS-DOS
+2  A: 

Let's break this down into something simple. Instead of trying to debug multiple possible points of failure (source, runtimepath), see if the simplest case works. Then, add back in each piece until something breaks.

First of all, make sure your ~/.vimrc/ and ~/.vim/.vimrc are checked into version control or save off a copy. Also, unless you've modified the original python syntax module for some reason, there should be no need to have it located in your ~/.vim directory.

Now, delete the contents of both .vimrc files and add only the following two lines to your ~/.vimrc file.

filetype plugin on
syntax on

Now, open up a new vim session with the file you're trying to syntax highlight. Does it work? I would expect this to work in most cases if the filetype is being detected properly.

:set filetype?

If the syntax highlighting isn't working and the filetype is correct there's something more wrong than just your .vimrc files. You could try removing your ~/.vim directory too to see if that's the problem.

I'm not sure why you're setting your runtimepath but when I check mine, it shows ~/.vim as the first entry (and there are a lot more directories than just VIMRUNTIME) by default so that line shouldn't be necessary.

:set runtimepath?

Also, VIMRUNTIME is misspelled. I expect this is your problem. If I use your set runtimepath from above, I lose syntax highlighting as well.

Hope this helps.

Curt Nelson
@Curt. That's the mispelling. I'm really ashamed of it... at least I know you really read all my config to help me. :) The error is still strange since all the other configuration were working, except the syntax. And thanks for the suggestion of the simple case to test.
Somebody still uses you MS-DOS