Skip to content

別ウインドウ開かずにやれないもんか #1

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

Closed
kyoh86 opened this issue Aug 14, 2019 · 13 comments
Closed

別ウインドウ開かずにやれないもんか #1

kyoh86 opened this issue Aug 14, 2019 · 13 comments
Assignees

Comments

@kyoh86
Copy link
Owner

kyoh86 commented Aug 14, 2019

Tapi_ から始まる関数用意してそこでウィンドウの操作などやれそう
https://qiita.com/kyoh86/items/a2208962a2ea8db2337f#comment-f72b98c826884147667c

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

単純に new ではなく edit でやれば一応同じウィンドウで開ける

execute('new '.a:filename)

んだけど、編集終了時に何が起きるかをちゃんと追えてない。

@kyoh86 kyoh86 self-assigned this Aug 18, 2019
@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

zshrcんなかで

function :edit() {
  VIM_EDITERM_HOGEHOGE=fugafuga
  $EDITOR $@
}

function :new() {
...
}

function :vnew() {
...
}

とかやれたら面白そう

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

急に VIM_EDITERM_ 何やねんってなったので自分のために解説:

処理をちょっと分けようと思ったときに、引数でやるのは筋が悪い。($EDITOR $@ みたいに丸投げできる状態が理想的)ので、環境変数設定してやって多分 plugins/tvim で何か処理を分けるのが正しい。

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

:editとかを作る場合、そもそもwaitしなくていいかもしれない。

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

編集終了時の挙動として期待されるのは、

もとの :terminal に戻る だと思うんだけど、ちょっとそれ辛すぎない?
QuitPreで拾って buffer N で処理すれば良いのかな????

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

win_findbuf()

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

QuitPreで拾って buffer N で処理

ハズレ。駄目だった

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

編集終了時の挙動として期待されるのは、もとの :terminal に戻る だと思う

そんなん人によるし、そのへんは別のプラグインに任せよう
https://github.com/qpkorr/vim-bufkill

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

環境変数でやるの危険だ。
環境変数を変えると$EDITORがWAITしなくなっちゃう。それは困る。
tvim => editorにリネームして、$EDITORにはそいつをセットして、
vim()とか定義するときは別のシェル呼ぶほうが良さそう

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

🤔 そこまでして NOWAIT 版いるかな

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

NOWAITの場合は、 setlocal bufhidden=wipe 要らなさそう

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

vim() を NOWAIT にした場合、 vim hoge && cat hoge みたいなスクリプトは動かなくなる。
そんなことしてるケースそうとうレアではあるだろうけど

@kyoh86
Copy link
Owner Author

kyoh86 commented Aug 18, 2019

$EDITORもvim()もWAITしてよくて、 :drop() みたいな特殊関数として用意してあげれば良い気がしてきた > NOWAIT

kyoh86 pushed a commit that referenced this issue Aug 19, 2019

Verified

This commit was signed with the committer’s verified signature.
myitcv Paul Jolly
for #1
@kyoh86 kyoh86 closed this as completed in 1329c61 Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant