You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/restoring_programs.md
+73-2Lines changed: 73 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# Restoring programs
2
+
-[General instructions](#general-instructions)
3
+
-[Clarifications](#clarifications)
4
+
-[Working with NodeJS](#nodejs)
2
5
6
+
### General instructions <aname="general-instructions"></a>
3
7
Only a conservative list of programs is restored by default:<br/>
4
8
`vi vim nvim emacs man less more tail top htop irssi mutt`.
5
9
@@ -31,7 +35,7 @@ contains space-separated list of additional programs to restore.
31
35
32
36
set -g @resurrect-processes ':all:'
33
37
34
-
### Clarifications
38
+
### Clarifications <aname="clarfications"></a>
35
39
36
40
> I don't understand tilde `~`, what is it and why is it used when restoring
37
41
programs?
@@ -73,7 +77,7 @@ the command line.
73
77
Naturally, you'd rather want to see just `rails server` (what you initially
74
78
typed), but that information is now unfortunately lost.
75
79
76
-
To aid this, you can use arrow `->`:
80
+
To aid this, you can use arrow `->`: (**note**: there is no space before and after `->`)
77
81
78
82
set -g @resurrect-processes '"~rails server->rails server"' # OK
79
83
@@ -98,3 +102,70 @@ Here's the general workflow for figuring this out:
98
102
file.
99
103
- Now that you know the full and the desired process string use tilde `~` and
100
104
arrow `->` in `.tmux.conf` to make things work.
105
+
106
+
### Working with NodeJS <aname="nodejs"></a>
107
+
If you are working with NodeJS, you may get some troubles with configuring restoring programs.
108
+
109
+
Particularly, some programs like `gulp`, `grunt` or `npm` are not saved with parameters so tmux-resurrect cannot restore it. This is actually **not tmux-resurrect's issue** but more likely, those programs' issues. For example if you run `gulp watch` or `npm start` and then try to look at `ps` or `pgrep`, you will only see `gulp` or `npm`.
110
+
111
+
To deal with these issues, one solution is to use [yarn](https://yarnpkg.com/en/docs/install) which a package manager for NodeJS and an alternative for `npm`. It's nearly identical to `npm` and very easy to use. Therefore you don't have to do any migration, you can simply use it immediately. For example:
112
+
-`npm test` is equivalent to `yarn test`,
113
+
-`npm run watch:dev` is equivalent to `yarn watch:dev`
114
+
- more interestingly, `gulp watch:dev` is equivalent to `yarn gulp watch:dev`
115
+
116
+
Before continuing, please ensure that you understand the [clarifications](#clarifications) section about `~` and `->`
117
+
118
+
#### yarn
119
+
It's fairly straight forward if you have been using `yarn` already.
120
+
121
+
set -g @resurrect-processes '"~yarn watch"'
122
+
set -g @resurrect-processes '"~yarn watch->yarn watch"'
123
+
124
+
125
+
#### npm
126
+
Instead of
127
+
128
+
set -g @resurrect-processes '"~npm run watch"' # will NOT work
129
+
130
+
we use
131
+
132
+
set -g @resurrect-processes '"~yarn watch"' # OK
133
+
134
+
135
+
#### gulp
136
+
Instead of
137
+
138
+
set -g @resurrect-processes '"~gulp test"' # will NOT work
139
+
140
+
we use
141
+
142
+
set -g @resurrect-processes '"~yarn gulp test"' # OK
143
+
144
+
145
+
#### nvm
146
+
If you use `nvm` in your project, here is how you could config tmux-resurrect:
147
+
148
+
set -g @resurrect-processes '"~yarn gulp test->nvm use && gulp test"'
149
+
150
+
#### Another problem
151
+
Let take a look at this example
152
+
153
+
set -g @resurrect-processes '\
154
+
"~yarn gulp test->gulp test" \
155
+
"~yarn gulp test-it->gulp test-it" \
156
+
'
157
+
**This will not work properly**, only `gulp test` is run, although you can see the command `node /path/to/yarn gulp test-it` is added correctly in `.tmux/resurrect/last` file.
158
+
159
+
The reason is when restoring program, the **command part after the dash `-` is ignored** so instead of command `gulp test-it`, the command `gulp test` which will be run.
160
+
161
+
A work around, for this problem until it's fixed, is:
162
+
- the config should be like this:
163
+
164
+
set -g @resurrect-processes '\
165
+
"~yarn gulp test->gulp test" \
166
+
"~yarn gulp \"test-it\"->gulp test-it" \
167
+
168
+
- and in `.tmux/resurrect/last`, we should add quote to `test-it` word
0 commit comments