15

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.

Enlico
  • 23,259
  • 6
  • 48
  • 102
Olivier Refalo
  • 50,287
  • 22
  • 91
  • 122

2 Answers2

22

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
terje
  • 4,164
  • 2
  • 28
  • 28
  • 1
    In addition, if you have Pathogen installed just clone it to the ~/.vim/bundle folder so you have ~/.vim/bundle/vim-fish/. Works if you open a .fish file with Vim but doesn't work with `funced`. – Elijah Lynn Jul 01 '15 at 04:02
4

Alternatively I would advice you to install it via vim-plug which is quite minimalist:

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

Add the following code to your .vimrc file:

call plug#begin('~/.vim/plugged')

" Make sure you use single quotes for comment

Plug 'dag/vim-fish'

" Add plugins to &runtimepath
call plug#end()

Reload .vimrc and :PlugInstall to install plugins.

Martin Delille
  • 11,360
  • 15
  • 65
  • 132