Add option to open config in nvim

Signed-off-by: nathom <nathanthomas707@gmail.com>
This commit is contained in:
nathom 2021-06-15 15:53:36 -07:00
parent 3907178f5f
commit 11443af6aa

View file

@ -2,11 +2,12 @@
import logging
import os
import shutil
from getpass import getpass
from hashlib import md5
import click
import requests
import requests # type: ignore
from . import __version__
from .clients import TidalClient
@ -279,7 +280,7 @@ def lastfm(ctx, source, url):
"-ov",
"--open-vim",
is_flag=True,
help="Open the config file in the vim text editor.",
help="Open the config file in the nvim or vim text editor.",
)
@click.pass_context
def config(ctx, **kwargs):
@ -298,6 +299,9 @@ def config(ctx, **kwargs):
click.launch(CONFIG_PATH)
if kwargs["open_vim"]:
if shutil.which("nvim") is not None:
os.system(f"nvim '{CONFIG_PATH}'")
else:
os.system(f"vim '{CONFIG_PATH}'")
if kwargs["directory"]: