diff --git a/CONTRIBUTING.markdown b/CONTRIBUTING.markdown deleted file mode 100644 index eb68f77..0000000 --- a/CONTRIBUTING.markdown +++ /dev/null @@ -1 +0,0 @@ -Tips on contributing. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e69de29..0000000 diff --git a/LICENSE.markdown b/LICENSE.markdown new file mode 100644 index 0000000..44fe50a --- /dev/null +++ b/LICENSE.markdown @@ -0,0 +1,23 @@ +License: The MIT License (MIT) + +Copyright (c) 2013,2014 Reed Esau + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + diff --git a/README.markdown b/README.markdown index 108386a..063bd34 100644 --- a/README.markdown +++ b/README.markdown @@ -1,218 +1,164 @@ # `thematic.vim` -_Manage the look and feel of your Vim text editor_ +> Conveniently manage Vim’s appearance to suit your task and environment -* Written in pure Vimscript for recent versions of MacVim, gVim, Vim, etc. +* Groups global settings (like colorscheme) into ‘themes’ * Stays out of your way, except where you want it -* No predefined key mappings that could interfere with your other mappings -* Support for font and fullscreen settings in GUI-based Vim -* Integrates with [airline][https://github.com/bling/vim-airline], another `themeable` plugin +* No predefined key mappings to interfere with your other mappings +* [vim-thematic-gui](https://github.com/reedes/vim-thematic-gui) extension + available with GUI-based support for: font, fullscreen, etc. +* Integrates with [airline][https://github.com/bling/vim-airline] ## Why `thematic`? -Many Vim users will keep things simple by sticking with a single theme that suits their needs, configuring it in their `.vimrc` by setting colorscheme, `guifont`, number, status line, etc.. Nothing wrong with that approach. +You may be among the many Vim users who keep things simple by sticking +with a single theme that suits your needs, configuring it in your `.vimrc` +by setting the color scheme, font and status line. -But you may instead want to configure the visual details of Vim to match the task at hand, or even to suit your mood. For example, you might choose a theme that is less fatiguing to your eyes given the ambient lighting conditions, where you'll have a muted theme for a dark room and a high-contrast theme for use in a bright one. +Or you might instead be among the users who instead configure the visual +details of Vim to match the lighting conditions or task at hand, or even +to suit your mood. For example, you might choose a theme that is less +fatiguing to your eyes given the ambient lighting conditions, where you'll +have a muted theme for a dark room and a high-contrast theme for use in +a bright one. -Writing code, you may want a status bar, ruler, transparency and a programming font. But if you're writing an essay or screenplay, you may want the screen stripped of all extraneous detail, with a traditional font and generous left and right margins. +Writing code, you want a status bar, ruler, a hint of transparency and +a programming font. But if you're writing an essay or screenplay, you want +the screen stripped of all extraneous detail, with a traditional font and +generous left and right margins. -You may want to complement a colorscheme with a particular typeface -- a lightweight anti-aliased typeface like Adobe's _Source Code Pro ExtraLight_ may look great against a black background but be unreadable against a white one. Or for a given typeface you may want a specific [leading][http://en.wikipedia.org/wiki/Leading] as supported with Vim's `linespace`. +Managing such an multi-theme environment in Vim has traditionally been +a hassle. The `thematic` plugin is intended to solve that problem, +providing you flexibility and convenience. -Managing such an environment in Vim has traditionally been a hassle. The `thematic` plugin is intended to provide the Vim user more flexibility and convenience. +## Installation + +Install using Pathogen, Vundle, Neobundle, or your favorite Vim package +manager. + +## Configuration + +### Themes + +A few of Vim's standard `colorschemes` are configured by default, but +you'll want to override them with your own, like this: + + ```vim + let g:thematic#themes = { + \ 'bubblegum' : { + \ }, + \ 'jellybeans' : { 'laststatus': 0, + \ 'ruler': 1, + \ }, + \ 'matrix' : { 'colorscheme': 'base16-greenscreen', + \ 'laststatus': 0, + \ }, + \ 'solar_dark' : { 'colorscheme': 'solarized', + \ 'background': 'dark', + \ 'diff-color-fix': 1, + \ 'sign-column-color-fix': 1, + \ }, + \ 'solar_lite' : { 'colorscheme': 'solarized', + \ 'background': 'light', + \ 'signcolumn-color-fix': 1, + \ }, + \ } + ``` + +If you don't specify a `colorscheme`, `thematic` will attempt to load one +given your theme name. + +You can also specify a dictionary of default values, to be shared by all +of your themes. + + ```vim + let g:thematic#defaults = { + \ 'airline-theme': 'jellybeans', + \ 'laststatus': 2, + \ } + ``` + +Note that an explicit setting in a theme will always override these defaults. + +Note also that `thematic` stays out of your way, ignoring any settings +that you aren't explicitly setting through your `thematic` configuration. +For example, you can `set guifont=` in your .gvimrc independent of your +`thematic` configuration. + +### Commands + +Running `:ThematicFirst` invoke `thematic` and chooses the first theme, +as your themes will be reordered alphabetically by name. + + ```vim + :ThematicFirst " switch to the first theme, ordered by name + :ThematicNext " switch to the next theme, ordered by name + :ThematicPrevious " switch to the previous theme, ordered by name + :ThematicRandom " switch to a random theme + :ThematicOriginal " revert to the original theme + :Thematic {theme_name} " load a theme by name + ``` + +`thematic` does not map any keys by default, but you can easily do so in +your `.vimrc` file: + + ```vim + nnoremap t ThematicNext + nnoremap T ThematicPrevious + ``` ## What theme properties can I set? For each theme you specify one or more properties. For console or GUI Vim: -* `laststatus` (0, 1, or 2) - _controls the visibility of the status bar_ -* `ruler` - _as alternative to status bar, shows minimal position details in lower right_ -* `colorscheme` - _set the colors for all windows_ -* `background` (dark or light) - _some colorschemes can be further configured via background_ -* `sign-column` - _optional two-character gutter on left-side of window_ -* `airline-theme` - _plugin for theming your status bar_ -* `sign-column-color-fix` - _temporarily modifies colorscheme to force gutter background_ -* `diff-color-fix` - _temporarily modifies colorscheme to force diff character color_ -* `fold-column-color-mute` - _temporarily modifies colorscheme to hide indicators in foldcolumn_ -* `force-redraw` - _if 1, forces a `redraw!` after `thematic` makes changes_ +* `laststatus` (0, 1, or 2) - controls the visibility of the status bar +* `ruler` - as alternative to status bar, shows minimal position details + in lower right +* `colorscheme` - set the colors for all windows +* `background` (dark or light) - some colorschemes can be further + configured via background +* `sign-column` - optional two-character gutter on left-side of window +* `airline-theme` - plugin for theming your status bar +* `sign-column-color-fix` - temporarily modifies colorscheme to force + gutter background +* `diff-color-fix` - temporarily modifies colorscheme to force diff + character color +* `fold-column-color-mute` - temporarily modifies colorscheme to hide + indicators in foldcolumn +* `force-redraw` - if 1, forces a `redraw!` after `thematic` makes changes -For GUI-based Vim only: -* `typeface`, `font-size`, and `linespace` - _be specific about typography_ -* `fullscreen` and `fullscreen-background-color-fix` - _force a switch to fullscreen, with optional change of color of the background (or border)_ -* `columns` and `lines` - _manage the width of margins in `fullscreen` mode_ -* `transparency` (0-100) - _view details of window and desktop beneath Vim_ +For GUI-based options, see the `vim-thematic-gui` plugin. Here’s +a summary: -* Check `:help thematic` for details. - -## Basic Usage - -* Run `:ThematicFirst` to invoke `thematic` and choose the first theme. Your themes will be ordered alphabetically. - - ```vim - :ThematicFirst " select the first theme - :ThematicNext " select the next theme - :ThematicPrevious " select the previous theme - :ThematicRandom " select a random theme - :ThematicOriginal " revert to the original theme - ``` - -`thematic` does not map any keys by default, but you can easily do so in your `.vimrc` file, like this: - - ```vim - nmap t ThematicNext - nmap T ThematicPrevious - ``` - -...where with the default leader key of `\`, `\t` would select the next theme in your list, as ordered alphabetically. - -A few of Vim's standard `colorschemes` are configured as default themes, but you'll likely want to override them with your own, like this: - - ``` - let g:thematic#themes = { - \ 'bubblegum' : { 'typeface': 'CosmicSansNeueMono', - \ 'sign-column-color-fix': 1, - \ 'transparency': 10, - \ }, - \ 'desert' : { 'sign-column': 0, - \ }, - \ 'jellybeans' : { 'typeface': 'Droid Sans Mono', - \ 'font-size': 20, - \ 'laststatus': 0, - \ 'ruler': 1, - \ }, - \ 'matrix' : { 'colorscheme': 'base16-greenscreen', - \ 'typeface': 'Dot Matrix', - \ 'laststatus': 0, - \ 'linespace': 9, - \ 'transparency': 10, - \ }, - \ 'reede_dark' : { 'typeface': 'Source Code Pro ExtraLight', - \ 'airline-theme': 'badwolf', - \ }, - \ 'reede_light': { 'typeface': 'Luxi Mono', - \ 'columns': 75, - \ 'font-size': 20, - \ 'fullscreen': 1, - \ 'laststatus': 0, - \ 'linespace': 9, - \ 'sign-column': 1, - \ }, - \ 'solar_dark' : { 'colorscheme': 'solarized', - \ 'background': 'dark', - \ 'diff-color-fix': 1, - \ 'sign-column-color-fix': 1, - \ 'signcolumn-color-fix': 1, - \ 'typeface': 'Source Code Pro Light', - \ }, - \ 'solar_lite' : { 'colorscheme': 'solarized', - \ 'background': 'light', - \ 'font-size': 20, - \ 'signcolumn-color-fix': 1, - \ }, - \ } - ``` - -If you don't specify a `colorscheme`, `thematic` will assume it matches your theme name. - -You can also specify a dictionary of default values, to be shared by all of your themes. - - ``` - let g:thematic#defaults = { - \ 'airline-theme': 'jellybeans', - \ 'fullscreen-background-color-fix': 1, - \ 'laststatus': 2, - \ 'font-size': 20, - \ 'transparency': 0, - \ } - ``` - -Note that an explicit setting in a theme will always override these defaults. - -Note also that `thematic` stays out of your way, ignoring any settings that you aren't explicitly setting through your `thematic` configuration.* For example, you can `set guifont=` in your .gvimrc independent of your `thematic` configuration. - -* * the one exception is `fuoptions` discussed below - -## Installation - -Install using Pathogen, Vundle, Neobundle, or your favorite Vim package manager. - -## Configuration - - ``` - set nocompatible - filetype off - ``` - -## GUI fullscreen capabilities - -`thematic` supports fullscreen capabilities in a GUI-based Vim, including typeface, font-size, lines, columns, linespace, transparency and even the fullscreen background. - -Note that once invoked, `thematic` will override your fullscreen settings, specifically `fuoptions` to get better control over lines and columns and the fullscreen background. - -## Column sizing - -You may wish to adjust the columns while in full screen. Map to Command-9 and Command-0 in your `.vimrc` with: - - ``` - nmap ThematicNarrow - nmap ThematicWiden - ``` +* `typeface`, `font-size`, and `linespace` - be specific about typography +* `fullscreen` and `fullscreen-background-color-fix` - force a switch to + fullscreen, with optional change of color of the background (or border) +* `columns` and `lines` - manage the width of margins in `fullscreen` mode +* `transparency` (0-100) - view details of window and desktop beneath Vim ## FAQ -### Q: I want to set `cursorline`, `wrap`, `foldcolumn`, `list`, `number`, `relativenumber`, `textwidth`, etc. in my themes. +### Q: I want to set `cursorline`, `wrap`, `textwidth`, etc. in my themes. -`thematic` focuses exclusively on global settings. The settings above are not globally-scoped but are instead scoped to individual buffers and windows. These are best set using the existing `FileType` facility in Vim. +`thematic` focuses exclusively on global settings. The settings above are +not globally-scoped but are instead scoped to individual buffers and +windows. These are best set using the `FileType` feature in Vim. -In addition, settings like `textwidth` will modify your documents. This plugin strenuously avoids doing anything to change your documents. - -To your `.vimrc` add - - ``` - filetype plugin on - - " defaults for all buffers/windows - set nocursorline - set foldcolumn=0 - set list - set nonumber - set norelativenumber - set nowrap - ``` - -Then for each `filetype` that you wish to support with specific settings, create a file in the `~/.vim/after/ftplugin` directory. - -For example, to support custom settings for `python` files, create a file `~/.vim/after/ftplugin/python.vim` containing: - - ``` - " python-specific settings - set cursorline - set number - ``` - -Then a cursor line and line numbering will be present whenever you edit a python file. - -### Q: Using MacVim, the fullscreen background color isn't working as expected. How do I change its behavior? - -To have the fullscreen background's color set by `thematic`, enter the following in OSX Terminal: - - ``` - $ defaults write org.vim.MacVim MMNativeFullScreen 0 - ``` - -Or, if you prefer your fullscreen window to float against a standard background: - - ``` - $ defaults write org.vim.MacVim MMNativeFullScreen 1 - ``` +In addition, settings like `textwidth` will modify your documents, which +this plugin strenuously avoids. ### Q: How can I configure Vim to emulate soft-wrapping markdown editors like IAWriter? -It works best in GUI Vim's fullscreen. Several steps are involved: +It works best with GUI Vim's fullscreen. A few steps are involved: -(1) Install a `markdown.vim` plugin from [plasticboy][https://github.com/plasticboy/vim-markdown] or [tpope][https://github.com/tpope/vim-markdown]. +(1) Install a few plugins: -(2) Configure your `~/.gvimrc` to disable the tool bar, etc. +* [vim-thematic-gui](https://github.com/reedes/vim-thematic-gui) - support GUI features in `thematic` +* [vim-markdown](https://github.com/tpope/vim-markdown) - support for editing markdown +* [vim-writer](https://github.com/reedes/vim-writer) - to configure for word processing + +(2) Edit your `.gvimrc` to disable the tool bar, etc. ``` set antialias @@ -223,40 +169,8 @@ It works best in GUI Vim's fullscreen. Several steps are involved: set guioptions-=T "kill toolbar ``` -(3) Edit `~/.vim/after/ftplugin/markdown.vim` to control editing behavior and buffer-specific settings: - - ``` - " IAWriter-like settings (soft-wrap mode) - setlocal textwidth=0 - setlocal wrap - setlocal complete+=k - setlocal complete+=kspell - setlocal complete+=s - setlocal nocursorline - setlocal dictionary+=/usr/share/dict/words - setlocal display+=lastline - setlocal formatoptions+=l " long lines not broken in insert mode - setlocal linebreak " default breakat ' ^I!@*-+;:,./?' - setlocal nojoinspaces " only one space after a .!? - setlocal nolist - setlocal nonumber - setlocal norelativenumber - setlocal spell spelllang=en_us - setlocal spellfile=~/.vim/spell/en.utf-8.add - setlocal thesaurus+=~/.vim/thesaurus/mthesaur.txt - setlocal virtualedit= - setlocal wrapmargin=0 - nnoremap $ g$ - nnoremap 0 g0 - nnoremap j gj - nnoremap k gk - vnoremap $ g$ - vnoremap 0 g0 - vnoremap j gj - vnoremap k gk - ``` - -(4) Finally, add a theme configured to your tastes. Here's an example: +(3) Finally, create a theme configured to your tastes. Here's an example for +MacVim: ``` let g:thematic#themes = { @@ -273,83 +187,36 @@ It works best in GUI Vim's fullscreen. Several steps are involved: \ } ``` -Console-based emulation is trickier, as there's no easy way to create generous left and right margins. You can approximate it by switching from soft-wrap to hard line breaks with additional changes to `~/.vim/after/ftplugin/markdown.vim`: +Without GUI-based Vim, console-based emulation is trickier, as there's no +easy way to create generous left and right margins. You can approximate it +by switching from soft-wrap to hard line breaks with `vim-writer` and using +with a narrow `textwidth`: ``` - setlocal foldcolumn=12 " add a generous left column - setlocal nowrap " replaces 'set wrap' - setlocal textwidth=70 " replaces 'set textwidth=0' + autocmd FileType markdown set foldcolumn=12 textwidth=74 ``` -Note that this chooses hard line breaks over soft-wrapping and thus may not be desirable. You can also use the following setting in your theme to hide the indicators in the fold column. - - ``` - let g:thematic#themes = { - \ 'YOURTHEME' :{ 'fold-column-color-mute': 1, - ... - \ }, - ... - \ } - ``` - -Also, check out: -* [vimroom][https://github.com/mikewest/vimroom/blob/master/plugin/vimroom.vim] -* [vim-writeroom][https://github.com/jamestomasino/vim-writeroom] -* [vim-zenmode][https://github.com/mmai/vim-zenmode] -* [df_moded][https://github.com/nielsadb/df_mode.vim] - -### Q: In Mac OSX I switch to fullscreen via Control+Command+F and the screen is blank! - -You can refresh via `:redraw!` - -(if anybody knows how to fix this, let me know!) - -As an alternative to key command you can force fullscreen in a theme with: - - ``` - let g:thematic#themes = { - \ 'bubblegum' : { 'fullscreen': 1, - \ ... - \ }, - \ ... - \ } - ``` - -## Where to find - -TODO GUI Vim -TODO Colorschemes - -## Monospaced fonts - -Many monospaced fonts are available for free. Note that your computer probably has several installed, such as `Menlo` on OSX. - -### Popular monospaced fonts - -* [Anonymous Pro](https://www.google.com/fonts/specimen/Anonymous+Pro) -* [CosmicSansNeueMono](https://github.com/belluzj/cosmic-sans-neue) -* [Courier Prime](http://quoteunquoteapps.com/courierprime/) -* [Cousine](http://www.google.com/fonts/specimen/Cousine) -* [Cutive Mono](http://www.google.com/fonts/specimen/Cutive+Mono) -* [DejaVu Sans Mono](http://dejavu-fonts.org/wiki/Download) -* [Droid Sans Mono](http://www.google.com/fonts/specimen/Droid+Sans+Mono) -* [Hermit](https://pcaro.es/p/hermit/) -* [Inconsolata](http://www.google.com/fonts/specimen/Inconsolata) -* [Linux Libertine Mono O](http://sourceforge.net/projects/linuxlibertine/) -* [Liberation](https://fedorahosted.org/liberation-fonts/) -* [Luxi Mono Regular](http://www.fontsquirrel.com/fonts/Luxi-Mono) -* [Meslo](https://github.com/andreberg/Meslo-Font) -* [Oxygen Mono](https://www.google.com/fonts/specimen/Oxygen+Mono) -* [PT Mono](http://www.google.com/fonts/specimen/PT+Mono) -* [Share Tech Mono](http://www.google.com/fonts/specimen/Share+Tech+Mono) -* [Source Code Pro](http://www.google.com/fonts/specimen/Source+Code+Pro) -* [Ubuntu Mono](https://www.google.com/fonts/specimen/Ubuntu+Mono) - -## Similar Projects +## Related projects If this project is not to your liking, you might enjoy: + * [vim-ultimate-colorscheme-utility][https://github.com/biskark/vim-ultimate-colorscheme-utility] * [stylish][https://github.com/mislav/stylish.vim] * [vim-session][https://github.com/xolox/vim-session] * [vim-obsession][https://github.com/tpope/vim-obsession] +## See also + +If you like this plugin, you might like these others from the same author: + +* [vim-litecorrect](http://github.com/reedes/vim-litecorrect) - Lightweight auto-correction for Vim +* [vim-quotable](http://github.com/reedes/vim-quotable) - extends Vim to support typographic (‘curly’) quotes +* [vim-thematic-gui](http://github.com/reedes/vim-thematic-gui) — A GUI-based extension to the `thematic` plugin for Vim +* [vim-writer](http://github.com/reedes/vim-writer) - Extending Vim to better support writing prose and documentation + +## Future development + +If you have any ideas on improving this plugin, please post them to the github +project issue page. + + diff --git a/autoload/thematic.vim b/autoload/thematic.vim index 3878399..9a6e13f 100644 --- a/autoload/thematic.vim +++ b/autoload/thematic.vim @@ -1,10 +1,15 @@ -" Autoload portion of plugin/thematic.vim. -" -" Credit for some font regex/functions: https://github.com/drmikehenry/vim-fontsize +" ============================================================================ +" File: autoload/thematic.vim +" Description: autoload script for vim-thematic plugin +" Maintainer: Reed Esau +" Last Change: December 30, 2013 +" License: The MIT License (MIT) +" ============================================================================ if exists("autoloaded_thematic") | finish | endif let autoloaded_thematic = 1 + function! s:getThemeName(mode) let l:avail_names = sort(keys(g:thematic#themes)) let l:avail_count = len(l:avail_names) @@ -41,9 +46,10 @@ function! s:getThemeName(mode) endif endfunction + " Obtain value for theme property, falling back to either user-specified " defaults or the original value. -function! s:getThemeValue(th, key_name, ultimate_fallback_value) +function! thematic#getThemeValue(th, key_name, ultimate_fallback_value) if has_key(g:thematic#defaults, a:key_name) let l:fallback_value = get(g:thematic#defaults, a:key_name) elseif has_key(g:thematic#original, a:key_name) @@ -54,6 +60,7 @@ function! s:getThemeValue(th, key_name, ultimate_fallback_value) return get(a:th, a:key_name, l:fallback_value) endfunction + function! s:airline(th) " set the g:airline_theme variable and refresh "https://github.com/bling/vim-airline/wiki/Screenshots @@ -63,7 +70,7 @@ function! s:airline(th) let g:thematic#original['airline-theme'] = g:airline_theme endif - let l:al = s:getThemeValue(a:th, 'airline-theme', '') + let l:al = thematic#getThemeValue(a:th, 'airline-theme', '') if l:al != '' let g:airline_theme = l:al else @@ -87,27 +94,7 @@ function! s:airline(th) endif endfunction -" If no explicit settings on lines and columns in -" either the theme or the defaults, then leave alone. -function! s:setColumnsAndLines(th) - - let l:columns = s:getThemeValue(a:th, 'columns', 0) - if l:columns > 0 - execute 'set columns=' . l:columns - elseif s:getThemeValue(a:th, 'maxhorz', 0) - set columns=999 - endif - - let l:lines = s:getThemeValue(a:th, 'lines', 0) - if l:lines > 0 - execute 'set lines=' . l:lines - elseif s:getThemeValue(a:th, 'maxvert', 0) - set lines=999 - endif -endfunction - - -function! thematic#load(mode) +function! thematic#init(mode) if len(g:thematic#themes) == 0 echohl WarningMsg | echo 'No themes found.' | echohl NONE finish @@ -145,20 +132,20 @@ function! thematic#load(mode) endtry " use the original background, if not explicit and no default - let l:bg = s:getThemeValue(l:th, 'background', '') + let l:bg = thematic#getThemeValue(l:th, 'background', '') if (l:bg == 'light' || l:bg == 'dark') && &background != l:bg execute 'set background=' . l:bg endif " ------ Fix/mute colors ------ - if s:getThemeValue(l:th, 'sign-column-color-fix', 0) + if thematic#getThemeValue(l:th, 'sign-column-color-fix', 0) " Ensure the gutter matches the text background " TODO how about match the number background? hi! SignColumn guifg=fg guibg=bg endif - if s:getThemeValue(l:th, 'diff-color-fix', 0) + if thematic#getThemeValue(l:th, 'diff-color-fix', 0) " Override diff colors " TODO figure out what to do for cterm hi! DiffAdd guifg=darkgreen guibg=bg "cterm=bold ctermbg=237 ctermfg=119 @@ -167,7 +154,7 @@ function! thematic#load(mode) hi! DiffText guifg=fg guibg=bg endif - if s:getThemeValue(l:th, 'fold-column-color-mute', 0) + if thematic#getThemeValue(l:th, 'fold-column-color-mute', 0) " Ensure the fold column is blank, for non-distracted editing hi! FoldColumn guifg=bg guibg=bg cterm=none ctermbg=none ctermfg=none endif @@ -177,7 +164,7 @@ function! thematic#load(mode) " Force the display of a two-column gutter for signs, etc. " The sign configuration is apparently buffer-scoped, so iterate " over all listed buffers to force the sign column. - let l:sc = s:getThemeValue(l:th, 'sign-column', -1) + let l:sc = thematic#getThemeValue(l:th, 'sign-column', -1) if l:sc == 1 " TODO how to auto-refresh/disable Signify, gitgutter, etc.? sign define dummy @@ -193,7 +180,7 @@ function! thematic#load(mode) " These are all globally-scoped settings - let l:ruler = s:getThemeValue(l:th, 'ruler', -1) + let l:ruler = thematic#getThemeValue(l:th, 'ruler', -1) if l:ruler == 1 set ruler elseif l:ruler == 0 @@ -202,7 +189,7 @@ function! thematic#load(mode) call s:airline(l:th) - let l:ls = s:getThemeValue(l:th, 'laststatus', -1) + let l:ls = thematic#getThemeValue(l:th, 'laststatus', -1) if l:ls > 2 let l:ls = 2 endif @@ -212,24 +199,15 @@ function! thematic#load(mode) " ------ Set GUI-only settings ------ - if has('gui_running') - if exists('*thematic#gui#load') - call thematic#gui#load(l:th) - endif + if has('gui_running') && exists('*thematic#gui#init') + call thematic#gui#init(l:th) endif - let g:thematic#theme_name = l:theme_name - if s:getThemeValue(l:th, 'force-redraw', 0) + if thematic#getThemeValue(l:th, 'force-redraw', 0) redraw! endif endfunction - -function! thematic#adjustColumns(delta) - let l:nu_cols = &columns + a:delta - silent execute "set columns=" . l:nu_cols -endfunction - " vim:ts=2:sw=2:sts=2 diff --git a/plugin/thematic.vim b/plugin/thematic.vim index ec56fac..580e1e4 100644 --- a/plugin/thematic.vim +++ b/plugin/thematic.vim @@ -1,8 +1,10 @@ -" ============================================================================= +" ============================================================================ " File: plugin/thematic.vim -" Description: Theme Manager for the Vim text editor +" Description: script for vim-thematic plugin " Maintainer: Reed Esau -" ============================================================================= +" Last Change: December 30, 2013 +" License: The MIT License (MIT) +" ============================================================================ " " TODO licensing " TODO guioptions @@ -48,15 +50,12 @@ endif " Commands -command -nargs=0 ThematicNarrow call thematic#adjustColumns(-5) -command -nargs=0 ThematicWiden call thematic#adjustColumns(5) - -command -nargs=0 ThematicFirst call thematic#load('#first') -command -nargs=0 ThematicNext call thematic#load('#next') -command -nargs=0 ThematicPrevious call thematic#load('#previous') -command -nargs=0 ThematicRandom call thematic#load('#random') -command -nargs=0 ThematicOriginal call thematic#load('#original') -"command! -nargs=1 MyCommand call s:MyFunc() +command -nargs=0 ThematicFirst call thematic#init('#first') +command -nargs=0 ThematicNext call thematic#init('#next') +command -nargs=0 ThematicPrevious call thematic#init('#previous') +command -nargs=0 ThematicRandom call thematic#init('#random') +command -nargs=0 ThematicOriginal call thematic#init('#original') +command -nargs=1 Thematic call thematic#init() " Plugin mappings