Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " change fonts quickly and see the results interactively.
- " To use source this file:
- " :source cycle_fonts.vim
- function! ShowList(lst1)
- let i = 0
- let l:lst2 = []
- while i < 5
- let l:fnt = substitute(a:lst1[i], " ", '\\ ', "")
- let l:fnt = substitute(l:fnt, "=.*", '', "")
- echo a:lst1[i]
- echo l:fnt
- let i += 1
- endwhile
- endfunction
- let g:Idx = -1
- let g:Idx += 1
- echo g:Idx
- let g:Fontsize = 8
- let g:Fonts0 = system('fc-list')
- let g:Fonts1 = split(g:Fonts0,'\n')
- echo len(g:Fonts1)
- call ShowList(g:Fonts1)
- set guifont=Bitstream\ Vera\ Sans\ Mono\ 7
- function! ChangeFont( dir )
- if a:dir == '-'
- let g:Idx -= 1
- elseif a:dir == '+'
- let g:Idx += 1
- endif
- let l:fnt = substitute(g:Fonts1[g:Idx], " ", '\\ ', "g")
- "let l:fnt = substitute(l:fnt, "=.*", '', "")
- let l:fnt = substitute(l:fnt, ":.*", '', "")
- let l:fnt = l:fnt . '\ ' . g:Fontsize
- execute "set guifont=".l:fnt
- redraw
- echo l:fnt
- "execute 'set guifont=?'
- sleep 250m
- endfunction
- function! ChangeFontSize( dir )
- if a:dir == '-'
- let g:Fontsize -= 1
- else
- let g:Fontsize += 1
- endif
- call ChangeFont(' ')
- endfunction
- nnoremap <F3> :call ChangeFont('+')<CR>
- nnoremap <s-F3> :call ChangeFont('-')<CR>
- nnoremap <F4> :call ChangeFontSize('+')<CR>
- nnoremap <s-F4> :call ChangeFontSize('-')<CR>
- nnoremap <F5> :source /home/smeckley/examples/viml/cycle_fonts.vim<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement