Search code examples
vimsyntax-highlightingfishvim-syntax-highlighting

Syntax coloring with Vim and Fish-Shell


What is the best editor for fish scripts? I mean an editor which can properly highlight, indent and syntax check.

I found the vim-fish project, but I am still scratching my head as to how to install it locally.


Solution

  • You just copy all those files and directories inside the repository into ~/.vim. However, the recommended way is to use something like vundle or pathogen

    For vundle:

    Run these commands:

    mkdir -p ~/.vim/bundle
    git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
    touch ~/.vimrc
    

    Then add this to your ~/.vimrc

    set nocompatible
    filetype off
    
    set rtp+=~/.vim/bundle/vundle/
    call vundle#rc()
    
    Bundle 'gmarik/vundle'
    Bundle 'dag/vim-fish'
    
    filetype plugin indent on
    

    Next time you launch vim you can run the command :BundleInstall to get vim-fish installed.

    If you want this to work with funced and other potential scripts that should use the fish-syntax you can add something like this to ~/.vim/ftdetect/fish.vim:

    au BufNewFile,BufRead fish_funced set ft=fish