Skip to content
This repository has been archived by the owner. It is now read-only.
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
149 lines (108 sloc) 5.49 KB

##F# support for Vim (fsharpbindings-vim)

Syntax and indent files have been copied from fsharp-vim with kind permissions from kongo2002.

Requires vim 7.3 or higher compiled with python support.

This software is still alpha quality and was adapted from The current aim is to provide a good experience for fsx scripting. On opening an fs or fsi file any project file found in the same directory will be parsed. Multiple projects are supported.


fsharpbinding-vim requires mono and fsharp installed. To build and install you will need to be able to xbuild any .fsproj file.

####OSX and linux

#####Installing with pathogen

  1. Install pathogen and syntastic

  2. Run make install inside the vim directory. This will copy the necessary contents to your ~/.vim/bundle directory.

#####Installing with vim-plug

Plug 'fsharp/fsharpbinding', {
      \ 'for': 'fsharp',
      \ 'rtp': 'vim',
      \ 'do':  'make -C vim fsautocomplete',

#####Installing with NeoBundle

By VimL way:

NeoBundle 'fsharp/fsharpbinding', {
           \ 'description': 'F# support for Vim',
           \ 'rtp': 'vim',
           \ 'lazy': 1,
           \ 'autoload': {'filetypes': 'fsharp'},
           \ 'build': {
           \   'mac':   'make -C vim fsautocomplete',
           \   'linux': 'make -C vim fsautocomplete',
           \   'unix':  'make -C vim fsautocomplete',
           \ },
           \ 'build_commands': ['make', 'mozroots', 'xbuild'],

By using TOML configuration:

description = 'F# support for Vim'
repository = 'fsharp/fsharpbinding'
rtp = 'vim'
lazy = 1
filetypes = 'fsharp'
build_commands = ['make', 'mozroots', 'xbuild']
  mac   = 'make -C vim fsautocomplete'
  unix  = 'make -C vim fsautocomplete'
  linux = 'make -C vim fsautocomplete'


  1. Install pathogen and syntastic

  2. Run install.cmd

  3. Currently you will most likely need to set g:fsharp_xbuild_path and g:fsharp_interactive_bin to approapriate values.


The fsharpbindings for vim utilize the syntastic plugin in order to supply interactive syntax and type checking. You may want to install that plugin in order to get all of the fsharpbindings functionality.

Moreover you benefit from additional syntastic features like optional integration in your status bar (i.e. vim-airline).

All you have to do is to install syntastic in your vim runtime path.


Opening either *.fs, *.fsi or *.fsx files should trigger syntax highlighting and other depending runtime files as well.

Omnicomplete triggers the fsharp autocomplete process. (suggestion: install supertab)



  • :make Calls xbuild on the fsproj for the current file (if any).
  • :ParseProject Reparses all the project files and dependencies (this is done automatically when opening a .fs or .fsi file).
  • :BuildProject Calls xbuild on the fsproj for the current file (if any). Can also take a path to the proj file to build.
  • :RunProject Runs the project for the current file (if any).
  • :RunTests If g:fsharp_test_runner is set it will build the current project and run any tests. (Currently only tested with nunit-console.exe)
  • leader<t> Echoes the type of the expression currently pointed to by the cursor.
  • leader<d> go to declaration in current window.
  • leader<s> Takes you back from where go to declaration was triggered.

#####FSharp Interactive

  • :FsiEval Evaluates an fsharp expression in the fsi
  • :FsiEvalBuffer Evaluates the entire buffer in the fsi
  • :FsiReset Resets the current fsharp interactive
  • :FsiRead Outputs any lines written by the fsi but not yet output as vim messages
  • :FsiShow Opens the fsi-out buffer in a split window.
  • Alt-Enter Send either the current selection or the current line to the fsharp interactive and echoes the output the first line of the output. All output will be written to the fsi-out buffer.
  • leader<i> Same as Alt-Enter

###On-the-fly syntax checking

Interactive syntax/type checking requires vim 7.4 or higher and syntastic

By default your F# files will be syntax/type checked on every open/save of a vim buffer as well as after 500ms of inactivity in Normal mode.
In case you would prefer not to have you errors checked continuously add the following to your vimrc:

let g:fsharp_only_check_errors_on_write = 1


You can enable debug-mode in order to inspect the fsautocomplete behavior by setting the global vim variable g:fsharpbinding_debug to a non-zero value:

let g:fsharpbinding_debug = 1

This will create two log files log.txt and log2.txt in your temporary folder (i.e. /tmp/).

You can set the msbuild/xbuild path. On windows it is very likely you need to do this unless msbuild is in your path.

let g:fsharp_xbuild_path = "/path/to/xbuild/or/msbuild"

This setting needs to point to a suitable test runner (such as nunit-console.exe)

let g:fsharp_test_runner = "/path/to/test/runner"
You can’t perform that action at this time.