Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. " change fonts quickly and see the results interactively.
  2. " To use source this file:
  3. " :source cycle_fonts.vim
  4. function! ShowList(lst1)
  5. let i = 0
  6. let l:lst2 = []
  7.  
  8. while i < 5
  9. let l:fnt = substitute(a:lst1[i], " ", '\\ ', "")
  10. let l:fnt = substitute(l:fnt, "=.*", '', "")
  11. echo a:lst1[i]
  12. echo l:fnt
  13. let i += 1
  14. endwhile
  15. endfunction
  16.  
  17. let g:Idx = -1
  18. let g:Idx += 1
  19. echo g:Idx
  20. let g:Fontsize = 8
  21. let g:Fonts0 = system('fc-list')
  22. let g:Fonts1 = split(g:Fonts0,'\n')
  23. echo len(g:Fonts1)
  24.  
  25. call ShowList(g:Fonts1)
  26.  
  27. set guifont=Bitstream\ Vera\ Sans\ Mono\ 7
  28.  
  29. function! ChangeFont( dir )
  30. if a:dir == '-'
  31. let g:Idx -= 1
  32. elseif a:dir == '+'
  33. let g:Idx += 1
  34. endif
  35. let l:fnt = substitute(g:Fonts1[g:Idx], " ", '\\ ', "g")
  36. "let l:fnt = substitute(l:fnt, "=.*", '', "")
  37. let l:fnt = substitute(l:fnt, ":.*", '', "")
  38. let l:fnt = l:fnt . '\ ' . g:Fontsize
  39. execute "set guifont=".l:fnt
  40. redraw
  41. echo l:fnt
  42. "execute 'set guifont=?'
  43. sleep 250m
  44. endfunction
  45. function! ChangeFontSize( dir )
  46. if a:dir == '-'
  47. let g:Fontsize -= 1
  48. else
  49. let g:Fontsize += 1
  50. endif
  51. call ChangeFont(' ')
  52. endfunction
  53. nnoremap <F3> :call ChangeFont('+')<CR>
  54. nnoremap <s-F3> :call ChangeFont('-')<CR>
  55. nnoremap <F4> :call ChangeFontSize('+')<CR>
  56. nnoremap <s-F4> :call ChangeFontSize('-')<CR>
  57. nnoremap <F5> :source /home/smeckley/examples/viml/cycle_fonts.vim<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement