Skip to content
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

g:quickrun_config の設定方法を改善/改良する #59

Open
osyo-manga opened this issue May 4, 2013 · 20 comments
Open

g:quickrun_config の設定方法を改善/改良する #59

osyo-manga opened this issue May 4, 2013 · 20 comments

Comments

@osyo-manga
Copy link
Contributor

g:quickrun_config の設定方法に関するあれこれを上げる場所。

@osyo-manga
Copy link
Contributor Author

現状の quickrun_config の適用順

    1. コマンドラインで指定された値
    1. b:quickrun_config
    1. g:quickrun_config の {type}
    1. g:quickrun#default_config の {type}
    1. g:quickrun_config の '_'
    1. g:quickrun#default_config の '_'

@osyo-manga
Copy link
Contributor Author

:QuickRun cpp/msvc のように cpp/○○○ を呼び出した場合、 cpp も参照される仕様って help の何処かに書かれてましたっけ?

参考 : https://d.hatena.ne.jp/osyo-manga/20120705/1341478162

@thinca
Copy link
Owner

thinca commented May 4, 2013

そんな仕様ありましたっけ…?

@osyo-manga
Copy link
Contributor Author

ありませんでしたっけ?

@thinca
Copy link
Owner

thinca commented May 4, 2013

なかったはず。

@osyo-manga
Copy link
Contributor Author

あ、今まで勘違いしていた気が…。
:QuickRun cpp -type cpp/msvc のような呼び出しを行った場合、cpp の設定が参照される予感。

@tyru
Copy link
Contributor

tyru commented May 4, 2013

一瞬thincaさんよりおしょーさんの方がquickrunの仕様に熟知しているのかと思って戦慄しました。

@thinca
Copy link
Owner

thinca commented May 4, 2013

それができてるなら tempfile の設定を1つずつ書かなくても済むんですが…。

@osyo-manga
Copy link
Contributor Author

g:quickrun#default_config 見てみましたが確かにtempfileが重複している箇所がありますね。
目的としてはその重複をどうにかしたいところ。

@thinca
Copy link
Owner

thinca commented May 4, 2013

最悪現行と互換性がなくなってもある程度はいいかと思っています。設定なしの人がそのまま移行できればいいかな、くらい。
なるべく複雑になりすぎずに、かつ柔軟に設定できるといいんですが、なかなか悩ましい。

@osyo-manga
Copy link
Contributor Author

現状、C++ では複数の処理系があり、更に環境によって使用されているバージョンも違うため、下記のように細かく設定しています。

let g:quickrun_config = {
\   "cpp/g++4.7.2" : {
\       "command"   : $GCCS_ROOT."/gcc4_7_2/bin/g++",
\       "exec" : "%c %o %s -o %s:p:r ",
\       "cmdopt"    : " -std=gnu++0x",
\       "hook/boost_link/enable" : 0,
\       "outputter/quickfix/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%f:%m',
\       "outputter/location_list/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%f:%m',
\   },
\
\   "cpp/g++4.8" : {
\       "command"   : $GCCS_ROOT."/gcc4_8/bin/g++.exe",
\       "exec" : "%c %o %s -o %s:p:r ",
\       "cmdopt"    : " -std=gnu++0x",
\       "hook/boost_link/enable" : 1,
\       "outputter/quickfix/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%f:%m',
\       "outputter/location_list/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%f:%m',
\   },
\
\   "cpp/msvc2010" : {
\       "command" : "cl",
\       "exec"    : "%c %o %s:p",
\       "cmdopt"  : "/D_DEBUG /D_CONSOLE /D_UNICODE /DUNICODE",
\       "hook/output_encode/encoding" : "sjis",
\       "hook/msvc_compiler/enable" : 1,
\       "hook/msvc_compiler/target" : "C:/Program Files/Microsoft Visual Studio 10.0",
\   },
\
\   "cpp/msvc2008" : {
\       "command" : "cl",
\       "exec"    : "%c %o %s:p",
\       "cmdopt"  : "/D_DEBUG /D_CONSOLE /D_UNICODE /DUNICODE",
\       "hook/output_encode/encoding" : "sjis",
\       "hook/msvc_compiler/enable" : 1,
\       "hook/msvc_compiler/target" : "C:/Program Files/Microsoft Visual Studio 9.0",
\   },
\
\   "cpp/clang++3.0" : {
\       "command"   : $LLMV_WORK_ROOT."/BUILD_3_0/bin/clang++",
\       "exec" : "%c %o %s -o %s:p:r ",
\       "cmdopt"    : "-std=gnu++0x ",
\       "outputter/quickfix/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%m\ %f:%l:',
\       "outputter/location_list/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m',
\   },
\
\   "cpp/clang++3.1" : {
\       "command"   : $LLMV_WORK_ROOT."/BUILD_3_1/bin/clang++",
\       "exec" : "%c %o %s -o %s:p:r ",
\       "cmdopt"    : "-std=gnu++0x ",
\       "outputter/quickfix/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%m\ %f:%l:',
\       "outputter/location_list/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m',
\   },
\}

上記の設定は一部だけなんですがここら辺の設定がだいぶアレな感じになってしまっているのでどうにかしたいんですよねぇ…。

@osyo-manga
Copy link
Contributor Author

案1
:QuickRun cpp/gcc/4.8 みたいな type を呼び出した場合
cppcpp/gcccpp/gcc/4.8
のような順で config が適用されればいいのではないだろうか。
この仕様を当てはめると

let g:quickrun_config = {
\   "cpp/g++" : {
\       "cmdopt"    : " -std=gnu++0x",
\       "exec" : "%c %o %s -o %s:p:r ",
\       "hook/boost_link/enable" : 0,
\       "outputter/quickfix/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%f:%m',
\       "outputter/location_list/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%f:%m',
\   }
\
\   "cpp/g++/4.7.2" : {
\       "command"   : $GCCS_ROOT."/gcc4_7_2/bin/g++",
\   },
\
\   "cpp/g++/4.8" : {
\       "command"   : $GCCS_ROOT."/gcc4_8/bin/g++.exe",
\   },
\
\
\   "cpp/msvc" : {
\       "command" : "cl",
\       "exec"    : "%c %o %s:p",
\       "cmdopt"  : "/D_DEBUG /D_CONSOLE /D_UNICODE /DUNICODE",
\       "hook/output_encode/encoding" : "sjis",
\       "hook/msvc_compiler/enable" : 1,
\   },
\
\   "cpp/msvc/2010" : {
\       "hook/msvc_compiler/target" : "C:/Program Files/Microsoft Visual Studio 10.0",
\   },
\
\   "cpp/msvc2008" : {
\       "hook/msvc_compiler/target" : "C:/Program Files/Microsoft Visual Studio 9.0",
\   },
\
\
\   "cpp/clang++" : {
\       "exec" : "%c %o %s -o %s:p:r ",
\       "cmdopt"    : "-std=gnu++0x ",
\       "outputter/quickfix/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m,%m\ %f:%l:',
\       "outputter/location_list/errorformat" : '%f:%l:%c:\ %t%*[^:]:%m',
\   },
\
\   "cpp/clang++/3.0" : {
\       "command"   : $LLMV_WORK_ROOT."/BUILD_3_0/bin/clang++",
\   },
\
\   "cpp/clang++3.1" : {
\       "command"   : $LLMV_WORK_ROOT."/BUILD_3_1/bin/clang++",
\   },
\}

こんな感じの設定になると思います。
これであればだいぶスッキリした感じになるかと。
ただ、g:quickrun#default_configも合わせると適用順がちょっと複雑になるかも…。

@thinca
Copy link
Owner

thinca commented May 4, 2013

その場合、:QuickRun cpp:QuickRun cpp/gcc などを呼んだ場合にどのような順序で適用するのがいいかが難しそうです。

@osyo-manga
Copy link
Contributor Author

はい、それはいまわたしもどうしようか考えていました。どうしよかな。

@osyo-manga
Copy link
Contributor Author

:QuickRun cppcpp
:QucikRun cpp/gcccppgcc
かなぁ。
あと次のように type が設定されている場合も複雑になりそう…。

let g:quickrun_config = {
\   "cpp" : {
\       "type" "cpp/g++/4.8"
\   }
    ... gcc や msvc の設定
\}

" この場合、どのように適用するか。
:QuickRun cpp

@osyo-manga
Copy link
Contributor Author

今までの例は C++ の場合だったんですが、こんな感じで設定が多くなる言語とかって他にありますかね。
(そもそも他に需要があるのかどうか。

@thinca
Copy link
Owner

thinca commented May 4, 2013

処理系が複数ある言語はそれなりにありますね。バージョン違いまで含めると、ほとんどの言語で該当しそうな予感です。

@thinca
Copy link
Owner

thinca commented May 4, 2013

あと、これを入れるとしたら次期バージョンになるわけですが、次期バージョンでは quickrun 自体の連続実行も視野に入れてます。つまり、コンパイルと実行を別々の設定にしておいて、それらを連続実行させる、などを考えてます。この場合も設定をどうするか、結構悩ましいです。

@osyo-manga
Copy link
Contributor Author

連続して実行する場合は、現行のようにexecに複数設定するのではなくて、typeに複数設定しておいて個別に:QuickRunが走る感じになるんですかね(想像。

@osyo-manga
Copy link
Contributor Author

あとわたしはコンパイルと実行を別々に設定しているんですが、次のようにtypesubtype(自前処理)にそれぞれ設定して呼び出し方を使い分けていますね。

let g:quickrun_config = {
\   "cpp/g++" : {
        ...
\   }
\
\   "run/vimproc" : {
        ...
\   },
\
\   "cpp" : {
\       "type" : "cpp/g++",
\       "subtype" : "run/vimproc"
\   }
\}

<Leader>rcpp.type を呼び出す(コンパイル)
<Leader>R : cpp.subutype を呼び出す(実行)

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

3 participants