practice / blog

For personal blogging
1 stars 0 forks source link

spacemacs for clojure #33

Open practice opened 8 years ago

practice commented 8 years ago

Install

cd ~
mv .emacs.d .emacs.d.bak
mv .emacs .emacs.bak
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

Config

dotspacemacs-configuration-layers
   '(
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
     ;; <M-m f e R> (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     auto-completion
     better-defaults
     spacemacs-layout
     clojure
     eyebrowse
     emacs-lisp
     git
     markdown
     org
...
(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  ;; 파일 변경사항을 자동으로 읽음.
  (global-auto-revert-mode 1)
  ;; 아래 두줄이 윈도 레이아웃 저장하는 것임.
  (desktop-save-mode)
  (desktop-read)
  )

Start

After creating your project with lein new app or importing an existing project, run SPC m s i in any of the clojure source files to connect to the CIDER REPL.

Navigation

Up k Down j Left h Right l Down a page Ctrl-d Up a page Ctrl-u Up to next paragraph{ Down to next paragraph } Previous function [[ Next function ]] Up to outer brace [{ Down to outer brace ]} Right a word w Left a word b Beginning of File gg End of File G End of line $ First non-wh­ite­space char of line ^ Jump to any word SPC-SPC <first letter of word> Jump back Ctrl-o Center buffer zz Last place you edited g; Last file path under your cursor gf You can use number­+fu­nction for most, e.g. 5-w = 5 words right

Files

Open a file SPC-f-f Save a file SPC-f-s Create a file SPC-f-f Find a file in your project SPC-p-f Edit .spacemacs SPC-f-e-d Switch to a file recently opened SPC-b-b Switch to last buffer SPC-TAB Toggle NeoTree SPC-f-t

Editor

Quit SPC-q-q Restart SPC-q-r Increa­se/­dec­rease font size SPC-z-x Toggle line numbers SPC-t-n Toggle auto completion SPC-t-a

Window Layouts

Split window vertically SPC-w-v Split window horizo­ntally SPC-w-s Switch window SPC-<nr. of window> Switch window (alter­native) SPC-w-h (left), SPC-w-j (down)... Show/hide layout help SPC-l-? Create a named layout SPC-l-l Save a layout by name SPC-l-S Switch to layout SPC-l-­<nr. of layout>

Editing

Enter highli­ghting mode v Undo u Redo Ctrl-r Comment out a line g-c-c Comment out highli­ghted text g-c Copy 1 y Paste p Paste above P Copy/Paste to/from register "-a-y (yank in to register a), "-a-p Delete 1 d Delete char x Delete until right parenteses d-f-) Replace mode R Replace char r Change1 c Change everything between quotes c-i-" Show previous things you've copied SPC-r-y Indent hightl­ighted text > and < (you can use 2>,­3<...) Join lines separated by whitespace J Show whitespace SPC-t-w Convert spaces to tabs SPC-:-­tabify Convert tabs to spaces SPC-:-­unt­abify [1]: You can use certain commands with additional options: dd = delete line, 5yy = yank 5 lines, dw = delete word, y$ = yank until end of line...

Find Text

Find text in buffer /-<text to search­>-Enter (n for next result, N for previous) Find next instance of a word that your cursor is over * Find previous instance of a word that your cursor is over # Turn off previous search highli­ghting :nohl-­Enter Find text in project SPC-/ Find test under curser in Project SPC-* Resume last search SPC-s-l Find and replace text in buffer, from current line :.,$s/­<find text>/­<re­place text>/gc

Clojure

Start REPL (cider­-ja­ck-in) SPC-m-s-i (use I for clojur­esc­ript) Switch to REPL SPC-m-s-s Send and eval buffer in REPL SPC-m-s-b Send and eval last sexp in REPL SPC-m-s-e Send and eval function in REPL SPC-m-s-f Send and eval ns form in REPL SPC-m-s-n Send and eval region in REPL SPC-m-s-r Kill REPL SPC-m-s-q Cider grimoire SPC-m-h-g Cider doc SPC-m-h-h Cider javadoc SPC-m-h-j Eval buffer­,last sexp,... SPC-m-e-b, ... Goto SPC-m-­g-<­fun­cti­on> Run all tests in ns SPC-m-t-a Re-run test failures for ns SPC-m-t-r Run test at point SPC-m-t-t Reload ns SPC-m-d-r Instrument expression SPC-m-d-b Display last stacktrace SPC-m-d-e Inspect expression SPC-m-d-i Realign current form SPC-m-f-l Reformat current buffer SPC-m-f-b Refa­cto­ring SPC-m-­r-<­fun­cti­on>