Thursday, 28 January 2016

Spacemacs

Introduction

Press space to explore the interactive list of carefully-chosen key bindings.
You can also press the home buffer’s [?] button for some great first key bindings to try

Common keys

Help:
space h d f help define function - fuzzy search for a function and find out how to use it
space h d k help define key - insert any key sequence and find out what it’s bound to

Windows:
space w v split screen to the right
space w l jump to window at right
space w h jump to window at left
space w space show a letter on each window which you can press to jump to

Buffers:
space tab switch to last buffer
space b b show list of open buffers
space b d kills the current buffer
space b s switch to scratch buffer (analogous to new file)
– space f s save file (if it’s the scratch buffer it will prompt you for a name)

Open a file:
space f f opens the file navigator
– ctrl l jumps into a folder
– ctrl h jumps out of a folder
– enter opens the selected file into a new buffer
to create a new file - open the scratch buffer (space b s) and when ready to save (space f s)

Projects:
projects are typically defined by a source control marker, such as a .git folder, or can be manually created by defining a .projectile file
space p f opens the project navigator
space p p switch to another project
– enter then opens the project navigator for that project

Searching:
space / searches through a whole project (using the tool specified by dotspacemacs-search-tools)
spaces s searches within a file (helm swoop)
– ctrl j move down in the seach results
– ctrl k move up in the seach results
space s l shows a list of all the functions on the current file (requires the semantic layer)
space space shows a prompt for a char, and then shows all locations of words which begin with that char. Press the appropriate key to jump to that location.
– space` jump back to previous mark (consider using ctrlo instead)

Compilation:
space c C build
space c r repeat last build command

Text selection:
space v select region
– v expand region
– V contract region

Help:
space h d describe
– f functions
– v variables
– k key-bindings
space f e h open help documentation

Completion:
requires dotspacemacs-configuration-layers auto-completion to be enabled
ctrl l paste selected completion
ctrl / fuzzy search
alt / auto-complete selected function template

Workspaces:
requires dotspacemacs-configuration-layers eyebrowse to be enabled
space l w 0..9 switch to or create workspace
g t switch to next workspace
g T switch to previous workspace
space l w c close current workspace

Editing:
space; toggle comment (if region currently selected - comments that, otherwise enters toggle comment mode)
– a p comment paragraph
– i i comment indent region

Moving:
space s j jump in buffer

Wednesday, 27 January 2016

emacs 24.5 on Ubuntu and spacemacs

Spacemacs on on Ubuntu 14.04

Build emacs-24.5

Install git and build-essential:

$ sudo apt-get install -y git build-essential

Install emacs24 build dependencies

$ sudo apt-get build-dep emacs24

Download the source for the version of emacs you want from the emacs ftp site

Unpack the source into a directory where you’re going to build it

$ cd /tmp
$ mv ~/Downloads/emacs-24.5.tar.xz .
$ tar -xf emacs-24.5.tar.xz 
$ cd emacs-24.5

Configure and build it

$ ./configure
$ make -j4
$ sudo make install

Install spacemacs

Move any existing emacs configuration to backup

$ mv ~/.emacs.d ~/.emacs.d.bak

Clone the spacemacs repo:

$ git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

Launch and it will install it’s required packages