Skip to content

EdwinHu233/fish.vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fish.vim

This is a Vim/Neovim plugin that provides Fish syntax highlighting, automatic indentation as you type, file detection, and a colorscheme matching Fish's default shell highlighting.

The syntax highlighting is very close to how fish highlights text in an interactive shell. Try comparing type fish_prompt and funced --editor=vim fish_prompt (or --editor=nvim if you use Neovim). They should be exactly the same or very similar, assuming your fish and vim colors match.

Example (left is a shell, right is vim):

comparison example

Please open an issue if you encounter differences in highlighting.


Install with vim-plug

Plug 'nickeb96/fish.vim'

It should also work with other plugin managers.


Fish Default Colorscheme

Use :colorscheme fish-default to have the editor use the same colors that Fish uses by default. This colorscheme only works with fish files, so use a conditional autocommand in your config file to set it:

autocommand FileType fish colorscheme fish-default

⚠️ Fish's default shell colors only use the basic 16 terminal colors. These are set by the terminal emulator and the exact RGB values can't be determined by programs running inside of it. This means that if you have Vim/Neovim running in GUI mode, the colors won't exactly match what you see in a shell. You'll instead get colors from the Tomorrow Night theme, which I've set as a fallback.

You can use autocommand FileType fish set notermguicolors to force Vim/Neovim to use the basic 16 colors that fish uses by default when editing *.fish files.


Custom Colorscheme

This plugin creates syntax highlighting groups that match Fish's $fish_color_* variables. You can create a custom colorscheme by setting vim highlight groups with the same name and value:

fish> echo $fish_color_option
8abeb7

and then

" inside your custom vim colorscheme
hi fish_color_option guifg=#8abeb7

Look inside colors/fish-default.vim for more examples.

Future Plans

  • Add support for folding and concealing
  • Fix any remaining discrepancies in syntax highlighting
  • Add auto-formatting support with fish_indent
  • Possibly add completion support

About

Vim configuration for Fish

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%