Skip to content

Instantly share code, notes, and snippets.

@jsylvanus
Last active April 26, 2018 20:19
Show Gist options
  • Save jsylvanus/caec49dd76b6299f935b to your computer and use it in GitHub Desktop.
Save jsylvanus/caec49dd76b6299f935b to your computer and use it in GitHub Desktop.
Squint test w/ BLOKK font
" Throw me in your ~/.gvimrc
let g:squinty = 0
function! Squint()
let windowBounds = system("osascript -e 'tell application \"MacVim\" to get bounds of window 1'")[:-2]
if g:squinty
set guifont=InputMonoCondensed_Thin:h14
let g:squinty = 0
else
set guifont=BLOKK:h6
let g:squinty = 1
endif
let thecommand = "osascript -e 'tell application \"MacVim\" to set bounds of window 1 to {" . windowBounds . "}'"
let result = system(thecommand)
redraw!
endfunction
nnoremap <F6> :call Squint()<CR>
@jsylvanus
Copy link
Author

This is pretty much inspired by Katrina Owen's squint test in her Peepcode video. I was thinking "wow it would be great if that could be a toggle" but it turned out that changing the font size resized the window w/ MacVim (and terminal), so I worked out a way around that. It's a little bit flicker-y but it works...

Only tested in MacVim (apply to ~/.gvimrc), though I suppose it could work with a terminal if one tweaked the osascript commands.

So flickery...

Obviously set the fonts and font sizes to your liking (main on ln7, squinty on ln10), and the F6 keymap is just my preference...

@jsylvanus
Copy link
Author

It does seem to lose a little bit of height over several toggles...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment