LoginSignup
2
1

More than 5 years have passed since last update.

vimのsyntaxのデバッグの補助コマンド

Posted at

vimのスタイル(syntaxとhighlight)

vimのsyntax定義はなかなか複雑なことができてしまうので、(プラグイン作成中など)適用状態の確認がそれなりに必要です。

というわけで、ぐぐって、「現在状態を出力する方法」を学びました。
毎回やるのは面倒なのでコマンド化します。

さすがにキーにアサインするほどじゃないかな...

.vimrc
" function
function! s:EchoSyntax(status)
  if a:status
    redraw | echon synIDattr(synID(line('.'), col('.'), 0), 'name')
  endif
endfunction

" command
command! SyntaxEcho        :call <SID>EchoSyntax(1)

これで現在のカーソルの位置のsyntax名をechoすることができます。

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