-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:Scratch コマンドの、ファイル名指定 write 時に、scratch解除するハンドラが 動作していない #30
Comments
function! s:CheckScratchWritten()
- if &buftype ==# 'nofile' && expand('%').'x' !=# 'x' && exists('b:cmdex_scratch') && b:cmdex_scratch == 1
- setlocal buftype= swapfile
+ if exists('b:cmdex_scratch') && b:cmdex_scratch == 1 && expand('%').'x' !=# 'x'
+ set buftype< swapfile<
unlet b:cmdex_scratch
endif
endfunction |
9.0.639 で再現を確認しました。 Scratchバッファを さらに推測だが どうするかはまだ未定。なにが起こってるのか要検証。 |
たぶんコレが原因で挙動が変わったんやなかろか? |
何が起こったかはおおよそわかった。 |
これは間違い。bt=nofileのままだった。
これはあってた。よって これ自体はVimの挙動変更なので、尊重する。 逆に Scratch バッファに名前を付ける正しい方法は何か? |
無名バッファについては この非直交性はdocumentedかしら? intendedかしら? |
|
|
s:CheckScratchWritten() を次のように変えると、以前の動作に近づきそう。 以下のテストをしてる
function! s:CheckScratchWritten()
if &buftype ==# 'nofile' && get(b:, 'cmdex_scratch', 0) == 1 && expand('<afile>') !=# ''
unlet b:cmdex_scratch
setlocal buftype= swapfile
execute "edit!" expand('<afile>')
endif
endfunction 差分 function! s:CheckScratchWritten()
- if &buftype ==# 'nofile' && expand('%').'x' !=# 'x' && exists('b:cmdex_scratch') && b:cmdex_scratch == 1
- setlocal buftype= swapfile
+ if &buftype ==# 'nofile' && get(b:, 'cmdex_scratch', 0) == 1 && expand('<afile>') !=# ''
unlet b:cmdex_scratch
+ setlocal buftype= swapfile
+ execute "edit!" expand('<afile>')
endif |
9.0 で修正予定。 以上、本件は終了します。 |
:Scratch
コマンドで作成した scratchバッファの、
ファイル書込み時の scratch解除のハンドル (
s:CheckScratchWritten()
) が、期待通り 動作していないようです。s:CheckScratchWritten()
の期待としては:scratchバッファを
:write NEW_FILE.txt
として 新しいファイルを作った時に、scratch解除して、新しい
NEW_FILE.txt
のバッファ としたい;ということだと思います。
が、どうも、scratchバッファを
:write NEW_FILE.txt
しても、buffer名 (
%
) が変わらず、scratchの解除条件 に引っ掛からないようです。以前は 動作していた気がするので、vim本体側の仕様変更 かなにかではないかと。
The text was updated successfully, but these errors were encountered: