Skip to content

Commit 8982836

Browse files
committed
Adapt fsharp to the conventions
1 parent 02c5c82 commit 8982836

File tree

3 files changed

+76
-61
lines changed

3 files changed

+76
-61
lines changed

contrib/lang/fsharp/README.md

+18-25
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# F# contribution layer for Spacemacs
22

33
![logo_fsharp](img/fsharp.png)
4-
54
## Description
65

7-
This layer adds support for F# language using [fsharpbindng](https://github.com/fsharp/fsharpbinding).
6+
This layer adds support for F# language using [fsharpbinding][].
87

98
## Packages Included
109

11-
- [fsharp-mode](https://github.com/fsharp/fsharpbinding)
10+
- [fsharp-mode][]
1211

1312
## Install
1413

@@ -20,31 +19,25 @@ To use this contribution add it to your `~/.spacemacs`
2019

2120
## Key Bindings
2221

23-
### Compilation
24-
25-
Key Binding | Description
26-
----------------------|------------------------------------------------------------
27-
<kbd>mcc</kbd> | Build the project
28-
29-
### Navigation
3022

3123
Key Binding | Description
32-
----------------------|------------------------------------------------------------
33-
<kbd>mcd</kbd> | Go to definition at point
34-
<kbd>men</kbd> | Next error
35-
<kbd>mep</kbd> | Previous error
24+
----------------------|--------------------------------------------------------
25+
<kbd>mcc</kbd> | Build the project
26+
<kbd>mgg</kbd> | Go to definition at point
27+
<kbd>mht</kbd> | Show tooltip help at point
3628

3729
### REPL
3830

3931
Key Binding | Description
40-
----------------------|------------------------------------------------------------
41-
<kbd>mer</kbd> | Evaluate region
42-
<kbd>mep</kbd> | Evaluate phrase
43-
<kbd>mef</kbd> | Evaluate buffer
44-
<kbd>mss</kbd> | Start REPL
45-
46-
### Helpers (documentation, info)
47-
48-
Key Binding | Description
49-
----------------------|------------------------------------------------------------
50-
<kbd>mst</kbd> | Show tooltip at point
32+
----------------------|--------------------------------------------------------
33+
<kbd>msb</kbd> | Send buffer to the REPL
34+
<kbd>msB</kbd> | Send buffer to the REPL and switch to the REPL in `insert state`
35+
<kbd>msi</kbd> | Start a REPL
36+
<kbd>msp</kbd> | Send phrase to the REPL
37+
<kbd>msP</kbd> | Send phrase to the REPL and switch to the REPL in `insert state`
38+
<kbd>msr</kbd> | Send region to the REPL
39+
<kbd>msR</kbd> | Send region to the REPL and switch to the REPL in `insert state`
40+
<kbd>mss</kbd> | Show the REPL
41+
42+
[fsharpbinding]: https://github.com/fsharp/fsharpbinding
43+
[fsharp-mode]: https://github.com/fsharp/fsharpbinding

contrib/lang/fsharp/extensions.el

-21
This file was deleted.

contrib/lang/fsharp/packages.el

+58-15
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,69 @@
1-
;;; packages.el --- fsharp Layer packages File for Spacemacs
1+
;;; packages.el --- F# Layer packages File for Spacemacs
2+
;;
3+
;; Copyright (c) 2012-2014 Sylvain Benner
4+
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
5+
;;
6+
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
7+
;; URL: https://github.com/syl20bnr/spacemacs
8+
;;
9+
;; This file is not part of GNU Emacs.
10+
;;
11+
;;; License: GPLv3
212

313
(defvar fsharp-packages '(fsharp-mode))
14+
415
(defun fsharp/init-fsharp-mode ()
516
(use-package fsharp-mode
617
:defer t
18+
:init
19+
(setq fsharp-doc-idle-delay .2
20+
fsharp-build-command "/usr/local/bin/xbuild")
721
:config
822
(progn
9-
(setq fsharp-doc-idle-delay .2)
10-
(setq fsharp-build-command "/usr/local/bin/xbuild")
11-
;;;;;;;;; Keybindings ;;;;;;;;;;
23+
24+
(defun spacemacs/fsharp-load-buffer-file-focus ()
25+
"Send the current buffer to REPL and switch to the REPL in
26+
`insert state'."
27+
(interactive)
28+
(fsharp-load-buffer-file)
29+
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
30+
(evil-insert-state))
31+
32+
(defun spacemacs/fsharp-eval-phrase-focus ()
33+
"Send the current phrase to REPL and switch to the REPL in
34+
`insert state'."
35+
(interactive)
36+
(fsharp-eval-phrase)
37+
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
38+
(evil-insert-state))
39+
40+
(defun spacemacs/fsharp-eval-region-focus (start end)
41+
"Send the current phrase to REPL and switch to the REPL in
42+
`insert state'."
43+
(interactive "r")
44+
(fsharp-eval-region start end)
45+
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
46+
(evil-insert-state))
47+
1248
(evil-leader/set-key-for-mode 'fsharp-mode
1349
;; Compile
1450
"mcc" 'compile
15-
"mer" 'fsharp-eval-region
16-
"mep" 'fsharp-eval-phrase
17-
"mef" 'fsharp-load-buffer-file
18-
"mst" 'fsharp-ac/show-tooltip-at-point
19-
"mgd" 'fsharp-ac/gotodefn-at-point
20-
"mss" 'fsharp-show-subshell
21-
"mee" 'fsharp-run-executable-file
51+
2252
"mfa" 'fsharp-find-alternate-file
23-
"men" 'next-error
24-
"mep" 'previous-error
25-
)
26-
)))
53+
54+
"mgg" 'fsharp-ac/gotodefn-at-point
55+
56+
"mht" 'fsharp-ac/show-tooltip-at-point
57+
58+
"msb" 'fsharp-load-buffer-file
59+
"msB" 'spacemacs/fsharp-load-buffer-file-focus
60+
"msi" 'fsharp-show-subshell
61+
"msp" 'fsharp-eval-phrase
62+
"msP" 'spacemacs/fsharp-eval-phrase-focus
63+
"msr" 'fsharp-eval-region
64+
"msR" 'spacemacs/fsharp-eval-region-focus
65+
"mss" 'fsharp-show-subshell
66+
67+
"mxf" 'fsharp-run-executable-file))))
68+
69+

0 commit comments

Comments
 (0)