diff --git a/contrib/lang/fsharp/README.md b/contrib/lang/fsharp/README.md index 02754f44bfaa..d092845f4aca 100644 --- a/contrib/lang/fsharp/README.md +++ b/contrib/lang/fsharp/README.md @@ -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 @@ -20,31 +19,25 @@ To use this contribution add it to your `~/.spacemacs` ## Key Bindings -### Compilation - - Key Binding | Description -----------------------|------------------------------------------------------------ -mcc | Build the project - -### Navigation Key Binding | Description -----------------------|------------------------------------------------------------ -mcd | Go to definition at point -men | Next error -mep | Previous error +----------------------|-------------------------------------------------------- +mcc | Build the project +mgg | Go to definition at point +mht | Show tooltip help at point ### REPL Key Binding | Description -----------------------|------------------------------------------------------------ -mer | Evaluate region -mep | Evaluate phrase -mef | Evaluate buffer -mss | Start REPL - -### Helpers (documentation, info) - - Key Binding | Description -----------------------|------------------------------------------------------------ -mst | Show tooltip at point +----------------------|-------------------------------------------------------- +msb | Send buffer to the REPL +msB | Send buffer to the REPL and switch to the REPL in `insert state` +msi | Start a REPL +msp | Send phrase to the REPL +msP | Send phrase to the REPL and switch to the REPL in `insert state` +msr | Send region to the REPL +msR | Send region to the REPL and switch to the REPL in `insert state` +mss | Show the REPL + +[fsharpbinding]: https://github.com/fsharp/fsharpbinding +[fsharp-mode]: https://github.com/fsharp/fsharpbinding diff --git a/contrib/lang/fsharp/extensions.el b/contrib/lang/fsharp/extensions.el deleted file mode 100644 index 0a742f348625..000000000000 --- a/contrib/lang/fsharp/extensions.el +++ /dev/null @@ -1,21 +0,0 @@ -(defvar fsharp-pre-extensions - '( - ;; pre extension fsharps go here - ) - "List of all extensions to load before the packages.") - -(defvar fsharp-post-extensions - '( - ;; post extension fsharps go here - ) - "List of all extensions to load after the packages.") - -;; For each extension, define a function fsharp/init- -;; -;; (defun fsharp/init-my-extension () -;; "Initialize my extension" -;; ) -;; -;; Often the body of an initialize function uses `use-package' -;; For more info on `use-package', see readme: -;; https://github.com/jwiegley/use-package diff --git a/contrib/lang/fsharp/packages.el b/contrib/lang/fsharp/packages.el index 819c5d99efcd..982a36983a2a 100644 --- a/contrib/lang/fsharp/packages.el +++ b/contrib/lang/fsharp/packages.el @@ -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 +;; 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)))) + +