0
0

More than 5 years have passed since last update.

Vimのおまじない(プラグイン作者向け)

Posted at

プラグイン作成で気付いたことがあったら追記していく。

プラグイン・オプションの設定

いまだと次のようにプラグインのオプションを定義する

let g:hoge = get(g:, 'hoge', 1)
" g:hogeが定義してあればその値、なければデフォルトで1にする

ここで次になるので注意

let g:hoge = 0
let g:hoge = get(g:, 'hoge', 1)
echo g:hoge " 0

let g:hoge = 0
let g:hoge = get(g:, 'hoge ', 1)
"_________________________^_____ スペースがある
echo g:hoge " 1

execute的にスクリプトが処理するんじゃなく、純粋に文字列として処理されてるっぽい(機能からしてg:というディクショナリの検索だからまあそうだけど)
気付くのに時間がかかった...😢

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