Skip to content

Instantly share code, notes, and snippets.

@averyvery
Created December 13, 2011 06:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save averyvery/1470884 to your computer and use it in GitHub Desktop.
Save averyvery/1470884 to your computer and use it in GitHub Desktop.
Tweaked Vim minimap
function! ToggleMinimap()
if exists("s:isMini") && s:isMini == 0
let s:isMini = 1
else
let s:isMini = 0
end
if (s:isMini == 0)
" save current visible lines
let s:firstLine = line("w0")
let s:lastLine = line("w$")
" don't change window size
let c = &columns * 12
let l = &lines * 12
exe "set columns=" . c
exe "set lines=" . l
" make font small
set guifont=ProggyTinyTT:h1
exe 'normal zR'
" highlight lines which were visible
let s:lines = ""
for i in range(s:firstLine, s:lastLine)
let s:lines = s:lines . "\\%" . i . "l"
if i < s:lastLine
let s:lines = s:lines . "\\|"
endif
endfor
exe 'match Visible /' . s:lines . '/'
hi Visible guifg=#ffffff guibg=#2b3c43
set cursorline
set noantialias
no j 10j
no k 10k
nmap <LeftRelease> :ToggleMinimap<CR>
nmap <space> :ToggleMinimap<CR>
else
set guifont=Anonymous\ Pro:h14
hi clear Visible
set nocursorline
set antialias
unmap j
unmap k
unmap <LeftRelease>
unmap <space>
exe ":normal 0"
endif
endfunction
command! ToggleMinimap call ToggleMinimap()
nmap <d-space> :ToggleMinimap<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment