あなたが探しているのはの(N
オプションだと思いますcinoptions
。試してみてくださいset cinoptions+=(0
。ドキュメントによると、これはあなたが求めている配置のように見えます。
詳細については、help コマンドを使用する:help cinoptions-values
か、オンライン バージョンのcinoptions-values のヘルプを参照してください。
タブに関する限り、 で無効expandtab
にし:set noexpandtab
、それに応じてタブストップ、ソフトタブストップ、およびシフト幅がすべて設定されていることを確認する必要があります。例として、Linux ソース コードは上記のようなスタイルを使用しており、私の vimrc には次のようなものがあります。
setlocal ts=8 sts=8 sw=8 tw=80
" Don't expand tabs to spaces.
setlocal noexpandtab
" Enable automatic C program indenting.
setlocal cindent
" Don't outdent function return types.
setlocal cinoptions+=t0
" No extra indentation for case labels.
setlocal cinoptions+=:0
" No extra indentation for "public", "protected", "private" labels.
setlocal cinoptions+=g0
" Line up function args.
setlocal cinoptions+=(0
" Setup formatoptions:
" c - auto-wrap comments to textwidth.
" r - automatically insert comment leader when pressing <Enter>.
" o - automatically insert comment leader after 'o' or 'O'.
" q - allow formatting of comments with 'gq'.
" l - long lines are not broken in insert mode.
" n - recognize numbered lists.
" t - autowrap using textwidth,
setlocal formatoptions=croqlnt