Skip to content

Commit

Permalink
Adapt fsharp to the conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
syl20bnr committed Mar 14, 2015
1 parent 02c5c82 commit 8982836
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 61 deletions.
43 changes: 18 additions & 25 deletions contrib/lang/fsharp/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# F# contribution layer for Spacemacs

![logo_fsharp](img/fsharp.png)

## Description

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

## Packages Included

- [fsharp-mode](https://github.com/fsharp/fsharpbinding)
- [fsharp-mode][]

## Install

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

## Key Bindings

### Compilation

Key Binding | Description
----------------------|------------------------------------------------------------
<kbd>mcc</kbd> | Build the project

### Navigation

Key Binding | Description
----------------------|------------------------------------------------------------
<kbd>mcd</kbd> | Go to definition at point
<kbd>men</kbd> | Next error
<kbd>mep</kbd> | Previous error
----------------------|--------------------------------------------------------
<kbd>mcc</kbd> | Build the project
<kbd>mgg</kbd> | Go to definition at point
<kbd>mht</kbd> | Show tooltip help at point

### REPL

Key Binding | Description
----------------------|------------------------------------------------------------
<kbd>mer</kbd> | Evaluate region
<kbd>mep</kbd> | Evaluate phrase
<kbd>mef</kbd> | Evaluate buffer
<kbd>mss</kbd> | Start REPL

### Helpers (documentation, info)

Key Binding | Description
----------------------|------------------------------------------------------------
<kbd>mst</kbd> | Show tooltip at point
----------------------|--------------------------------------------------------
<kbd>msb</kbd> | Send buffer to the REPL
<kbd>msB</kbd> | Send buffer to the REPL and switch to the REPL in `insert state`
<kbd>msi</kbd> | Start a REPL
<kbd>msp</kbd> | Send phrase to the REPL
<kbd>msP</kbd> | Send phrase to the REPL and switch to the REPL in `insert state`
<kbd>msr</kbd> | Send region to the REPL
<kbd>msR</kbd> | Send region to the REPL and switch to the REPL in `insert state`
<kbd>mss</kbd> | Show the REPL

[fsharpbinding]: https://github.com/fsharp/fsharpbinding
[fsharp-mode]: https://github.com/fsharp/fsharpbinding
21 changes: 0 additions & 21 deletions contrib/lang/fsharp/extensions.el

This file was deleted.

73 changes: 58 additions & 15 deletions contrib/lang/fsharp/packages.el
Original file line number Diff line number Diff line change
@@ -1,26 +1,69 @@
;;; packages.el --- fsharp Layer packages File for Spacemacs
;;; packages.el --- F# Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

(defvar fsharp-packages '(fsharp-mode))

(defun fsharp/init-fsharp-mode ()
(use-package fsharp-mode
:defer t
:init
(setq fsharp-doc-idle-delay .2
fsharp-build-command "/usr/local/bin/xbuild")
:config
(progn
(setq fsharp-doc-idle-delay .2)
(setq fsharp-build-command "/usr/local/bin/xbuild")
;;;;;;;;; Keybindings ;;;;;;;;;;

(defun spacemacs/fsharp-load-buffer-file-focus ()
"Send the current buffer to REPL and switch to the REPL in
`insert state'."
(interactive)
(fsharp-load-buffer-file)
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
(evil-insert-state))

(defun spacemacs/fsharp-eval-phrase-focus ()
"Send the current phrase to REPL and switch to the REPL in
`insert state'."
(interactive)
(fsharp-eval-phrase)
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
(evil-insert-state))

(defun spacemacs/fsharp-eval-region-focus (start end)
"Send the current phrase to REPL and switch to the REPL in
`insert state'."
(interactive "r")
(fsharp-eval-region start end)
(switch-to-buffer-other-window inferior-fsharp-buffer-name)
(evil-insert-state))

(evil-leader/set-key-for-mode 'fsharp-mode
;; Compile
"mcc" 'compile
"mer" 'fsharp-eval-region
"mep" 'fsharp-eval-phrase
"mef" 'fsharp-load-buffer-file
"mst" 'fsharp-ac/show-tooltip-at-point
"mgd" 'fsharp-ac/gotodefn-at-point
"mss" 'fsharp-show-subshell
"mee" 'fsharp-run-executable-file

"mfa" 'fsharp-find-alternate-file
"men" 'next-error
"mep" 'previous-error
)
)))

"mgg" 'fsharp-ac/gotodefn-at-point

"mht" 'fsharp-ac/show-tooltip-at-point

"msb" 'fsharp-load-buffer-file
"msB" 'spacemacs/fsharp-load-buffer-file-focus
"msi" 'fsharp-show-subshell
"msp" 'fsharp-eval-phrase
"msP" 'spacemacs/fsharp-eval-phrase-focus
"msr" 'fsharp-eval-region
"msR" 'spacemacs/fsharp-eval-region-focus
"mss" 'fsharp-show-subshell

"mxf" 'fsharp-run-executable-file))))


0 comments on commit 8982836

Please sign in to comment.