@@ -265,12 +265,14 @@ def freeze(session):
265
265
wconf ['layout' ] = w .get ('window_layout' )
266
266
wconf ['panes' ] = []
267
267
268
- if (
269
- all (
270
- w .panes [0 ].get ('pane_current_path' ) ==
271
- p .get ('pane_current_path' ) for p in w .panes
272
- )
273
- ):
268
+ # If all panes have same path, set 'start_directory' instead
269
+ # of using 'cd' shell commands.
270
+ pane_has_same_path = lambda p : (
271
+ w .panes [0 ].get ('pane_current_path' ) ==
272
+ p .get ('pane_current_path' )
273
+ )
274
+
275
+ if (all (pane_has_same_path (p ) for p in w .panes )):
274
276
wconf ['start_directory' ] = w .panes [0 ].get ('pane_current_path' )
275
277
276
278
for p in w .panes :
@@ -284,14 +286,17 @@ def freeze(session):
284
286
285
287
current_cmd = p .get ('pane_current_command' )
286
288
287
- if (
288
- current_cmd .startswith ('-' ) or
289
- any (
290
- current_cmd .endswith (cmd )
291
- for cmd in ['python' , 'ruby' , 'node' ]
289
+ def filter_interpretters_and_shells ():
290
+ return (
291
+ current_cmd .startswith ('-' ) or
292
+ any (
293
+ current_cmd .endswith (cmd )
294
+ for cmd in ['python' , 'ruby' , 'node' ]
295
+ )
292
296
)
293
- ):
294
- current_cmd = None
297
+
298
+ if (filter_interpretters_and_shells ()):
299
+ current_cmd = None
295
300
296
301
if current_cmd :
297
302
pconf ['shell_command' ].append (current_cmd )
0 commit comments