Hi Gary,
Thanks for the answer. I made couple of tests and this is what I found out.
It works perfect when I run "vim -N -u NONE" as you did.
When I run "vim -N --noplugin" there are some things I do not understand.
Test 1: "vim -N --noplugin" (no ~/.vimrc and no ~/.vim/filetype.vim)
:set rtp?
runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/v
im/vimfiles/after,~/.vim/after
:scriptnames
1: /etc/vimrc
2: /usr/share/vim/vim74/syntax/syntax.vim
3: /usr/share/vim/vim74/syntax/synload.vim
4: /usr/share/vim/vim74/syntax/syncolor.vim
5: /usr/share/vim/vim74/filetype.vim
6: /usr/share/vim/vim74/ftplugin.vim
Why does VIM load /etc/vimrc if the directory is not in rtp?
Test 2: "vim -N --noplugin" (without ~/.vimrc, with ~/.vim/filetype.vim)
:set rtp?
runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/v
im/vimfiles/after,~/.vim/after
:scriptnames
1: /etc/vimrc
2: /usr/share/vim/vim74/syntax/syntax.vim
3: /usr/share/vim/vim74/syntax/synload.vim
4: /usr/share/vim/vim74/syntax/syncolor.vim
5: ~/.vim/filetype.vim
6: /usr/share/vim/vim74/filetype.vim
7: /usr/share/vim/vim74/ftplugin.vim
Good ~/.vim/filetype.vim is before /usr/share/vim/vim74/filetype.vim like in
rtp list.
But I want to put my filetype outside my home directory, in test I used my
desktop.
Test 3: "vim -N --noplugin: (with ~/.vimrc (one line to change rtp), with
~/.vim/filetype.vim)
:set rtp?
runtimepath=~/Desktop,~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/u
sr/share/vim/vimfiles/after,~/.vim/after
:filetype on
:scriptnames
1: /etc/vimrc
2: /usr/share/vim/vim74/syntax/syntax.vim
3: /usr/share/vim/vim74/syntax/synload.vim
4: /usr/share/vim/vim74/syntax/syncolor.vim
5: ~/.vim/filetype.vim
6: /usr/share/vim/vim74/filetype.vim
7: /usr/share/vim/vim74/ftplugin.vim
8: ~/.vimrc
9: ~/Desktop/filetype.vim
Here I can see that filetype.vim from desktop is last but base on rtp it
should be first.
It looks like VIM does not load ~/Desktop/filetype.vim at the beginning
since rtp is updated with ~/.vimrc at point 7.
I am pretty sure all problems are made because /etc/vimrc. I do not
understand why VIM loads that file.
Right now I not able to touch that file since I have no permission (this is
computer at work).
Regards,
Bartosz
-----Original Message-----
From: vim_use@googlegroups.com [mailto:vim_use@googlegroups.com] On Behalf
Of Gary Johnson
Sent: Tuesday, November 19, 2013 9:58 PM
To: vim_use@googlegroups.com
Subject: Re: File type detection.
On 2013-11-19, Bartosz Gradzik wrote:
> Hi All,
>
> I want to use my own filetype.vim script to load a filetype plugin.
>
> When VIM start uses his own filetype.vim from installation directory
> and base on the file content incorrect file type is set.
> As I found in documentation (43.2 Adding a filetype) another
> filetype.vim will not set a new file type when it is already set for
> the file.
>
> Order which filetype.vim file is first I am checking with :scriptnames
> command.
>
> As I understand load order is control with runtimepath option. I
> changed &rtp to load my filetype.vim script before VIM's
> filetype.vim. It works on Windows but not on Redhat 5 (both have VIM
> 7.4).
>
> When I compare runtimepath option and scriptnames I see VIM load
> scripts not in order of paths from &rtp. Is it normal? Does not &rtp
> control order how the scripts are loaded?
Yes, it does. I have modified my 'rtp' in my ~/.vimrc and Vim sources
scripts in the order specifed by the modified 'rtp'.
> How can I force VIM to load my filetype.vim as first?
You shouldn't have to change anything to get Vim to source your filetype.vim
first. I have my own filetype.vim and as you can see here, it is sourced
first.
$ vim -N -u NONE
:filetype on
:scriptnames
1: ~/.vim/filetype.vim
2: /usr/local/share/vim/vim74/filetype.vim
Regards,
Gary
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
-----
Nie znaleziono wirusów w tej wiadomoĊci.
Sprawdzone przez AVG - www.avg.com
Wersja: 2014.0.4158 / Baza danych wirusów: 3629/6849 - Data wydania:
2013-11-19
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Wednesday, November 20, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment