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?

More than 3 years have passed since last update.

【Ubuntu】vimでPrettierする

Last updated at Posted at 2021-09-07

vimのプラグイン管理とかがまだよくわかってないけど、とりあえず動いたからメモ。

1. vim-prettierのインストール(https://github.com/prettier/vim-prettier#install)
$ mkdir -p ~/.vim/pack/plugins/start
$ git clone https://github.com/prettier/vim-prettier ~/.vim/pack/plugins/start/vim-rettier

######2.Prettierのインストール

$ sudo npm install -g prettier

######3.vim-plugのインストール(https://github.com/junegunn/vim-plug#vim)

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

######4.~/.vimrcの設定(https://volpe.hatenablog.com/entry/2019/03/29/095753)

call plug#begin()
" post install (yarn install | npm install) then load plugin only for editing supported files
Plug 'prettier/vim-prettier', {
  \ 'do': 'yarn install',
    \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'svelte', 'yaml', 'html'] }
call plug#end()

TODO: 改行される幅が広すぎるので設定したいが、~/.vimrcに次のような設定をしても反映されない。

let g:prettier#config#tab_width = 1

TODO解決: vimでのタブの文字数がデフォルトで8なので、それをかえてやるとよい。
https://ex1.m-yabe.com/archives/3702

set tabstop=4
set shiftwidth=4
0
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
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?