1
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?

More than 3 years have passed since last update.

vim で Markdown table をぺろっと整形する

Posted at

背景

  • Markdown の table の整形めんどい
  • vim でぺろっと整形したい

Markdown での表の表現はいくつかりますが, ここでは | で表現する形式(qiita や github で採用されている形式?)を想定します.

方法

vim-easy-alignでvimmerへの道を極めよう
https://qiita.com/takuyanin/items/846cb2b3e541f79f0d54

Align GitHub-Flavored Markdown Tables in Vim
https://thoughtbot.com/blog/align-github-flavored-markdown-tables-in-vim

ありがとうございます! vim-easy-align 使います.

Install

私の場合は NeoBundle でしたので, ~/.vimrc の neobundle のところに

NeoBundle 'junegunn/vim-easy-align'

を追加し, vim 起動して

:NeoBundleInstall でいけました.

整形

table の領域を選択して, :EasyAlign で起動して, *| でいけます.

Align GitHub-Flavored Markdown Tables in Vim

を参考にして, ショートカットを登録しましょう.

au FileType markdown vmap <Leader><Bslash> :EasyAlign*<Bar><Enter>

を vimrc についかします.

デフォルト(Leader が設定されておらず \ に割り当たっている)ですと, table 領域選択して \\ でぺろっと整形できます! :tada:

1
0
0

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
1
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?