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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
|
" MIT (c) Wenxuan Zhang and Zach Nielsen
if exists('g:loaded_minimap')
finish
endif
if v:version < 800
echom 'minimap: this plugin requires vim >= 8.'
finish
endif
if !exists('g:minimap_exec_warning')
let g:minimap_exec_warning = 1
endif
if !executable('code-minimap')
if g:minimap_exec_warning != 0
echom 'minimap: this plugin requires code-minimap installed.'
endif
finish
endif
let g:loaded_minimap = 1
command! Minimap call minimap#vim#MinimapOpen()
command! MinimapClose call minimap#vim#MinimapClose()
command! MinimapToggle call minimap#vim#MinimapToggle()
command! MinimapRefresh call minimap#vim#MinimapRefresh()
command! MinimapUpdateHighlight call minimap#vim#MinimapUpdateHighlight()
command! MinimapRescan call minimap#vim#MinimapRescan()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" Configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if !exists('g:minimap_auto_start')
let g:minimap_auto_start = 0
endif
if !exists('g:minimap_left')
let g:minimap_left = 0
endif
if !exists('g:minimap_width')
let g:minimap_width = 10
endif
if !exists('g:minimap_window_width_override_for_scaling')
let g:minimap_window_width_override_for_scaling = 2147483647
endif
if !exists('g:minimap_auto_start_win_enter')
let g:minimap_auto_start_win_enter = 0
endif
if !exists('g:minimap_base_matchid')
let g:minimap_base_matchid = 9265454 " magic number
endif
if !exists('g:minimap_search_matchid_safe_range')
let g:minimap_search_matchid_safe_range = g:minimap_base_matchid + 30000
endif
if !exists('g:minimap_block_filetypes')
let g:minimap_block_filetypes = ['fugitive', 'nerdtree', 'tagbar', 'fzf']
endif
if !exists('g:minimap_block_buftypes')
let g:minimap_block_buftypes = ['nofile', 'nowrite', 'quickfix', 'terminal', 'prompt']
endif
if !exists('g:minimap_close_filetypes')
let g:minimap_close_filetypes = ['startify', 'netrw', 'vim-plug']
endif
if !exists('g:minimap_close_buftypes')
let g:minimap_close_buftypes = []
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" Feature Flags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if !exists('g:minimap_highlight_range')
let g:minimap_highlight_range = 1
endif
if !exists('g:minimap_git_colors')
let g:minimap_git_colors = 0
endif
if !exists('g:minimap_enable_highlight_colorgroup')
let g:minimap_enable_highlight_colorgroup = 1
endif
if !exists('g:minimap_highlight_search')
let g:minimap_highlight_search = 0
endif
if !exists('g:minimap_background_processing')
let g:minimap_background_processing = 0
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" Colors
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
highlight minimapCursor ctermbg=59 ctermfg=228 guibg=#5F5F5F guifg=#FFFF87 |
highlight minimapRange ctermbg=242 ctermfg=228 guibg=#4F4F4F guifg=#FFFF87 |
highlight minimapDiffRemoved ctermfg=197 guifg=#FC1A70 |
highlight minimapDiffAdded ctermfg=148 guifg=#A4E400 |
highlight minimapDiffLine ctermfg=141 guifg=#AF87FF |
highlight minimapCursorDiffRemoved ctermbg=59 ctermfg=197 guibg=#5F5F5F guifg=#FC1A70 |
highlight minimapCursorDiffAdded ctermbg=59 ctermfg=148 guibg=#5F5F5F guifg=#A4E400 |
highlight minimapCursorDiffLine ctermbg=59 ctermfg=141 guibg=#5F5F5F guifg=#AF87FF |
highlight minimapRangeDiffRemoved ctermbg=242 ctermfg=197 guibg=#4F4F4F guifg=#FC1A70 |
highlight minimapRangeDiffAdded ctermbg=242 ctermfg=148 guibg=#4F4F4F guifg=#A4E400 |
highlight minimapRangeDiffLine ctermbg=242 ctermfg=141 guibg=#4F4F4F guifg=#AF87FF
" Need the autocmd because some colorschemes clear all colors, so we need to
" re-add them so they stay valid
if g:minimap_enable_highlight_colorgroup == 1
augroup MinimapColorSchemes
autocmd!
autocmd ColorScheme *
\ highlight minimapCursor ctermbg=59 ctermfg=228 guibg=#5F5F5F guifg=#FFFF87 |
\ highlight minimapRange ctermbg=242 ctermfg=228 guibg=#4F4F4F guifg=#FFFF87 |
\ highlight minimapDiffRemoved ctermfg=197 guifg=#FC1A70 |
\ highlight minimapDiffAdded ctermfg=148 guifg=#A4E400 |
\ highlight minimapDiffLine ctermfg=141 guifg=#AF87FF |
\ highlight minimapCursorDiffRemoved ctermbg=59 ctermfg=197 guibg=#5F5F5F guifg=#FC1A70 |
\ highlight minimapCursorDiffAdded ctermbg=59 ctermfg=148 guibg=#5F5F5F guifg=#A4E400 |
\ highlight minimapCursorDiffLine ctermbg=59 ctermfg=141 guibg=#5F5F5F guifg=#AF87FF |
\ highlight minimapRangeDiffRemoved ctermbg=242 ctermfg=197 guibg=#4F4F4F guifg=#FC1A70 |
\ highlight minimapRangeDiffAdded ctermbg=242 ctermfg=148 guibg=#4F4F4F guifg=#A4E400 |
\ highlight minimapRangeDiffLine ctermbg=242 ctermfg=141 guibg=#4F4F4F guifg=#AF87FF
augroup END
endif
if !exists('g:minimap_base_highlight')
let g:minimap_base_highlight = 'Normal'
endif
" Change setting name, backwards compatibility
if exists('g:minimap_highlight')
let g:minimap_cursor_color = g:minimap_highlight
endif
if !exists('g:minimap_cursor_color')
let g:minimap_cursor_color = 'minimapCursor'
endif
if !exists('g:minimap_range_color')
let g:minimap_range_color = 'minimapRange'
endif
if !exists('g:minimap_search_color')
let g:minimap_search_color = 'Search'
endif
if !exists('g:minimap_diffremove_color')
let g:minimap_diffremove_color = 'minimapDiffRemoved'
endif
if !exists('g:minimap_diffadd_color')
let g:minimap_diffadd_color = 'minimapDiffAdded'
endif
if !exists('g:minimap_diff_color')
let g:minimap_diff_color = 'minimapDiffLine'
endif
if !exists('g:minimap_cursor_diffremove_color')
let g:minimap_cursor_diffremove_color = 'minimapCursorDiffRemoved'
endif
if !exists('g:minimap_cursor_diffadd_color')
let g:minimap_cursor_diffadd_color = 'minimapCursorDiffAdded'
endif
if !exists('g:minimap_cursor_diff_color')
let g:minimap_cursor_diff_color = 'minimapCursorDiffLine'
endif
if !exists('g:minimap_range_diffremove_color')
let g:minimap_range_diffremove_color = 'minimapRangeDiffRemoved'
endif
if !exists('g:minimap_range_diffadd_color')
let g:minimap_range_diffadd_color = 'minimapRangeDiffAdded'
endif
if !exists('g:minimap_range_diff_color')
let g:minimap_range_diff_color = 'minimapRangeDiffLine'
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" Priorities
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if !exists('g:minimap_cursor_color_priority')
let g:minimap_cursor_color_priority = 110
endif
if !exists('g:minimap_search_color_priority')
let g:minimap_search_color_priority = 120
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" Global variables and containers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Declare mutexes
let g:minimap_getting_window_info = 0
let g:minimap_did_quit = 0
let g:minimap_opening = 0
" Declare id lists - used for storing matchids of color groups
let g:minimap_range_id_list = []
let g:minimap_git_id_list = []
let g:minimap_search_id_list = []
let g:minimap_match_id_list = []
" key: mm_line, val: { 'state': state bitmap, 'id': match id for this coloring }
let g:minimap_line_state_table = {}
let g:minimap_run_update_highlight_count = 0
if g:minimap_auto_start == 1
augroup MinimapAutoStart
au!
au BufWinEnter * Minimap
if g:minimap_auto_start_win_enter == 1
au WinEnter * Minimap
endif
augroup end
endif
" Mappings to make searching update with * or #
if g:minimap_highlight_search != 0
nnoremap <silent> * *:call minimap#vim#UpdateColorSearch(1)<CR>
nnoremap <silent> # #:call minimap#vim#UpdateColorSearch(1)<CR>
nnoremap <silent> g* g*:call minimap#vim#UpdateColorSearch(1)<CR>
nnoremap <silent> g# g#:call minimap#vim#UpdateColorSearch(1)<CR>
" Example mapping for nohlsearch to also clear the minimap search highlighting
" nnoremap <silent> `` :nohlsearch<CR>:call minimap#vim#ClearColorSearch()<CR>
endif
|