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

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")
finish
endif
@@ -14,24 +20,43 @@ command! -narg=0 ZoomIn :call s:ZoomIn()
command! -narg=0 ZoomOut :call s:ZoomOut()
command! -narg=0 ZoomReset :call s:ZoomReset()
" map
nmap + :ZoomIn<CR>
nmap - :ZoomOut<CR>
" map. I like keypad mappings
nmap <kPlus> :ZoomIn<CR>
nmap <kMinus> :ZoomOut<CR>
nmap <kDivide> :ZoomReset<CR>
nmap <C-ScrollWheelUp> :ZoomIn<CR>
nmap <C-ScrollWheelDown> :ZoomOut<CR>
" guifont size + 1
function! s:ZoomIn()
let l:fsize = substitute(&guifont, '^.*:h\([^:]*\).*$', '\1', '')
let l:fsize += 1
let l:guifont = substitute(&guifont, ':h\([^:]*\)', ':h' . l:fsize, '')
let &guifont = l:guifont
" Let's check, what system we are dealing with
if has("win32")
let l:fsize = substitute(&guifont, '^.*:h\([^:]*\).*$', '\1', '')
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
" guifont size - 1
function! s:ZoomOut()
let l:fsize = substitute(&guifont, '^.*:h\([^:]*\).*$', '\1', '')
let l:fsize -= 1
let l:guifont = substitute(&guifont, ':h\([^:]*\)', ':h' . l:fsize, '')
let &guifont = l:guifont
" Same as above
if has("win32")
let l:fsize = substitute(&guifont, '^.*:h\([^:]*\).*$', '\1', '')
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
" reset guifont size
@@ -43,7 +68,7 @@ let &cpo = s:save_cpo
finish
==============================================================================
zoom.vim : control gui font size with "+" or "-" keys.
zoom.vim : control gui font size with "+" or "-" keypad keys.
------------------------------------------------------------------------------
$VIMRUNTIMEPATH/plugin/zoom.vim
==============================================================================
@@ -53,21 +78,23 @@ email : mail@nanasi.jp
version : 2008/07/18 10:00:00
==============================================================================
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.
Normal Mode:
+ ... change font size bigger
- ... change font size smaller
Keypad + ... incerase font size
Ctrl-MouseWheelUp
Keypad - ... decrease font size
Ctrl-MouseWheelDown
Keypad / ... reset font size to initial state
Command-line Mode:
:ZoomIn ... change font size bigger
:ZoomOut ... change font size smaller
:ZoomReset ... reset font size changes.
:ZoomIn ... incerase font size
:ZoomOut ... decrease font size
:ZoomReset ... reset font size to initial state
==============================================================================
@@ -75,6 +102,7 @@ Command-line Mode:
$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.