hbc / knowledgebase

recipes that save time
120 stars 31 forks source link

Spacemacs (emacs/vim) setup #22

Open roryk opened 6 years ago

roryk commented 6 years ago

https://github.com/roryk/dotfiles/blob/master/spacemacs is my current configuration. It is basically stock spacemacs, with vim/evil mode turned on.

Hilighted changes from stock:

https://github.com/roryk/dotfiles/blob/28c508eb7431d4a8b3b6bed3cf553eb83ac8bb32/spacemacs#L60 this allows you to open up a remote terminal and then open files from it as if you were opening on that remote machine, but on your local emacs session.

R/ESS specific stuff:

https://github.com/roryk/dotfiles/blob/28c508eb7431d4a8b3b6bed3cf553eb83ac8bb32/spacemacs#L368 this line makes it so ESS stops indenting single # comments.

In your .emacs.d/private/polymode directory, add this to be able to edit RMarkdown documents and have proper syntax hlighting in code blocks:

;;; packages.el --- polymode layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Walmes Zeviani & Fernando Mayer
;; URL: https://github.com/syl20bnr/spacemacs

;;; Code:

(defconst polymode-packages
  '(polymode))

(defun polymode/init-polymode ()
  (use-package polymode
    :mode (("\\.Rmd"   . Rmd-mode))
    :init
    (progn
      (defun Rmd-mode ()
        "ESS Markdown mode for Rmd files"
        (interactive)
        (require 'poly-R)
        (require 'poly-markdown)
        (R-mode)
        (poly-markdown+r-mode))
      ))
  )

;;; packages.el ends here
roryk commented 6 years ago

@mjsteinbaugh here is my emacs set up, let me know if this doesn't work out. You can just use my .spacemacs file from dotfiles and it should work. I run the development branch of Spacemacs and it seems to work fine.

You can stay up to date by running a git pull in your .emacs.d directory; it won't touch your .spacemacs or anything in .emacs.d/private. Every couple days I do that and do an package-list-packages U x to upgrade all of the packages. This is pretty stable most of the time.

mjsteinbaugh commented 6 years ago

Amazing, thanks @roryk

mistrm82 commented 6 years ago

should we turn this into a markdown and make a pull request?

mjsteinbaugh commented 6 years ago

@mistrm82 +1 for a markdown. Also, I noticed that the emacs version on O2 is too old for spacemacs, so it's be cool if HMS RC could update the version installed. Otherwise conda works.

roryk commented 6 years ago

I don't actually use Emacs on O2; I just use tramp-term which lets me ssh into O2 and then edit the file like I normally would, but uses the local editor. Helpful for if you are using VMs and the like.

mjsteinbaugh commented 6 years ago

Sweet I will check that out