xuhdev / SingleCompile

A Vim plugin making it more convenient to compile or run a single source file.
https://singlecompile.topbug.net
GNU General Public License v3.0
123 stars 20 forks source link

SCViewResult options, improve ShowResultAfterRun #51

Closed mMontu closed 10 years ago

mMontu commented 10 years ago

1) Option SingleCompileRun_split allows for vertical splits 2) Rename g:SingleCompile_resultheight to use it as width for vertical splits 3) Create a mapping to make it easier to close the result window 4) Substitute exec "g/.*/d", as it interferes with 'hlsearch', i.e., if 'hlsearch' is set all the text on the result window is highlighted and the previous search is replaced. 5) When the g:SingleCompile_showresultafterrun option is active:

mMontu commented 10 years ago

Sure, no problems!

oblitum commented 10 years ago

@mMontu notice that, GitHub doesn't warn of new commits, you must make a comment so that the original author is aware.

mMontu commented 10 years ago

@oblitum thanks for the hint. I suspected of that, thus I have made the comment just after the commit 2 days ago.

oblitum commented 10 years ago

@mMontu ah ok, I thought it was before.

mMontu commented 10 years ago

As it took me some time to figure out how to achieve this, the code alone is very clear for me :) I've changed the example explanation, but I'm not sure if it is clear enough for others. Any suggestions on how to improve the text?

xuhdev commented 10 years ago

@mMontu How about the following:

It is also possible to select between vertical or horizontal split depending on the current window width. To achieve this we can create a key mapping to call :update before calling |:SCCompileRun|. This can be done in a new mapping, or replacing the suggested mapping which calls |:SCCompileRun|, .

Another option is to put this tip in the wiki page instead of the doc, or in both places.

I've checked the code again and I think it's ready, except that in the doc, I see g:SingleCompile_split, but in reality, I see g:SingleCompileRun_split. To be consistent with other SingleCompile options, I would suggest using g:SingleCompile_split. This should probably be the last time to do some modifications.

Thanks for the pull request, and sorry for modifying for so many times.

mMontu commented 10 years ago

Hi @xuhdev, thanks for your thoroughly review.

About the suggested change on the documentation, it is not clear to me. It seems that there is some misunderstanding about the word 'update' I wrote on the explanation of the example and the :update command that is used on the mapping:

To achieve this it is necessary to update the option on the mapping that calls  |:SCCompileRun|

Meaning to write a new value to the option before executing the plugin command.

The command :update is similar to :write, but avoid writing to the disk if the file was not modified. It has nothing to do with selecting between vertical or horizontal split depending on the current window width. It is there because I usually insert it on some mappings as I don't like the 'autowrite' option. I've just noticed that SingleCompile already has an option for this, g:SingleCompile_autowrite, but I've never looked for it before, as I didn't expected it on the plugin.

Anyway, please let me know if you want that I update the documentation with this text or if you prefer to change it. I can also remove the :update command from the mapping, although I have conceived the example as a general guide to someone looking for a way to dynamically decide how to display the results. I thought it would be up to the user to understand and adapt the command for his needs, even including more clauses to that if in case he prefers to open the results on a new Tab on some condition.

I would vote for having the example at least on the doc, as it is a intuitive place to look for it.

I'll include the change to option name on the next commit, along the documentation change you prefer.

xuhdev commented 10 years ago

@mMontu Thanks for your looking into the problem. Yes, I think we can remove :update from the example, and I now think that my modification of the doc is not really appropriate. Please update the explanation, once it's clear of misunderstanding, we are good. I agree to include the example in the doc.

mMontu commented 10 years ago

@xuhdev I've made a small update on the doc. Please let me know if you find a better wording. Thanks for your help!

xuhdev commented 10 years ago

Thanks! I'm gonna merge it manually to squash them into a single commit.

xuhdev commented 10 years ago

Merged: 96d6c92f9afb3d3f90e6bf4f853cc6ecd1af5773

Thanks!