8000 Add cli command 'edit'. by GlebPoljakov · Pull Request #707 · tmux-python/tmuxp · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tmuxp/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import platform
import sys
from subprocess import call

import click
import kaptan
Expand Down Expand Up @@ -1209,6 +1210,15 @@ def command_convert(confirmed, config):
print('New config saved to <%s>.' % newfile)


@cli.command(name='edit', short_help='Run $EDITOR on config.')
@click.argument('config', type=ConfigPath(exists=True), nargs=1)
def command_edit_config(config):
config = scan_config(config)

sys_editor = os.environ.get('EDITOR', 'vim')
call([sys_editor, config])


@cli.command(
name='ls', short_help='List configured sessions in {}.'.format(get_config_dir())
)
Expand Down
0