0

I am using Vim 7.4 on Linux with Vundle and Git. I am writing my own plugin called potion (following an example in the book LEARN VIMSCRIPT THE HARD WAY by Steve Losh) that is stored in my GitHub repository.

The potion folder structure looks like the following:

potion
+ README
+ LICENSE
- colors/
   + potion.vim
- doc/
   + potion.txt
- ftdetect/
   + potion.vim

The ftdetect/potion.vim file has the following code:

echomsg "Hello world"
au BufNewFile,BufRead *.pn set filetype=potion

When I call :PluginUpdate in my .vimrc, the files get downloaded from Git to my local system OK. When I vim a .pn file I can load a colorscheme "potion" OK, so that part works, but the autocommand is not setting the filetype to "potion" correctly and the "Hello world" message never displays. Why is ftdetect/potion.vim not getting run?

EDIT

The full path of the potion directory is ~/.vim/bundle/Vundle.vim/potion/.

The full path of the autoread file is: ~/.vim/bundle/Vundle.vim/potion/ftdetect/potion.vim

The full content of my .vimrc is as follows:

set nocompatible

filetype off                   " required
filetype plugin on

let g:vundle_path = "~/.vim/bundle/Vundle.vim/"
set rtp+=~/.vim/bundle/Vundle.vim/

if !isdirectory(expand(g:vundle_path))
  echomsg "ERROR: Vundle path '" . g:vundle_path . "' does not exist."
  finish
endif

try
  call vundle#begin(g:vundle_path)
catch
  echomsg "ERROR: Could not call Vundle#begin(). Exception: " . v:exception
  finish
endtry

Plugin 'adelarsq/vim-matchit'
Plugin 'MisterSnrub/potion'

call vundle#end() " required!

filetype plugin indent on     " required

I am using Vim 7.4 because that's what's on our system. Nothing I can do about that, sorry.

7
  • What is the full path of that potion directory? Can we see your full vimrc? Also, why 7.4? Current version is 9.1. Commented Aug 14, 2024 at 10:09
  • Added the answers to your questions to the original post. Hope that helps. Commented Aug 14, 2024 at 10:46
  • Does it work when you manually copy the files into your runtimepath; without Vundle? Commented Aug 14, 2024 at 14:30
  • 1
    Yes, it does. If I run cp ~/.vim/bundle/potion/ftdetect/potion.vim ~/.vim/ftdetect/. and then vim a file factorial.pn it will echo the hello world message (twice for some reason) and set the filetype as a potion file. Commented Aug 14, 2024 at 15:29
  • Looks like a vundle issue to me, which is unfortunate because it is no longer supported. Commented Aug 14, 2024 at 17:53

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.