- Install emacs
- Mac:
brew install emacs --use-git-head --cocoa --srgb
- Bundle install
Keybinding | Description | Keybinding | Description |
---|---|---|---|
C-a | Move to beginning of line | C-e | Move to end of line |
M-m | Move to the first non-whitespace character on the line | ||
C-f | Move forward one character | C-b | Move backward one character |
M-f | Move forward one word | M-b | Move backward one word |
M-a | Move backward by sentence | M-e | Move forward by sentence |
M-{ | Move backward by paragraph | M-} | Move forward by paragraph |
C-s | Regex search for text in the current buffer and move to it. Hit C-s again to move to the next match | C-r | Same as C-s, but search in reverse |
M-< | Move to beginning of buffer | M-> | Move to end of buffer |
M-g g | Go to line |
Keybinding | Description |
---|---|
C-spc | Set mark (for selecting stuff) |
C-w | Kill region |
M-w | Copy region to kill ring |
C-y | Yank (paste) |
M-y | Cycle through kill ring after yanking |
M-d | Kill word |
C-k | Kill line |
Tab | Ident line |
C-j | New line indent (enter followed by 'tab') |
#Window Layout
Keybinding | Description |
---|---|
C-x 1 | Make the current window full screen |
C-x 2 | Split the current window horizontally |
C-x 3 | Split the current window vertically |
Keybinding | Description |
---|---|
C-x C-j 1 | Switch to first window (or window number provided) |
Here's a list of the interactive Emacs Lisp functions, provided by projectile:
Keybinding | Description |
---|---|
C-c p f | Display a list of all files in the project. With a prefix argument it will clear the cache first. |
C-c p 4 f | Jump to a project's file using completion and show it in another window. |
C-c p d | Display a list of all directories in the project. With a prefix argument it will clear the cache first. |
C-c p T | Display a list of all test files(specs, features, etc) in the project. |
C-c p l | Display a list of all files in a directory (that's not necessarily a project) |
C-c p g | Run grep on the files in the project. |
C-c p v | Run vc-dir on the root directory of the project. |
C-c p b | Display a list of all project buffers currently open. |
C-c p 4 b | Switch to a project buffer and show it in another window. |
C-c p o | Runs multi-occur on all project buffers currently open. |
C-c p r | Runs interactive query-replace on all files in the projects. |
C-c p i | Invalidates the project cache (if existing). |
C-c p R | Regenerates the projects TAGS file. |
C-c p j | Find tag in project's TAGS file. |
C-c p k | Kills all project buffers. |
C-c p D | Opens the root of the project in dired . |
C-c p e | Shows a list of recently visited project files. |
C-c p a | Runs ack on the project. Requires the presence of ack-and-a-half . |
C-c p A | Runs ag on the project. Requires the presence of ag.el . |
C-c p c | Runs a standard compilation command for your type of project. |
C-c p p | Runs a standard test command for your type of project. |
C-c p t | Toggle between an implementation file and its test file. |
C-c p 4 t | Jump to implementation or test file in other window. |
C-c p z | Adds the currently visited file to the cache. |
C-c p s | Display a list of known projects you can switch to. |
C-c p m | Run the commander (an interface to run commands with a single key). |
If you ever forget any of Projectile's keybindings just do a:
C-c p C-h
You can change the default keymap prefix C-c p
like this:
(setq projectile-keymap-prefix (kbd "C-c C-p"))
For some common commands you might want to take a little shortcut and
leverage the fairly unused Super
key (by default Command
on Mac
keyboards and Windows
on Win keyboards). Here's something you can
add to your Emacs config:
(define-key projectile-mode-map [?\s-d] 'projectile-find-dir)
(define-key projectile-mode-map [?\s-p] 'projectile-switch-project)
(define-key projectile-mode-map [?\s-f] 'projectile-find-file)
(define-key projectile-mode-map [?\s-g] 'projectile-grep)
Note that the Super
keybindings are not usable in Windows. Emacs
Prelude already adds those extra keybindings.
Command | Keybinding | Description |
---|---|---|
projectile-rails-find-model | C-c r m | Find a model using projectile-completion-system . |
projectile-rails-find-current-model | C-c r M, C-c r g m | Go to a model connected with the current resource. |
projectile-rails-find-controller | C-c r c | Find a controller using projectile-completion-system . |
projectile-rails-find-current-controller | C-c r C, C-c r g c | Go to a controller connected with the current resource. |
projectile-rails-find-view | C-c r v | Find a template or partial using projectile-completion-system . |
projectile-rails-find-current-view | C-c r V, C-c r g v | Go to a view connected with the current resource. |
projectile-rails-find-helper | C-c r h | Find a helper using projectile-completion-system . |
projectile-rails-find-current-helper | C-c r H, C-c r g h | Go to a helper connected with the current resource. |
projectile-rails-find-lib | C-c r l | Find a lib using projectile-completion-system . |
projectile-rails-find-spec | C-c r s | Find a spec using projectile-completion-system . |
projectile-rails-find-current-spec | C-c r S, C-c r g s | Go to a spec connected with the current resource. |
projectile-rails-find-migration | C-c r n | Find a migration using projectile-completion-system . |
projectile-rails-find-current-migration | C-c r N, C-c r g n | Go to a migration connected with the current resource. |
projectile-rails-find-javascript | C-c r j | Find a javascript using projectile-completion-system . |
projectile-rails-find-log | C-c r o | Find a log file and enable auto-revert-tail-mode in its buffer. |
projectile-rails-find-initializer | C-c r i | Find an initializer file using projectile-completions-system . |
projectile-rails-find-environment | C-c r e | Find an environment file using projectile-completions-system . |
projectile-rails-find-locale | C-c r a | Find a locale file using projectile-completions-system . |
projectile-rails-find-mailer | C-c r @ | Find a mailer file using projectile-completions-system . |
projectile-rails-find-layout | C-c r y | Find a layout file using projectile-completions-system . |
projectile-rails-console | C-c r r | Run rails console command in inf-ruby buffer. |
projectile-rails-rake | C-c r k | Select a rake task to run using projectile-completion-system . |
projectile-rails-generate | C-c r t | Run rails generate command. |
projectile-rails-goto-file-at-point | C-c r RET, C-c r g f | Go to a file at point. Depending on the context that might be a constant, template or partial, or a gem. |
projectile-rails-goto-gemfile | C-c r g g | Go to Gemfile file. |
projectile-rails-goto-routes | C-c r g r | Go to config/routes.rb file. |
projectile-rails-goto-schema | C-c r g h | Go to db/schema.rb file. |
projectile-rails-goto-spec-helper | C-c r g p | Go to spec/spec_helper.rb file. |
You might want to create your own keybinding for your favorite commands. For example:
(define-key projectile-rails-mode-map (kbd "s-m") 'projectile-rails-find-model)
(define-key projectile-rails-mode-map (kbd "s-c") 'projectile-rails-find-controller)
(define-key projectile-rails-mode-map (kbd "s-v") 'projectile-rails-find-view)
(define-key projectile-rails-mode-map (kbd "s-RET") 'projectile-rails-goto-file-at-point)
(define-key projectile-rails-mode-map (kbd "C-c g") projectile-rails-mode-goto-map)