1

I have both Vim version 8.1.1550 and NVIM v0.4.3 on MacOS 10.14.6

I wrote the following lines in my .vimrc file as recommended enter link description here

set nocompatible
filetype off

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

Bundle 'gmarik/vundle'
Bundle 'dag/vim-fish'

filetype plugin indent on    " required
highlight LineNr ctermfg=grey

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

As indicated here, I also created a ~/.vim/ftplugin/fish.vim file and inserted the following in it:

" Set up :make to use fish for syntax checking.
compiler fish

" Set this to have long lines wrap inside comments.
setlocal textwidth=79

" Enable folding of block structures in fish.
setlocal foldmethod=expr

However I don't have highlighting for the following fish_prompt.fish file when opening it with vim

function fish_prompt
    set_color $fish_color_cwd
    echo ' [' (prompt_pwd) ' ] > '
end

1

Your Vundle configuration looks incorrect. You should call vundle#begin() at the start, before the Bundle commands. And you should call vundle#end() at the end of that section, before you re-enable filetype detection and plug-ins.

(The vundle#rc() function is an old way to initialize Vundle, it's deprecated now in favor of vundle#begin().)

See the Vundle Getting Started page for more details.

You probably also need to have syntax enable somewhere in your vimrc (not sure if it's there, only not showing in your small snippet.)

You should also use the canonical and more modern 'VundleVim/Vundle.vim' location for Vundle itself. (You might need to reinstall it into that location, see the first steps in the Getting Started guide for instructions on that.)

I also switched the plug-in declarations to use the more modern Plugin instead of the older Bundle. (Vundle went through a few iterations of renaming things...)

Putting it all together:

set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'dag/vim-fish'

call vundle#end()

filetype plugin indent on    " required
syntax enable
highlight LineNr ctermfg=grey

Hopefully straightening up your Vundle setup will get your fish syntax highlighting working as expected.


Personally, I'd actually recommend that you consider migrating from Vundle to vim-plug, which is a much more modern take on a plug-in manager that is still similar to Vundle (such that users of Vundle will see a familiar environment in vim-plug.) You could say vim-plug is in a way a successor to Vundle in that sense.

You can simply install vim-plug with a simple shell command:

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
      https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

After installing it, update your vimrc to the following configuration:

call plug#begin()

Plug 'dag/vim-fish'

call plug#end()

filetype plugin indent on  " optional!
syntax enable
highlight LineNr ctermfg=grey

That's all! No messing with rtp or having to set filetype off and back on in the right order and locations...

Once you start Vim with this configuration, simply run :PlugInstall to have your plug-ins installed by vim-plug. (Similar to how you would have used :VundleInstall or :PluginInstall on Vundle.)

See vim-plug's documentation for more. In particular, you might want to take a look at this section on migrating from other plug-in managers, Vundle in particular.

| improve this answer | |
  • Brilliant extensive answer. Many thanks @filbranden – ecjb Apr 25 at 22:29
  • @ecjb I'm glad it helped! Let me know if everything worked as expected or if anything might need adjusting. – filbranden Apr 25 at 22:32
  • 1
    it worked perfectly @filbranden – ecjb Apr 25 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.