1
0
mirror of https://github.com/gryf/zoom.vim.git synced 2026-02-07 20:15:44 +01:00

Added Linux fonts support

This commit is contained in:
2013-10-29 20:56:17 +01:00
parent 8d91ea7557
commit 69a6175be2
2 changed files with 69 additions and 31 deletions

30
README
View File

@@ -1,19 +1,29 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=2321 This is fork of a mirror of http://www.vim.org/scripts/script.php?script_id=2321
Control Vim editor font size with key "+", or key "-".
Press "+" key, Vim editor gui font size will change bigger.
And, press "-" key, Vim editor gui font size will change smaller.
Control Vim editor font size with keyboard or mouse.
This plugin is for GUI only. This plugin is for GUI only.
Normal Mode: Normal Mode:
+ ... change font size bigger Keypad + ... incerase font size
- ... change font size smaller Ctrl-MouseWheelUp
Keypad - ... decrease font size
Ctrl-MouseWheelDown
Keypad / ... reset font size to initial state
Command-line Mode: Command-line Mode:
:ZoomIn ... change font size bigger :ZoomIn ... incerase font size
:ZoomOut ... change font size smaller :ZoomOut ... decrease font size
:ZoomReset ... reset font size changes. :ZoomReset ... reset font size to initial state
==============================================================================
1. Copy the zoom.vim script to
$HOME/vimfiles/plugin or $HOME/.vim/plugin directory.
Refer to ':help add-plugin', ':help add-global-plugin' and
':help runtimepath' for more details about Vim plugins.
Or just use pathogen (https://github.com/tpope/vim-pathogen)
2. Restart Vim.

View File

@@ -1,3 +1,9 @@
"The guard. Zoom will only work in graphical Vim. For terminal version try to
"find out how to increase/decrease font size in your terminal emulator.
if !has("gui")
finish
endif
if &cp || exists("g:loaded_zoom") if &cp || exists("g:loaded_zoom")
finish finish
endif endif
@@ -14,24 +20,43 @@ command! -narg=0 ZoomIn :call s:ZoomIn()
command! -narg=0 ZoomOut :call s:ZoomOut() command! -narg=0 ZoomOut :call s:ZoomOut()
command! -narg=0 ZoomReset :call s:ZoomReset() command! -narg=0 ZoomReset :call s:ZoomReset()
" map " map. I like keypad mappings
nmap + :ZoomIn<CR> nmap <kPlus> :ZoomIn<CR>
nmap - :ZoomOut<CR> nmap <kMinus> :ZoomOut<CR>
nmap <kDivide> :ZoomReset<CR>
nmap <C-ScrollWheelUp> :ZoomIn<CR>
nmap <C-ScrollWheelDown> :ZoomOut<CR>
" guifont size + 1 " guifont size + 1
function! s:ZoomIn() function! s:ZoomIn()
let l:fsize = substitute(&guifont, '^.*:h\([^:]*\).*$', '\1', '') " Let's check, what system we are dealing with
let l:fsize += 1 if has("win32")
let l:guifont = substitute(&guifont, ':h\([^:]*\)', ':h' . l:fsize, '') let l:fsize = substitute(&guifont, '^.*:h\([^:]*\).*$', '\1', '')
let &guifont = l:guifont let l:fsize += 1
let l:guifont = substitute(&guifont, ':h\([^:]*\)', ':h' . l:fsize, '')
let &guifont = l:guifont
elseif has('unix')
" TODO: Might not work on OS X
let l:font = split(&guifont)
let l:font[-1] = l:font[-1] + 1
let &guifont = join(l:font, " ")
endif
endfunction endfunction
" guifont size - 1 " guifont size - 1
function! s:ZoomOut() function! s:ZoomOut()
let l:fsize = substitute(&guifont, '^.*:h\([^:]*\).*$', '\1', '') " Same as above
let l:fsize -= 1 if has("win32")
let l:guifont = substitute(&guifont, ':h\([^:]*\)', ':h' . l:fsize, '') let l:fsize = substitute(&guifont, '^.*:h\([^:]*\).*$', '\1', '')
let &guifont = l:guifont let l:fsize -= 1
let l:guifont = substitute(&guifont, ':h\([^:]*\)', ':h' . l:fsize, '')
let &guifont = l:guifont
elseif has('unix')
let l:font = split(&guifont)
let l:font[-1] = l:font[-1] - 1
let &guifont = join(l:font, " ")
endif
endfunction endfunction
" reset guifont size " reset guifont size
@@ -43,7 +68,7 @@ let &cpo = s:save_cpo
finish finish
============================================================================== ==============================================================================
zoom.vim : control gui font size with "+" or "-" keys. zoom.vim : control gui font size with "+" or "-" keypad keys.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
$VIMRUNTIMEPATH/plugin/zoom.vim $VIMRUNTIMEPATH/plugin/zoom.vim
============================================================================== ==============================================================================
@@ -53,21 +78,23 @@ email : mail@nanasi.jp
version : 2008/07/18 10:00:00 version : 2008/07/18 10:00:00
============================================================================== ==============================================================================
Control Vim editor font size with key "+", or key "-". Control Vim editor font size with keyboard or mouse.
Press "+" key, Vim editor gui font size will change bigger.
And, press "-" key, Vim editor gui font size will change smaller.
This plugin is for GUI only. This plugin is for GUI only.
Normal Mode: Normal Mode:
+ ... change font size bigger Keypad + ... incerase font size
- ... change font size smaller Ctrl-MouseWheelUp
Keypad - ... decrease font size
Ctrl-MouseWheelDown
Keypad / ... reset font size to initial state
Command-line Mode: Command-line Mode:
:ZoomIn ... change font size bigger :ZoomIn ... incerase font size
:ZoomOut ... change font size smaller :ZoomOut ... decrease font size
:ZoomReset ... reset font size changes. :ZoomReset ... reset font size to initial state
============================================================================== ==============================================================================
@@ -75,6 +102,7 @@ Command-line Mode:
$HOME/vimfiles/plugin or $HOME/.vim/plugin directory. $HOME/vimfiles/plugin or $HOME/.vim/plugin directory.
Refer to ':help add-plugin', ':help add-global-plugin' and Refer to ':help add-plugin', ':help add-global-plugin' and
':help runtimepath' for more details about Vim plugins. ':help runtimepath' for more details about Vim plugins.
Or just use pathogen (https://github.com/tpope/vim-pathogen)
2. Restart Vim. 2. Restart Vim.