Skip to content

Latest commit

 

History

History
89 lines (58 loc) · 3.55 KB

README.mkd

File metadata and controls

89 lines (58 loc) · 3.55 KB

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

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

Requires vim compiled with python support.

This software is still alpha quality and was adapted from http://github.com/timrobinson/fsharp-vim. 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.

###Installing

#####OSX and linux

  1. Install pathogen

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

#####Windows

  1. Install pathogen

  2. TODO (You can manually copy the required files to you bundle directory after building FSharp.AutoComplete in Visual Studio.)

#####Syntastic

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.

###Usage

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)

###Commands

#####General

  • :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).
  • leader<t> echoes the type of the expression currently pointed to by the cursor.
  • leader<d> go to declaration. Opens a new tab if the declaration is outside of the current file and there isn't already a tab open with the target in the active window.
  • leader<s> takes you back from where go to declaration was triggered.

#####FSharp Interactive

  • :FsiEval evaluates an fsharp expression in the fsi
  • :FsiReset resets the current fsharp interactive
  • :FsiRead displays any lines written by the fsi but not yet output as vim messages
  • Alt-Enter Send either the current selection or the current line to the fsharp interactive and echoes the output.
  • Ctrl-Alt-Enter Send either the current selection or the current line to the fsharp interactive but does not output the result as vim messages.

###On-the-fly syntax checking

Interactive syntax/type checking requires syntastic

By default your F# files will be syntax/type checked on every open/save of a vim buffer. In case you prefer your changes to be checked continuously on-the-fly you can do so with a autocommand in your .vimrc like this:

" set the update interval to your preference
set updatetime=500

augroup fsharp_au
  au!
  au CursorHold *.fs,*.fsi,*.fsx SyntasticCheck
augroup END

###Settings

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/).