From c669333929b35d01deb3bdaaf655357b8921a0a3 Mon Sep 17 00:00:00 2001 From: Ethan Schoonover Date: Sat, 9 Apr 2011 21:50:39 -0700 Subject: [PATCH] [vim] added au cmd to check if vim has switch from term to gui mode and call CS --- colors/solarized.vim | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/colors/solarized.vim b/colors/solarized.vim index 8e3b0b8..0df0e00 100644 --- a/colors/solarized.vim +++ b/colors/solarized.vim @@ -4,7 +4,7 @@ " (see this url for latest release & screenshots) " License: OSI approved MIT license (see end of this file) " Created: In the middle of the night -" Modified: 2011 Apr 07 +" Modified: 2011 Apr 09 " " Usage "{{{ " @@ -922,6 +922,25 @@ exe "hi! pandocMetadataKey" .s:fg_blue .s:bg_none .s:fmt_none exe "hi! pandocMetadata" .s:fg_blue .s:bg_none .s:fmt_bold hi! link pandocMetadataTitle pandocMetadata +"}}} +" Utility autocommand "{{{ +" --------------------------------------------------------------------- +" In cases where Solarized is initialized inside a terminal vim session and +" then transferred to a gui session via the command `:gui`, the gui vim process +" does not re-read the colorscheme (or .vimrc for that matter) so any `has_gui` +" related code that sets gui specific values isn't executed. +" +" Currently, Solarized sets only the cterm or gui values for the colorscheme +" depending on gui or terminal mode. It's possible that, if the following +" autocommand method is deemed excessively poor form, that approach will be +" used again and the autocommand below will be dropped. +" +" However it seems relatively benign in this case to include the autocommand +" here. It fires only in cases where vim is transferring from terminal to gui +" mode (detected with the script scope s:vmode variable). It also allows for +" other potential terminal customizations that might make gui mode suboptimal. +" +autocmd GUIEnter * if (s:vmode != "gui") | exe "colorscheme " . g:colors_name "| endif "}}} " License "{{{ " --------------------------------------------------------------------- @@ -946,4 +965,5 @@ hi! link pandocMetadataTitle pandocMetadata " OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " THE SOFTWARE. " +" vim:foldmethod=marker:foldlevel=0 "}}}