Skip to content

Commit

Permalink
Update - working with projects
Browse files Browse the repository at this point in the history
Overview of projectile for working with files only from the current project,
making it easier to open files and navigate buffers for a project.

Using helm transient state to help tidy up buffers.
  • Loading branch information
practicalli-johnny committed Oct 7, 2018
1 parent 5a98cbb commit 3486561
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* [NeoTree](working-with-projects/neotree.md)
* [Ranger](working-with-projects/ranger.md)
* [Managing Buffers](working-with-projects/managing-buffers.md)
* [Tidying up Buffers](working-with-projects/tidying-up-buffers.md)
* [Managing Windows](working-with-projects/managing-windows.md)
* [Layouts](working-with-projects/layouts.md)
* [Clojure Repl](clojure-repl/index.md)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spacemacs-projectile-menu--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions working-with-projects/projectile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Projectile - project specific commands

`SPC p` opens the projectile menu allowing you to run commands relative to the project of the active buffer.

[![Spacemacs Projectile menu](/images/spacemacs-projectile-menu.png)](/images/spacemacs-projectile-menu.png)

## What is a project

A project can be one or more of the following things

* Git - a directory with the `.git` directory
* Language specific - e.g. a Clojure Leiningen project
* Projectile - any directory with a `.projectile` file

## Opening Files from the same project

`SPC p f` is a quick way to open a file that you know the name of as it lists all the files in a project. This is a good approach if you know the name but not the directory path of the file.

The list of files will narrow as you start typing a file name and you can use the `C-k` and `C-j` keybindings to move up and down the list respectively.

[![Spacemacs Projectile File - new file](/images/spacemacs-projectile-file-new-file--light.png)](/images/spacemacs-projectile-file-new-file--light.png)


## Switching between buffers

`SPC p b` gives a helm popup list of currently open buffers for the current project.


## Toggling between test and code files

`SPC p a` toggles the buffer between the test and code files in your project.

In Clojure this is based on the corresponding namespaces, so `SPC p a` would toggle between these two files.

```
src/project-name/component/clojure-code.clj
test/project-name/component/clojure-code.clj
```

Keybindings / commands

`projectile-toggle-between-implementation-and-test`


Cider also has a command to do this:

`cider-test-default-test-ns-fn`

Allegedly, this command is not as effective as the projectile command.
23 changes: 23 additions & 0 deletions working-with-projects/tidying-up-buffers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Tidying up buffers

Sometimes you want to close several buffers and not just the current buffer with `SPC b d`.

`SPC b b` displays a list of open buffers in a popup window.

`M-SPC` opens the Helm transient menu on the buffer popup window, allowing you to navigate using `j` and `k` keys.

`M-D` will prompt you to kill the buffer the cursor is currently on.

`t` will mark the buffer the cursor is currently on.

`T` will mark all buffers listed in the popup.

`M-D` will prompt you in turn to delete all the marked buffers.


## Actions

There are a range of actions you can run from the Helm transient state or even when you just have the buffer list popup open.


> #### TODO:: image of available actions

0 comments on commit 3486561

Please sign in to comment.