You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.mkd
+94-10Lines changed: 94 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
**F# support for Vim/Neovim**
4
4
5
+

6
+
5
7
_Part of the [Ionide](http://ionide.io) plugin suite._
6
8
7
9
## About Ionide-Vim
@@ -40,7 +42,7 @@ Feel free to [request features and/or file bug reports](https://github.com/ionid
40
42
41
43
- Syntax highlighting
42
44
- Auto completions
43
-
- Error highlighting
45
+
- Error highlighting and error list
44
46
- Tooltips
45
47
- Go to Definition
46
48
- Find all references
@@ -49,6 +51,7 @@ Feel free to [request features and/or file bug reports](https://github.com/ionid
49
51
- Show symbols in file
50
52
- Find symbol in workspace
51
53
- Show signature in status line
54
+
- Integration with F# Interactive **(new!)**
52
55
53
56
## Getting Started
54
57
@@ -92,6 +95,8 @@ let g:LanguageClient_serverCommands = {
92
95
93
96
This will configure FSAC to be used from LanguageClient-neovim.
94
97
98
+
Note: if you append it before actually installing Ionide-vim, it will fail with `E121: Undefined variable: g:fsharp#languageserver_command`.
99
+
95
100
## Usage
96
101
97
102
Opening either `*.fs`, `*.fsi` or `*.fsx` files should trigger syntax highlighting and other depending runtime files as well.
@@ -103,52 +108,131 @@ Refer to [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neov
103
108
To be added as requested for F#-specific features.
104
109
105
110
#### `:FSharpLoadWorkspaceAuto`
106
-
-Search a workspace (`sln` or `fsproj`) and then load it.
111
+
-Searches a workspace (`sln` or `fsproj`) and then load it.
107
112
- Equivalent to `FSharp.workspaceMode = sln` in Ionide-VSCode.
108
113
- Automatically called when you open F# files. Can be disabled in settings.
109
114
- The deep level of directory hierarchy to search can also be configured in settings.
110
115
111
116
#### `:FSharpParseProject <files>+`
112
-
-Load specified projects (`sln` or `fsproj`).
117
+
-Loads specified projects (`sln` or `fsproj`).
113
118
114
119
#### `:FSharpReloadWorkspace`
115
-
-Reload all the projects currently loaded.
120
+
-Reloads all the projects currently loaded.
116
121
- Automatically called when you save `.fsproj` files. Can be disabled in settings.
117
122
118
123
#### `:FSharpUpdateFSAC`
119
-
- Download the latest build of FsAutoComplete to be used with Ionide-vim.
124
+
- Downloads the latest build of FsAutoComplete to be used with Ionide-vim.
125
+
126
+
### Working with F# Interactive
127
+
128
+
Ionide-vim has an integration with F# Interactive.
129
+
130
+
FSI is displayed using the builtin `:terminal` feature introduced in Vim 8 / Neovim and can be used like in VSCode.
131
+
132
+
#### `:FsiShow`
133
+
- Shows F# Interactive windows.
134
+
135
+
#### `:FsiEval <expr>`
136
+
- Evaluates given expression in FSI.
137
+
138
+
#### `:FsiEvalBuffer`
139
+
- Sends the content of current file to FSI.
140
+
141
+
#### `:FsiReset`
142
+
- Resets the current FSI session.
143
+
144
+
#### `Alt-Enter`
145
+
- When in normal mode, sends the current line to FSI.
146
+
- When in visual mode, sends the selection to FSI.
147
+
- Sending code to FSI opens FSI window but the cursor does not focus to it. Unlike Neovim, Vim doesn't support asynchronous buffer updating so you have to input something (e.g. moving cursor) to see the result. You can change this behavior in settings.
148
+
149
+
#### `Alt-@`
150
+
- Toggles FSI window. FSI windows shown in different tabpages share the same FSI session.
151
+
- When opened, the cursor automatically focuses to the FSI window (unlike in `Alt-Enter` by default).
152
+
153
+
You can customize the location of FSI, key mappings, etc. See [the documentation below](#f-interactive-settings).
120
154
121
155
### Settings
122
156
123
157
Refer to [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim) for features provided via Language Server Protocol.
124
158
125
159
To be added as requested for F#-specific features.
126
160
127
-
#### Enable/disable automatic calling of `:FSharpLoadWorkspaceAuto` on opening F# files (default: 1)
161
+
#### Workspace Settings
162
+
163
+
##### Enable/disable automatic calling of `:FSharpLoadWorkspaceAuto` on opening F# files (default: 1)
128
164
129
165
~~~.vim
130
166
let g:fsharp#automatic_workspace_init = 1 " 0 to disable.
131
167
~~~
132
168
133
-
#### Set the deep level of directory hierarchy when searching for sln/fsprojs (default: 2)
169
+
#####Set the deep level of directory hierarchy when searching for sln/fsprojs (default: 2)
134
170
135
171
~~~.vim
136
172
let g:fsharp#workspace_mode_peek_deep_level = 2
137
173
138
174
~~~
139
175
140
-
#### Enable/disable automatic calling of `:FSharpReloadWorkspace` on saving `fsproj` (default: 1)
176
+
#####Enable/disable automatic calling of `:FSharpReloadWorkspace` on saving `fsproj` (default: 1)
141
177
142
178
~~~.vim
143
179
let g:fsharp#automatic_reload_workspace = 1 " 0 to disable.
144
180
~~~
145
181
146
-
#### Show type signature at cursor position (default: 1)
182
+
#### Editor Settings
183
+
184
+
##### Show type signature at cursor position (default: 1)
147
185
148
186
~~~.vim
149
187
let g:fsharp#show_signature_on_cursor_move = 1 " 0 to disable.
150
188
~~~
151
189
190
+
#### F# Interactive Settings
191
+
192
+
##### Change the F# Interactive command to be used within Ionide-vim (default: `dotnet fsi`)
193
+
194
+
~~~.vim
195
+
let g:fsharp#fsi_command = "fsharpi"
196
+
~~~
197
+
198
+
##### Customize how FSI window is opened (default: `botright 10new`)
199
+
200
+
It must create a new empty window and then focus to it.
201
+
202
+
See [`:help opening-window`](http://vimdoc.sourceforge.net/htmldoc/windows.html#opening-window) for details.
203
+
204
+
~~~.vim
205
+
let g:fsharp#fsi_window_command = "botright vnew"
206
+
~~~
207
+
208
+
##### Set if sending line/selection to FSI shoule make the cursor focus to FSI window (default: `0`)
209
+
210
+
If you are using Vim, you might want to enable this to see the result without inputting something.
211
+
212
+
~~~.vim
213
+
let g:fsharp#fsi_focus_on_send = 1 " 0 to not to focus.
214
+
~~~
215
+
216
+
##### Change the key mappings (default: `vscode`)
217
+
218
+
*`vscode`: Default. Same as in Ionide-VSCode (`Alt-Enter` to send, `Alt-@` to toggle terminal).
219
+
-`<M-CR>` in Neovim / `<ESC><CR>` in Vim: Sends line/selection to FSI.
220
+
-`<M-@>` in Neovim / `<ESC>@` in Vim: Toggles FSI window.
221
+
*`vim-fsharp`: Same as in [fsharp/vim-fsharp](https://github.com/fsharp/vim-fsharp#fsharp-interactive). Note that `<leader>` is mapped to backslash by default. See [`:help mapleader`](http://vimdoc.sourceforge.net/htmldoc/map.html#mapleader).
222
+
-`<leader>i` : Sends line/selecion to FSI.
223
+
-`<leader>e` : Toggles FSI window.
224
+
*`custom`: You must set both `g:fsharp#fsi_keymap_send` and `g:fsharp#fsi_keymap_toggle` by yourself.
225
+
-`g:fsharp#fsi_keymap_send` : Sends line/selection to FSI.
0 commit comments