From 87bbf6c6ae9e68395432de5ff86d1cd3a7aaf3af Mon Sep 17 00:00:00 2001 From: Reed Esau Date: Tue, 24 Dec 2013 22:59:30 -0700 Subject: [PATCH] ongoing --- README.markdown | 54 +++++++++++++++++------------------ autoload/thematic.vim | 62 ++++++++++++++++++++-------------------- doc/thematic.txt | 66 +++++++++++++++++++++---------------------- plugin/thematic.vim | 30 ++++++++++---------- 4 files changed, 106 insertions(+), 106 deletions(-) diff --git a/README.markdown b/README.markdown index 951b1b5..108386a 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,4 @@ -# `themata.vim` +# `thematic.vim` _Manage the look and feel of your Vim text editor_ @@ -8,7 +8,7 @@ _Manage the look and feel of your Vim text editor_ * Support for font and fullscreen settings in GUI-based Vim * Integrates with [airline][https://github.com/bling/vim-airline], another `themeable` plugin -## Why `themata`? +## 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. @@ -18,7 +18,7 @@ Writing code, you may want a status bar, ruler, transparency and a programming f 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 environment in Vim has traditionally been a hassle. The `themata` plugin is intended to provide the Vim user more 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. ## What theme properties can I set? @@ -34,7 +34,7 @@ For console or GUI Vim: * `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 `themata` makes changes_ +* `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_ @@ -42,25 +42,25 @@ For GUI-based Vim only: * `columns` and `lines` - _manage the width of margins in `fullscreen` mode_ * `transparency` (0-100) - _view details of window and desktop beneath Vim_ -* Check `:help themata` for details. +* Check `:help thematic` for details. ## Basic Usage -* Run `:ThemataFirst` to invoke `themata` and choose the first theme. Your themes will be ordered alphabetically. +* Run `:ThematicFirst` to invoke `thematic` and choose the first theme. Your themes will be ordered alphabetically. ```vim - :ThemataFirst " select the first theme - :ThemataNext " select the next theme - :ThemataPrevious " select the previous theme - :ThemataRandom " select a random theme - :ThemataOriginal " revert to the original theme + :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 ``` -`themata` does not map any keys by default, but you can easily do so in your `.vimrc` file, like this: +`thematic` does not map any keys by default, but you can easily do so in your `.vimrc` file, like this: ```vim - nmap t ThemataNext - nmap T ThemataPrevious + 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. @@ -68,7 +68,7 @@ For GUI-based Vim only: 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:themata#themes = { + let g:thematic#themes = { \ 'bubblegum' : { 'typeface': 'CosmicSansNeueMono', \ 'sign-column-color-fix': 1, \ 'transparency': 10, @@ -112,12 +112,12 @@ A few of Vim's standard `colorschemes` are configured as default themes, but you \ } ``` -If you don't specify a `colorscheme`, `themata` will assume it matches your theme name. +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:themata#defaults = { + let g:thematic#defaults = { \ 'airline-theme': 'jellybeans', \ 'fullscreen-background-color-fix': 1, \ 'laststatus': 2, @@ -128,7 +128,7 @@ You can also specify a dictionary of default values, to be shared by all of your Note that an explicit setting in a theme will always override these defaults. -Note also that `themata` stays out of your way, ignoring any settings that you aren't explicitly setting through your `themata` configuration.* For example, you can `set guifont=` in your .gvimrc independent of your `themata` configuration. +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 @@ -145,24 +145,24 @@ Install using Pathogen, Vundle, Neobundle, or your favorite Vim package manager. ## GUI fullscreen capabilities -`themata` supports fullscreen capabilities in a GUI-based Vim, including typeface, font-size, lines, columns, linespace, transparency and even the fullscreen background. +`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, `themata` will override your fullscreen settings, specifically `fuoptions` to get better control over lines and columns and 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 ThemataNarrow - nmap ThemataWiden + nmap ThematicNarrow + nmap ThematicWiden ``` ## FAQ ### Q: I want to set `cursorline`, `wrap`, `foldcolumn`, `list`, `number`, `relativenumber`, `textwidth`, etc. in my themes. -`themata` 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 existing `FileType` facility in Vim. In addition, settings like `textwidth` will modify your documents. This plugin strenuously avoids doing anything to change your documents. @@ -194,7 +194,7 @@ Then a cursor line and line numbering will be present whenever you edit a python ### 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 `themata`, enter the following in OSX Terminal: +To have the fullscreen background's color set by `thematic`, enter the following in OSX Terminal: ``` $ defaults write org.vim.MacVim MMNativeFullScreen 0 @@ -259,7 +259,7 @@ It works best in GUI Vim's fullscreen. Several steps are involved: (4) Finally, add a theme configured to your tastes. Here's an example: ``` - let g:themata#themes = { + let g:thematic#themes = { \ 'mark_lite' :{ 'colorscheme': 'solarized', \ 'background': 'light', \ 'columns': 75, @@ -284,7 +284,7 @@ Console-based emulation is trickier, as there's no easy way to create generous l 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:themata#themes = { + let g:thematic#themes = { \ 'YOURTHEME' :{ 'fold-column-color-mute': 1, ... \ }, @@ -307,7 +307,7 @@ You can refresh via `:redraw!` As an alternative to key command you can force fullscreen in a theme with: ``` - let g:themata#themes = { + let g:thematic#themes = { \ 'bubblegum' : { 'fullscreen': 1, \ ... \ }, diff --git a/autoload/thematic.vim b/autoload/thematic.vim index 61d504c..2325eb7 100644 --- a/autoload/thematic.vim +++ b/autoload/thematic.vim @@ -1,11 +1,11 @@ -" Autoload portion of plugin/themata.vim. +" Autoload portion of plugin/thematic.vim. " " Credit for some font regex/functions: https://github.com/drmikehenry/vim-fontsize -if exists("autoloaded_themata") +if exists("autoloaded_thematic") finish endif -let autoloaded_themata = 1 +let autoloaded_thematic = 1 " # FONT REGEXES {{{1 " Regex values for each platform split guifont into three @@ -38,8 +38,8 @@ endif " # FUNCTIONS {{{1 " # Function: s:encodeFont {{{2 function! s:encodeFont(font) - if has("iconv") && exists("g:themata#encoding") - let encodedFont = iconv(a:font, &enc, g:themata#encoding) + if has("iconv") && exists("g:thematic#encoding") + let encodedFont = iconv(a:font, &enc, g:thematic#encoding) else let encodedFont = a:font endif @@ -48,8 +48,8 @@ endfunction " }}}2 " # Function: s:decodeFont {{{2 function! s:decodeFont(font) - if has("iconv") && exists("g:themata#encoding") - let decodedFont = iconv(a:font, g:themata#encoding, &enc) + if has("iconv") && exists("g:thematic#encoding") + let decodedFont = iconv(a:font, g:thematic#encoding, &enc) else let decodedFont = a:font endif @@ -81,7 +81,7 @@ endfunction " }}}2 " # Function: s:getThemeName {{{2 function! s:getThemeName(mode) - let l:avail_names = sort(keys(g:themata#themes)) + let l:avail_names = sort(keys(g:thematic#themes)) let l:avail_count = len(l:avail_names) let l:new_n = -1 if a:mode == '#first' @@ -93,7 +93,7 @@ function! s:getThemeName(mode) \ str2nr(matchstr(reltimestr(reltime()), '\v\.@<=\d+')[1:]) \ % l:avail_count elseif a:mode == '#next' || a:mode == '#previous' - let l:current_n = index(l:avail_names, g:themata#theme_name) + let l:current_n = index(l:avail_names, g:thematic#theme_name) if a:mode == '#next' if l:current_n == -1 || l:current_n == l:avail_count - 1 let l:new_n = 0 @@ -120,10 +120,10 @@ 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) - if has_key(g:themata#defaults, a:key_name) - let l:fallback_value = get(g:themata#defaults, a:key_name) - elseif has_key(g:themata#original, a:key_name) - let l:fallback_value = get(g:themata#original, a:key_name) + 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) + let l:fallback_value = get(g:thematic#original, a:key_name) else let l:fallback_value = a:ultimate_fallback_value endif @@ -149,8 +149,8 @@ function! s:airline(th) "https://github.com/bling/vim-airline/wiki/Screenshots if exists(':AirlineRefresh') " attempt to preserve original airline theme if not yet set - if !has_key(g:themata#original, 'airline-theme') && exists('g:airline_theme') - let g:themata#original['airline-theme'] = g:airline_theme + if !has_key(g:thematic#original, 'airline-theme') && exists('g:airline_theme') + let g:thematic#original['airline-theme'] = g:airline_theme endif let l:al = s:getThemeValue(a:th, 'airline-theme', '') @@ -229,16 +229,16 @@ endfunction " # Function: s:guiFont {{{2 function! s:guiFont(th) " attempt to preserve original font if not yet set - if !has_key(g:themata#original, 'typeface') + if !has_key(g:thematic#original, 'typeface') let l:typeface = s:getTypeface(&guifont, '') if l:typeface != '' - let g:themata#original['typeface'] = l:typeface + let g:thematic#original['typeface'] = l:typeface endif endif - if !has_key(g:themata#original, 'font-size') + if !has_key(g:thematic#original, 'font-size') let l:size = s:getSize(&guifont, 0) if l:size != 0 - let g:themata#original['font-size'] = l:size + let g:thematic#original['font-size'] = l:size endif endif @@ -320,27 +320,27 @@ function! s:setColumnsAndLines(th) endfunction " }}}2 " # Function: load {{{2 -function! themata#load(mode) - if len(g:themata#themes) == 0 +function! thematic#load(mode) + if len(g:thematic#themes) == 0 echohl WarningMsg | echo 'No themes found.' | echohl NONE finish endif " attempt to preserve original colorscheme and its background - if !has_key(g:themata#original, 'colorscheme') && exists('g:colors_name') - let g:themata#original.colorscheme = g:colors_name - let g:themata#original.background = &background + if !has_key(g:thematic#original, 'colorscheme') && exists('g:colors_name') + let g:thematic#original.colorscheme = g:colors_name + let g:thematic#original.background = &background endif " Resolve theme_name from mode, where mode can be #first, #last, #next, - " #previous, #random, a colorscheme, a key in g:themata#themes, or the + " #previous, #random, a colorscheme, a key in g:thematic#themes, or the " user's original settings. if a:mode == '#original' let l:theme_name = '' - let l:th = g:themata#original + let l:th = g:thematic#original else let l:theme_name = s:getThemeName(a:mode) - let l:th = get(g:themata#themes, l:theme_name, {}) + let l:th = get(g:thematic#themes, l:theme_name, {}) endif " ------ Set colorscheme and background ------ {{{3 @@ -351,8 +351,8 @@ function! themata#load(mode) execute 'colorscheme ' . l:cs catch /E185:/ " no colorscheme matching the theme name, so fall back to original, if any - if has_key(g:themata#original, 'colorscheme') - let l:cs = g:themata#original.colorscheme + if has_key(g:thematic#original, 'colorscheme') + let l:cs = g:thematic#original.colorscheme execute 'colorscheme ' . l:cs endif endtry @@ -441,7 +441,7 @@ function! themata#load(mode) " }}}3 - let g:themata#theme_name = l:theme_name + let g:thematic#theme_name = l:theme_name if s:getThemeValue(l:th, 'force-redraw', 0) redraw! @@ -449,7 +449,7 @@ function! themata#load(mode) endfunction " }}}2 " # Function: adjustColumns {{{2 -function! themata#adjustColumns(delta) +function! thematic#adjustColumns(delta) let l:nu_cols = &columns + a:delta silent execute "set columns=" . l:nu_cols endfunction diff --git a/doc/thematic.txt b/doc/thematic.txt index 6e754ec..4d0e0d1 100644 --- a/doc/thematic.txt +++ b/doc/thematic.txt @@ -1,41 +1,41 @@ -*themata.txt* Theme manager for VIM +*thematic.txt* Theme manager for VIM Author: Reed Esau License: Same terms as Vim itself (see |license|) This plugin is only available if 'compatible' is not set. -INTRODUCTION *themata* *:themata* +INTRODUCTION *thematic* *:thematic* -themata lets you quickly find, substitute, and abbreviate several variations +thematic lets you quickly find, substitute, and abbreviate several variations of a word at once. By default, three case variants (foo, Foo, and FOO) are operated on by every command. -Two commands are provided. :themata is the most general interface. +Two commands are provided. :thematic is the most general interface. :Subvert provides an alternative, more concise syntax for searching and substituting. > - :themata [options] {abbreviation} {replacement} - :themata -delete [options] {abbreviation} + :thematic [options] {abbreviation} {replacement} + :thematic -delete [options] {abbreviation} - :themata -search [options] {pattern} + :thematic -search [options] {pattern} :Subvert/{pattern}[/flags] - :themata!-search [options] {pattern} + :thematic!-search [options] {pattern} :Subvert?{pattern}[?flags] - :themata -search [options] {pattern} {grep-arguments} + :thematic -search [options] {pattern} {grep-arguments} :Subvert /{pattern}/[flags] {grep-options} - :themata!-search [options] {pattern} {grep-arguments} + :thematic!-search [options] {pattern} {grep-arguments} :Subvert!/{pattern}/[flags] {grep-options} - :[range]themata -substitute [options] {pattern} {replacement} + :[range]thematic -substitute [options] {pattern} {replacement} :[range]Subvert/{pattern}/{replacement}[/flags] < *:S* In addition to the :Subvert command, a :S synonym is provided if not already defined. This will be used in examples below. -PATTERNS *themata-patterns* +PATTERNS *thematic-patterns* Patterns can include brace pairs that contain comma separated alternatives: @@ -51,34 +51,34 @@ The following replaces several different misspellings of "necessary": > :%S/{,un}nec{ce,ces,e}sar{y,ily}/{}nec{es}sar{}/g < -ABBREVIATING *themata-abbrev* +ABBREVIATING *thematic-abbrev* -By default :themata creates abbreviations, which replace words automatically +By default :thematic creates abbreviations, which replace words automatically as you type. This is good for words you frequently misspell, or as shortcuts for longer words. Since these are just Vim abbreviations, only whole words will match. > - :themata anomol{y,ies} anomal{} - :themata {,in}consistant{,ly} {}consistent{} - :themata Tqbf The quick, brown fox jumps over the lazy dog + :thematic anomol{y,ies} anomal{} + :thematic {,in}consistant{,ly} {}consistent{} + :thematic Tqbf The quick, brown fox jumps over the lazy dog < Accepts the following options: -buffer: buffer local -cmdline: work in command line in addition to insert mode -A good place to define abbreviations is "after/plugin/themata.vim", +A good place to define abbreviations is "after/plugin/thematic.vim", relative to ~\vimfiles on Windows and ~/.vim everywhere else. -With a bang (:themata!) the abbreviation is also appended to the file in -g:themata_save_file. The default is "after/plugin/themata.vim", relative +With a bang (:thematic!) the abbreviation is also appended to the file in +g:thematic_save_file. The default is "after/plugin/thematic.vim", relative to the install directory. -Abbreviations can be removed with :themata -delete: +Abbreviations can be removed with :thematic -delete: > - themata -delete -buffer -cmdline anomol{y,ies} + thematic -delete -buffer -cmdline anomol{y,ies} < -SEARCHING *themata-search* +SEARCHING *thematic-search* The -search command does a search in a manner similar to / key. search. After searching, you can use |n| and |N| as you would with a normal @@ -86,7 +86,7 @@ search. The following will search for box, Box, and BOX: > - :themata -search box + :thematic -search box < When given a single word to operate on, :Subvert defaults to doing a search as well: @@ -100,10 +100,10 @@ BOX, BOXES, BOXED, and BOXING: < The following syntaxes search in reverse. > - :themata! -search box + :thematic! -search box :S?box? < -Flags can be given with the -flags= option to :themata, or by appending them +Flags can be given with the -flags= option to :thematic, or by appending them after the separator to :Subvert. The flags trigger the following behaviors: I: Disable case variations (box, Box, BOX) @@ -112,15 +112,15 @@ after the separator to :Subvert. The flags trigger the following behaviors: A |search-offset| may follow the flags. > - :themata -search -flags=avs+1 box + :thematic -search -flags=avs+1 box :S?box{,es,ed,ing}?we < -GREPPING *themata-grep* +GREPPING *thematic-grep* Grepping works similar to searching, and is invoked when additional options are given. These options are passed directly to the :grep command. > - :themata -search box{,es} + :thematic -search box{,es} :S /box{,es}/ * :S /box/aw *.txt *.html < @@ -131,21 +131,21 @@ Both an external grepprg and vimgrep (via grepprg=internal) are supported. With an external grep, the "v" flag behaves less intelligently, due to the lack of look ahead and look behind support in grep regexps. -SUBSTITUTING *themata-substitute* +SUBSTITUTING *thematic-substitute* Giving a range switches :Subvert into substitute mode. This command will change box -> bag, boxes -> bags, Box -> Bag, Boxes -> Bags, BOX -> BAG, BOXES -> BAGS across the entire document: > - :%themata -substitute -flags=g box{,es} bag{,s} + :%thematic -substitute -flags=g box{,es} bag{,s} :%S/box{,es}/bag{,s}/g < The "c", "e", "g", and "n" flags can be used from the substitute command |:s_flags|, along with the "a", "I", "v", and "w" flags from searching. -COERCION *themata-coercion* *cr* +COERCION *thematic-coercion* *cr* -themata's case mutating algorithms can be applied to the word under the cursor +thematic's case mutating algorithms can be applied to the word under the cursor using the cr mapping (mnemonic: CoeRce) followed by one of the following characters: diff --git a/plugin/thematic.vim b/plugin/thematic.vim index 3f1ad0f..523a9ef 100644 --- a/plugin/thematic.vim +++ b/plugin/thematic.vim @@ -85,29 +85,29 @@ endif " Commands {{{ -command -nargs=0 ThemataNarrow call themata#adjustColumns(-5) -command -nargs=0 ThemataWiden call themata#adjustColumns(5) +command -nargs=0 ThematicNarrow call themata#adjustColumns(-5) +command -nargs=0 ThematicWiden call themata#adjustColumns(5) -command -nargs=0 ThemataFirst call themata#load('#first') -command -nargs=0 ThemataNext call themata#load('#next') -command -nargs=0 ThemataPrevious call themata#load('#previous') -command -nargs=0 ThemataRandom call themata#load('#random') -command -nargs=0 ThemataOriginal call themata#load('#original') +command -nargs=0 ThematicFirst call themata#load('#first') +command -nargs=0 ThematicNext call themata#load('#next') +command -nargs=0 ThematicPrevious call themata#load('#previous') +command -nargs=0 ThematicRandom call themata#load('#random') +command -nargs=0 ThematicOriginal call themata#load('#original') "command! -nargs=1 MyCommand call s:MyFunc() " }}} " Plugin mappings {{{ -noremap ThemataNarrow :ThemataNarrow -noremap ThemataWiden :ThemataWiden +noremap ThematicNarrow :ThematicNarrow +noremap ThematicWiden :ThematicWiden -" Create mappings for the `Themata` commands -noremap ThemataFirst :ThemataFirst -noremap ThemataNext :ThemataNext -noremap ThemataPrevious :ThemataPrevious -noremap ThemataRandom :ThemataRandom -noremap ThemataOriginal :ThemataOriginal +" Create mappings for the `Thematic` commands +noremap ThematicFirst :ThematicFirst +noremap ThematicNext :ThematicNext +noremap ThematicPrevious :ThematicPrevious +noremap ThematicRandom :ThematicRandom +noremap ThematicOriginal :ThematicOriginal " }}}