
As an inveterate vim user the first thing (or one of the first things) I'd do when starting a new project under Windows is installing vim to use it for searching, grapping and editing logfiles when I'm bugfixing. Or just a to use it as a general viewer for all sorts of files.
Typically I'd set up my toolbar buttons (for vim 7.4) like that:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | "" Caution: Needs 18x18 bitmaps in "C:\Program Files (x86)\Vim\vim73\bitmaps" !!! :amenu ToolBar.- SEP - : :tmenu ToolBar.tabedit Open new tab (mrkkrj) :amenu ToolBar.tabedit :tabedit <cr> :tmenu ToolBar.darklight Switch color themes (mrkkrj) :amenu ToolBar.darklight :colo zellner<cr> :tmenu ToolBar.lightdark Switch color themes (mrkkrj) :amenu ToolBar.lightdark :colo torte<cr> :tmenu ToolBar.smallfont Smaller font (mrkkrj) :amenu ToolBar.smallfont :set guifont=Lucida_Console :h9 <cr> :tmenu ToolBar.bigfont Bigger font (mrkkrj) :amenu ToolBar.bigfont :set guifont=Lucida_Console :h10 <c> |
Somehow this was always enough, beacuse I just used my default dark scheme plus one more dark and an alternative light one. As you know the colors depend on the monitir you are using and the room you are sitting in, so in my new project I wanted to toggle through several schemes and font sizes before I settle down with my favorite. Thus I introduced following functions:
1 2 3 4 5 6 7 8 9 | :tmenu ToolBar.darklight Switch color themes (mrkkrj) :amenu ToolBar.darklight :call ToggleLightScheme()<cr> :tmenu ToolBar.lightdark Switch color themes (mrkkrj) :amenu ToolBar.lightdark :call ToggleDarkScheme()<cr> :tmenu ToolBar.smallfont Smaller font (mrkkrj) :amenu ToolBar.smallfont :set guifont=Lucida_Console :h9 <cr> :tmenu ToolBar.bigfont Bigger font (mrkkrj) :amenu ToolBar.bigfont :call ToggleBigFontSize()<c> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | :function ToggleDarkScheme() : if exists( 'g:colors_name' ) : if g :colors_name == 'evening' : colo darkblue : else : colo evening : endif : else : colo evening : endif :endfunction :function ToggleLightScheme() : if exists( 'g:colors_name' ) : if g :colors_name == 'zellner' : colo delek : else : colo zellner : endif : else : colo delek : endif :endfunction |
1 2 3 4 5 6 7 8 9 10 11 | let g :guifonts_name = 'Lucida_Console:h10' :function ToggleBigFontSize() : if g :guifonts_name == 'Lucida_Console:h10' : set guifont=Lucida_Console :h12 : let g :guifonts_name = 'Lucida_Console:h12' : else : set guifont=Lucida_Console :h10 : let g :guifonts_name = 'Lucida_Console:h10' : endif :endfunction |
--
* "Switch Color Schemes" in Vim Tips Wiki: http://vim.wikia.com/wiki/Switch_color_schemes
** There some good intros you can use to deepen your knowledge of vim scripting:
- "Five Minute Vimscript" by Andrew Scala: http://andrewscala.com/vimscript/
- "Scripting the vim editor"series by Damian Conway: https://www.ibm.com/developerworks/library/l-vim-script-1/index.html
- The "Learn Vimscript the Hard Way" book online: http://learnvimscriptthehardway.stevelosh.com/
No comments:
Post a Comment