public
Last active — forked from averyvery/.vimrc

Tweaked Vim minimap

  • Download Gist
.vimrc
VimL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
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:h2
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
 
no h 10j
no t 10k
 
nmap <space> :ToggleMinimap<CR>
 
else
 
set guifont=Anonymous\ Pro:h14
hi clear Visible
set nocursorline
 
no h j
no t k
 
nmap <space> a<space><ESC>
 
endif
 
endfunction
 
command! ToggleMinimap call ToggleMinimap()
 
nmap <d-space> :ToggleMinimap<CR>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.