0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

コマンド一つでQiita記事執筆に取り掛かれるようにする

Last updated at Posted at 2024-12-23

やったこと

コマンド一つで記事執筆に取り掛かれるようにしました。

  • 作成する記事のプレビュー画面の起動
  • エディタの編集画面の起動
qiita <作成する記事のタイトル>

test.gif

きっかけ

最近アウトプットができておらず、アウトプットの習慣を作りたいと考えています。
そこでQiitaの記事執筆をラクにする方法を考え、Qiita CLIやGitHubとの連携を行いました。

よりラクにしていく方法を模索し、今回の設定をしました。

前提

本記事の設定を行う場合、先に下記2記事の設定を実施する必要があります。

  • Qiita CLIの設定

  • GitHubの設定

設定方法

シェル起動時に読み込まれる設定ファイルに下記を追加します。
私はzshを利用しているので、~/.zshrcに追記しました。
~/git/qiitaの部分は、ご自身のQiitaのリポジトリのルートディレクトリに変更してください。

qiita(){
        cd ~/git/qiita
        npx qiita new $1
        code ~/git/qiita/public
        code ~/git/qiita/public/$1.md
        npx qiita preview
}

試す場合はsource ~/.zshrcを実行してください。
シェルを再起動する場合は不要です。

感想

  • Qiita CLIやGitHubの設定は思っていたより簡単
  • 使い慣れたエディタが利用可能で執筆が捗りそう
  • 他の記事を参照しやすいのが便利
  • 記事の管理が楽になりそう

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?