mirror of
https://github.com/preservim/vim-thematic.git
synced 2025-11-15 05:13:49 -05:00
ongoing
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# `themata.vim`
|
# `thematic.vim`
|
||||||
|
|
||||||
_Manage the look and feel of your Vim text editor_
|
_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
|
* Support for font and fullscreen settings in GUI-based Vim
|
||||||
* Integrates with [airline][https://github.com/bling/vim-airline], another `themeable` plugin
|
* 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.
|
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`.
|
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?
|
## 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_
|
* `sign-column-color-fix` - _temporarily modifies colorscheme to force gutter background_
|
||||||
* `diff-color-fix` - _temporarily modifies colorscheme to force diff character color_
|
* `diff-color-fix` - _temporarily modifies colorscheme to force diff character color_
|
||||||
* `fold-column-color-mute` - _temporarily modifies colorscheme to hide indicators in foldcolumn_
|
* `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:
|
For GUI-based Vim only:
|
||||||
* `typeface`, `font-size`, and `linespace` - _be specific about typography_
|
* `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_
|
* `columns` and `lines` - _manage the width of margins in `fullscreen` mode_
|
||||||
* `transparency` (0-100) - _view details of window and desktop beneath Vim_
|
* `transparency` (0-100) - _view details of window and desktop beneath Vim_
|
||||||
|
|
||||||
* Check `:help themata` for details.
|
* Check `:help thematic` for details.
|
||||||
|
|
||||||
## Basic Usage
|
## 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
|
```vim
|
||||||
:ThemataFirst " select the first theme
|
:ThematicFirst " select the first theme
|
||||||
:ThemataNext " select the next theme
|
:ThematicNext " select the next theme
|
||||||
:ThemataPrevious " select the previous theme
|
:ThematicPrevious " select the previous theme
|
||||||
:ThemataRandom " select a random theme
|
:ThematicRandom " select a random theme
|
||||||
:ThemataOriginal " revert to the original 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
|
```vim
|
||||||
nmap <Leader>t <Plug>ThemataNext
|
nmap <Leader>t <Plug>ThematicNext
|
||||||
nmap <Leader>T <Plug>ThemataPrevious
|
nmap <Leader>T <Plug>ThematicPrevious
|
||||||
```
|
```
|
||||||
|
|
||||||
...where with the default leader key of `\`, `\t` would select the next theme in your list, as ordered alphabetically.
|
...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:
|
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',
|
\ 'bubblegum' : { 'typeface': 'CosmicSansNeueMono',
|
||||||
\ 'sign-column-color-fix': 1,
|
\ 'sign-column-color-fix': 1,
|
||||||
\ 'transparency': 10,
|
\ '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.
|
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',
|
\ 'airline-theme': 'jellybeans',
|
||||||
\ 'fullscreen-background-color-fix': 1,
|
\ 'fullscreen-background-color-fix': 1,
|
||||||
\ 'laststatus': 2,
|
\ '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 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
|
* * 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
|
## 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
|
## Column sizing
|
||||||
|
|
||||||
You may wish to adjust the columns while in full screen. Map to Command-9 and Command-0 in your `.vimrc` with:
|
You may wish to adjust the columns while in full screen. Map to Command-9 and Command-0 in your `.vimrc` with:
|
||||||
|
|
||||||
```
|
```
|
||||||
nmap <silent> <D-9> <Plug>ThemataNarrow
|
nmap <silent> <D-9> <Plug>ThematicNarrow
|
||||||
nmap <silent> <D-0> <Plug>ThemataWiden
|
nmap <silent> <D-0> <Plug>ThematicWiden
|
||||||
```
|
```
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
### Q: I want to set `cursorline`, `wrap`, `foldcolumn`, `list`, `number`, `relativenumber`, `textwidth`, etc. in my themes.
|
### 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.
|
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?
|
### 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
|
$ 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:
|
(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',
|
\ 'mark_lite' :{ 'colorscheme': 'solarized',
|
||||||
\ 'background': 'light',
|
\ 'background': 'light',
|
||||||
\ 'columns': 75,
|
\ '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.
|
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,
|
\ '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:
|
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,
|
\ 'bubblegum' : { 'fullscreen': 1,
|
||||||
\ ...
|
\ ...
|
||||||
\ },
|
\ },
|
||||||
|
|||||||
@@ -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
|
" Credit for some font regex/functions: https://github.com/drmikehenry/vim-fontsize
|
||||||
|
|
||||||
if exists("autoloaded_themata")
|
if exists("autoloaded_thematic")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let autoloaded_themata = 1
|
let autoloaded_thematic = 1
|
||||||
|
|
||||||
" # FONT REGEXES {{{1
|
" # FONT REGEXES {{{1
|
||||||
" Regex values for each platform split guifont into three
|
" Regex values for each platform split guifont into three
|
||||||
@@ -38,8 +38,8 @@ endif
|
|||||||
" # FUNCTIONS {{{1
|
" # FUNCTIONS {{{1
|
||||||
" # Function: s:encodeFont {{{2
|
" # Function: s:encodeFont {{{2
|
||||||
function! s:encodeFont(font)
|
function! s:encodeFont(font)
|
||||||
if has("iconv") && exists("g:themata#encoding")
|
if has("iconv") && exists("g:thematic#encoding")
|
||||||
let encodedFont = iconv(a:font, &enc, g:themata#encoding)
|
let encodedFont = iconv(a:font, &enc, g:thematic#encoding)
|
||||||
else
|
else
|
||||||
let encodedFont = a:font
|
let encodedFont = a:font
|
||||||
endif
|
endif
|
||||||
@@ -48,8 +48,8 @@ endfunction
|
|||||||
" }}}2
|
" }}}2
|
||||||
" # Function: s:decodeFont {{{2
|
" # Function: s:decodeFont {{{2
|
||||||
function! s:decodeFont(font)
|
function! s:decodeFont(font)
|
||||||
if has("iconv") && exists("g:themata#encoding")
|
if has("iconv") && exists("g:thematic#encoding")
|
||||||
let decodedFont = iconv(a:font, g:themata#encoding, &enc)
|
let decodedFont = iconv(a:font, g:thematic#encoding, &enc)
|
||||||
else
|
else
|
||||||
let decodedFont = a:font
|
let decodedFont = a:font
|
||||||
endif
|
endif
|
||||||
@@ -81,7 +81,7 @@ endfunction
|
|||||||
" }}}2
|
" }}}2
|
||||||
" # Function: s:getThemeName {{{2
|
" # Function: s:getThemeName {{{2
|
||||||
function! s:getThemeName(mode)
|
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:avail_count = len(l:avail_names)
|
||||||
let l:new_n = -1
|
let l:new_n = -1
|
||||||
if a:mode == '#first'
|
if a:mode == '#first'
|
||||||
@@ -93,7 +93,7 @@ function! s:getThemeName(mode)
|
|||||||
\ str2nr(matchstr(reltimestr(reltime()), '\v\.@<=\d+')[1:])
|
\ str2nr(matchstr(reltimestr(reltime()), '\v\.@<=\d+')[1:])
|
||||||
\ % l:avail_count
|
\ % l:avail_count
|
||||||
elseif a:mode == '#next' || a:mode == '#previous'
|
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 a:mode == '#next'
|
||||||
if l:current_n == -1 || l:current_n == l:avail_count - 1
|
if l:current_n == -1 || l:current_n == l:avail_count - 1
|
||||||
let l:new_n = 0
|
let l:new_n = 0
|
||||||
@@ -120,10 +120,10 @@ endfunction
|
|||||||
" Obtain value for theme property, falling back to either user-specified
|
" Obtain value for theme property, falling back to either user-specified
|
||||||
" defaults or the original value.
|
" defaults or the original value.
|
||||||
function! s:getThemeValue(th, key_name, ultimate_fallback_value)
|
function! s:getThemeValue(th, key_name, ultimate_fallback_value)
|
||||||
if has_key(g:themata#defaults, a:key_name)
|
if has_key(g:thematic#defaults, a:key_name)
|
||||||
let l:fallback_value = get(g:themata#defaults, a:key_name)
|
let l:fallback_value = get(g:thematic#defaults, a:key_name)
|
||||||
elseif has_key(g:themata#original, a:key_name)
|
elseif has_key(g:thematic#original, a:key_name)
|
||||||
let l:fallback_value = get(g:themata#original, a:key_name)
|
let l:fallback_value = get(g:thematic#original, a:key_name)
|
||||||
else
|
else
|
||||||
let l:fallback_value = a:ultimate_fallback_value
|
let l:fallback_value = a:ultimate_fallback_value
|
||||||
endif
|
endif
|
||||||
@@ -149,8 +149,8 @@ function! s:airline(th)
|
|||||||
"https://github.com/bling/vim-airline/wiki/Screenshots
|
"https://github.com/bling/vim-airline/wiki/Screenshots
|
||||||
if exists(':AirlineRefresh')
|
if exists(':AirlineRefresh')
|
||||||
" attempt to preserve original airline theme if not yet set
|
" attempt to preserve original airline theme if not yet set
|
||||||
if !has_key(g:themata#original, 'airline-theme') && exists('g:airline_theme')
|
if !has_key(g:thematic#original, 'airline-theme') && exists('g:airline_theme')
|
||||||
let g:themata#original['airline-theme'] = g:airline_theme
|
let g:thematic#original['airline-theme'] = g:airline_theme
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:al = s:getThemeValue(a:th, 'airline-theme', '')
|
let l:al = s:getThemeValue(a:th, 'airline-theme', '')
|
||||||
@@ -229,16 +229,16 @@ endfunction
|
|||||||
" # Function: s:guiFont {{{2
|
" # Function: s:guiFont {{{2
|
||||||
function! s:guiFont(th)
|
function! s:guiFont(th)
|
||||||
" attempt to preserve original font if not yet set
|
" 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, '')
|
let l:typeface = s:getTypeface(&guifont, '')
|
||||||
if l:typeface != ''
|
if l:typeface != ''
|
||||||
let g:themata#original['typeface'] = l:typeface
|
let g:thematic#original['typeface'] = l:typeface
|
||||||
endif
|
endif
|
||||||
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)
|
let l:size = s:getSize(&guifont, 0)
|
||||||
if l:size != 0
|
if l:size != 0
|
||||||
let g:themata#original['font-size'] = l:size
|
let g:thematic#original['font-size'] = l:size
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -320,27 +320,27 @@ function! s:setColumnsAndLines(th)
|
|||||||
endfunction
|
endfunction
|
||||||
" }}}2
|
" }}}2
|
||||||
" # Function: load {{{2
|
" # Function: load {{{2
|
||||||
function! themata#load(mode)
|
function! thematic#load(mode)
|
||||||
if len(g:themata#themes) == 0
|
if len(g:thematic#themes) == 0
|
||||||
echohl WarningMsg | echo 'No themes found.' | echohl NONE
|
echohl WarningMsg | echo 'No themes found.' | echohl NONE
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" attempt to preserve original colorscheme and its background
|
" attempt to preserve original colorscheme and its background
|
||||||
if !has_key(g:themata#original, 'colorscheme') && exists('g:colors_name')
|
if !has_key(g:thematic#original, 'colorscheme') && exists('g:colors_name')
|
||||||
let g:themata#original.colorscheme = g:colors_name
|
let g:thematic#original.colorscheme = g:colors_name
|
||||||
let g:themata#original.background = &background
|
let g:thematic#original.background = &background
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Resolve theme_name from mode, where mode can be #first, #last, #next,
|
" 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.
|
" user's original settings.
|
||||||
if a:mode == '#original'
|
if a:mode == '#original'
|
||||||
let l:theme_name = ''
|
let l:theme_name = ''
|
||||||
let l:th = g:themata#original
|
let l:th = g:thematic#original
|
||||||
else
|
else
|
||||||
let l:theme_name = s:getThemeName(a:mode)
|
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
|
endif
|
||||||
|
|
||||||
" ------ Set colorscheme and background ------ {{{3
|
" ------ Set colorscheme and background ------ {{{3
|
||||||
@@ -351,8 +351,8 @@ function! themata#load(mode)
|
|||||||
execute 'colorscheme ' . l:cs
|
execute 'colorscheme ' . l:cs
|
||||||
catch /E185:/
|
catch /E185:/
|
||||||
" no colorscheme matching the theme name, so fall back to original, if any
|
" no colorscheme matching the theme name, so fall back to original, if any
|
||||||
if has_key(g:themata#original, 'colorscheme')
|
if has_key(g:thematic#original, 'colorscheme')
|
||||||
let l:cs = g:themata#original.colorscheme
|
let l:cs = g:thematic#original.colorscheme
|
||||||
execute 'colorscheme ' . l:cs
|
execute 'colorscheme ' . l:cs
|
||||||
endif
|
endif
|
||||||
endtry
|
endtry
|
||||||
@@ -441,7 +441,7 @@ function! themata#load(mode)
|
|||||||
|
|
||||||
" }}}3
|
" }}}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)
|
if s:getThemeValue(l:th, 'force-redraw', 0)
|
||||||
redraw!
|
redraw!
|
||||||
@@ -449,7 +449,7 @@ function! themata#load(mode)
|
|||||||
endfunction
|
endfunction
|
||||||
" }}}2
|
" }}}2
|
||||||
" # Function: adjustColumns {{{2
|
" # Function: adjustColumns {{{2
|
||||||
function! themata#adjustColumns(delta)
|
function! thematic#adjustColumns(delta)
|
||||||
let l:nu_cols = &columns + a:delta
|
let l:nu_cols = &columns + a:delta
|
||||||
silent execute "set columns=" . l:nu_cols
|
silent execute "set columns=" . l:nu_cols
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
*themata.txt* Theme manager for VIM
|
*thematic.txt* Theme manager for VIM
|
||||||
|
|
||||||
Author: Reed Esau <http://esau.org/>
|
Author: Reed Esau <http://esau.org/>
|
||||||
License: Same terms as Vim itself (see |license|)
|
License: Same terms as Vim itself (see |license|)
|
||||||
|
|
||||||
This plugin is only available if 'compatible' is not set.
|
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
|
of a word at once. By default, three case variants (foo, Foo, and FOO) are
|
||||||
operated on by every command.
|
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
|
:Subvert provides an alternative, more concise syntax for searching and
|
||||||
substituting.
|
substituting.
|
||||||
>
|
>
|
||||||
:themata [options] {abbreviation} {replacement}
|
:thematic [options] {abbreviation} {replacement}
|
||||||
:themata -delete [options] {abbreviation}
|
:thematic -delete [options] {abbreviation}
|
||||||
|
|
||||||
:themata -search [options] {pattern}
|
:thematic -search [options] {pattern}
|
||||||
:Subvert/{pattern}[/flags]
|
:Subvert/{pattern}[/flags]
|
||||||
:themata!-search [options] {pattern}
|
:thematic!-search [options] {pattern}
|
||||||
:Subvert?{pattern}[?flags]
|
:Subvert?{pattern}[?flags]
|
||||||
|
|
||||||
:themata -search [options] {pattern} {grep-arguments}
|
:thematic -search [options] {pattern} {grep-arguments}
|
||||||
:Subvert /{pattern}/[flags] {grep-options}
|
:Subvert /{pattern}/[flags] {grep-options}
|
||||||
:themata!-search [options] {pattern} {grep-arguments}
|
:thematic!-search [options] {pattern} {grep-arguments}
|
||||||
:Subvert!/{pattern}/[flags] {grep-options}
|
:Subvert!/{pattern}/[flags] {grep-options}
|
||||||
|
|
||||||
:[range]themata -substitute [options] {pattern} {replacement}
|
:[range]thematic -substitute [options] {pattern} {replacement}
|
||||||
:[range]Subvert/{pattern}/{replacement}[/flags]
|
:[range]Subvert/{pattern}/{replacement}[/flags]
|
||||||
<
|
<
|
||||||
*:S*
|
*:S*
|
||||||
In addition to the :Subvert command, a :S synonym is provided if not
|
In addition to the :Subvert command, a :S synonym is provided if not
|
||||||
already defined. This will be used in examples below.
|
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:
|
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
|
:%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
|
as you type. This is good for words you frequently misspell, or as
|
||||||
shortcuts for longer words. Since these are just Vim abbreviations, only
|
shortcuts for longer words. Since these are just Vim abbreviations, only
|
||||||
whole words will match.
|
whole words will match.
|
||||||
>
|
>
|
||||||
:themata anomol{y,ies} anomal{}
|
:thematic anomol{y,ies} anomal{}
|
||||||
:themata {,in}consistant{,ly} {}consistent{}
|
:thematic {,in}consistant{,ly} {}consistent{}
|
||||||
:themata Tqbf The quick, brown fox jumps over the lazy dog
|
:thematic Tqbf The quick, brown fox jumps over the lazy dog
|
||||||
<
|
<
|
||||||
Accepts the following options:
|
Accepts the following options:
|
||||||
|
|
||||||
-buffer: buffer local
|
-buffer: buffer local
|
||||||
-cmdline: work in command line in addition to insert mode
|
-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.
|
relative to ~\vimfiles on Windows and ~/.vim everywhere else.
|
||||||
|
|
||||||
With a bang (:themata!) the abbreviation is also appended to the file in
|
With a bang (:thematic!) the abbreviation is also appended to the file in
|
||||||
g:themata_save_file. The default is "after/plugin/themata.vim", relative
|
g:thematic_save_file. The default is "after/plugin/thematic.vim", relative
|
||||||
to the install directory.
|
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.
|
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
|
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:
|
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
|
When given a single word to operate on, :Subvert defaults to doing a
|
||||||
search as well:
|
search as well:
|
||||||
@@ -100,10 +100,10 @@ BOX, BOXES, BOXED, and BOXING:
|
|||||||
<
|
<
|
||||||
The following syntaxes search in reverse.
|
The following syntaxes search in reverse.
|
||||||
>
|
>
|
||||||
:themata! -search box
|
:thematic! -search box
|
||||||
:S?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:
|
after the separator to :Subvert. The flags trigger the following behaviors:
|
||||||
|
|
||||||
I: Disable case variations (box, Box, BOX)
|
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.
|
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
|
:S?box{,es,ed,ing}?we
|
||||||
<
|
<
|
||||||
GREPPING *themata-grep*
|
GREPPING *thematic-grep*
|
||||||
|
|
||||||
Grepping works similar to searching, and is invoked when additional options
|
Grepping works similar to searching, and is invoked when additional options
|
||||||
are given. These options are passed directly to the :grep command.
|
are given. These options are passed directly to the :grep command.
|
||||||
>
|
>
|
||||||
:themata -search box{,es}
|
:thematic -search box{,es}
|
||||||
:S /box{,es}/ *
|
:S /box{,es}/ *
|
||||||
:S /box/aw *.txt *.html
|
: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
|
With an external grep, the "v" flag behaves less intelligently, due to the
|
||||||
lack of look ahead and look behind support in grep regexps.
|
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
|
Giving a range switches :Subvert into substitute mode. This command will
|
||||||
change box -> bag, boxes -> bags, Box -> Bag, Boxes -> Bags, BOX -> BAG,
|
change box -> bag, boxes -> bags, Box -> Bag, Boxes -> Bags, BOX -> BAG,
|
||||||
BOXES -> BAGS across the entire document:
|
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
|
:%S/box{,es}/bag{,s}/g
|
||||||
<
|
<
|
||||||
The "c", "e", "g", and "n" flags can be used from the substitute command
|
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.
|
|: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
|
using the cr mapping (mnemonic: CoeRce) followed by one of the following
|
||||||
characters:
|
characters:
|
||||||
|
|
||||||
|
|||||||
@@ -85,29 +85,29 @@ endif
|
|||||||
|
|
||||||
" Commands {{{
|
" Commands {{{
|
||||||
|
|
||||||
command -nargs=0 ThemataNarrow call themata#adjustColumns(-5)
|
command -nargs=0 ThematicNarrow call themata#adjustColumns(-5)
|
||||||
command -nargs=0 ThemataWiden call themata#adjustColumns(5)
|
command -nargs=0 ThematicWiden call themata#adjustColumns(5)
|
||||||
|
|
||||||
command -nargs=0 ThemataFirst call themata#load('#first')
|
command -nargs=0 ThematicFirst call themata#load('#first')
|
||||||
command -nargs=0 ThemataNext call themata#load('#next')
|
command -nargs=0 ThematicNext call themata#load('#next')
|
||||||
command -nargs=0 ThemataPrevious call themata#load('#previous')
|
command -nargs=0 ThematicPrevious call themata#load('#previous')
|
||||||
command -nargs=0 ThemataRandom call themata#load('#random')
|
command -nargs=0 ThematicRandom call themata#load('#random')
|
||||||
command -nargs=0 ThemataOriginal call themata#load('#original')
|
command -nargs=0 ThematicOriginal call themata#load('#original')
|
||||||
"command! -nargs=1 MyCommand call s:MyFunc(<f-args>)
|
"command! -nargs=1 MyCommand call s:MyFunc(<f-args>)
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Plugin mappings {{{
|
" Plugin mappings {{{
|
||||||
|
|
||||||
noremap <silent> <Plug>ThemataNarrow :ThemataNarrow<CR>
|
noremap <silent> <Plug>ThematicNarrow :ThematicNarrow<CR>
|
||||||
noremap <silent> <Plug>ThemataWiden :ThemataWiden<CR>
|
noremap <silent> <Plug>ThematicWiden :ThematicWiden<CR>
|
||||||
|
|
||||||
" Create mappings for the `Themata` commands
|
" Create mappings for the `Thematic` commands
|
||||||
noremap <silent> <Plug>ThemataFirst :ThemataFirst<CR>
|
noremap <silent> <Plug>ThematicFirst :ThematicFirst<CR>
|
||||||
noremap <silent> <Plug>ThemataNext :ThemataNext<CR>
|
noremap <silent> <Plug>ThematicNext :ThematicNext<CR>
|
||||||
noremap <silent> <Plug>ThemataPrevious :ThemataPrevious<CR>
|
noremap <silent> <Plug>ThematicPrevious :ThematicPrevious<CR>
|
||||||
noremap <silent> <Plug>ThemataRandom :ThemataRandom<CR>
|
noremap <silent> <Plug>ThematicRandom :ThematicRandom<CR>
|
||||||
noremap <silent> <Plug>ThemataOriginal :ThemataOriginal<CR>
|
noremap <silent> <Plug>ThematicOriginal :ThematicOriginal<CR>
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user