Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
main
Branches (1)
main
main
Branches (1)
main
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
main
Branches (1)
main
stackview
/
plugin
/
stackview.vim
stackview
/
plugin
/
stackview.vim
stackview.vim 11.79 KB
Copy Edit Raw Blame History
Silent_DXX authored 2020年12月04日 14:08 +08:00 . Focus tag support set foreground color
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 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
if !has("python")
echo "vim has to be compiled with +python to run this"
finish
endif
if exists('g:loaded_stackview_plugin')
finish
endif
" the rest of plugin VimL code goes here
let g:loaded_stackview_plugin = 1
let s:plugin_root_dir = fnamemodify(resolve(expand('<sfile>:p')), ':h')
python << EOF
import sys
from os.path import normpath, join
import vim
plugin_root_dir = vim.eval('s:plugin_root_dir')
python_root_dir = normpath(join(plugin_root_dir, '..', 'python'))
sys.path.insert(0, python_root_dir)
from gdbmi_utils import *
EOF
let StackView_title = "__StackView_List__"
let s:StackView_bufnum = 0
let StackViewTagNameFG ='#43beef'
let StackViewTagFocusFG ='#2e8b57'
"FUNCTION: s:bufInWindows(bnum)
"Determine the number of windows open to this buffer number.
"Care of Yegappan Lakshman. Thanks!
"
"Args:
"bnum: the subject buffers buffer number
function! s:bufInWindows(bnum)
let cnt = 0
let winnum = 1
while 1
let bufnum = winbufnr(winnum)
if bufnum < 0
break
endif
if bufnum == a:bnum
let cnt = cnt + 1
endif
let winnum = winnum + 1
endwhile
return cnt
endfunction
"FUNCTION: s:isWindowUsable(winnumber)
"Returns 1 if opening a file from the tree in the given window requires it to
"be split
"
"Args:
"winnumber: the number of the window in question
function! s:isWindowUsable(winnumber)
"gotta split if theres only one window (i.e. the NERD tree)
if winnr("$") == 1
return 0
endif
let oldwinnr = winnr()
exec a:winnumber . "wincmd p"
let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow')
let modified = &modified
exec oldwinnr . "wincmd p"
"if its a special window e.g. quickfix or another explorer plugin then we
"have to split
if specialWindow
return 0
endif
if &hidden
return 1
endif
return !modified || s:bufInWindows(winbufnr(a:winnumber)) >= 2
endfunction
"FUNCTION: s:firstNormalWindow()
"find the window number of the first normal window
function! s:firstNormalWindow()
let i = 1
while i <= winnr("$")
let bnum = winbufnr(i)
if bnum != -1 && getbufvar(bnum, '&buftype') == ''
\ && !getwinvar(i, '&previewwindow')
return i
endif
let i += 1
endwhile
return -1
endfunction
" StackView_Open_Window
" Create a new window. If it is already open, clear it
function! s:StackView_Open_Window()
" Cleanup the window listing, if the window is open
let winnum = bufwinnr(g:StackView_title)
if winnum != -1
" Jump to the existing window
if winnr() != winnum
exe winnum . 'wincmd w'
endif
else
" If the tag listing temporary buffer already exists, then reuse it.
" Otherwise create a new buffer
let bufnum = bufnr(g:StackView_title)
if bufnum == -1
" Create a new buffer
let wcmd = g:StackView_title
else
" Edit the existing buffer
let wcmd = '+buffer' . bufnum
endif
let s:StackView_bufnum = bufnum
" Create the window
exe 'silent! ' . 'topleft vertical 30 new ' . wcmd
endif
endfunction
" StackView_Cleanup()
" Cleanup all the window variables.
function! s:StackView_Cleanup()
if has('syntax')
silent! syntax clear StackViewTitle
silent! syntax clear StackViewTagName
silent! syntax clear StackViewTagFocus
endif
match none
if exists('b:tlist_wp_count') && b:tlist_wp_count != ''
let line_num = 0
while line_num < b:tlist_wp_count
let item_index = 0
while item_index < b:tlist_fp_{line_num}_count
unlet! b:tlist_fp_{line_num}_{item_index}_fullname
unlet! b:tlist_fp_{line_num}_{item_index}_line
let item_index = item_index + 1
endwhile
unlet! b:tlist_fp_{line_num}_list
let line_num = line_num + 1
endwhile
endif
unlet! b:tlist_wp_start
unlet! b:tlist_wp_count
unlet! b:tlist_wp_list
endfunction
" StackView_Init_Window
" Set the default options for the window
function! s:StackView_Init_Window(filename)
" Set report option to a huge value to prevent informations messages
" while deleting the lines
let old_report = &report
set report=99999
" Mark the buffer as modifiable
setlocal modifiable
" Delete the contents of the buffer to the black-hole register
silent! %delete _
" Mark the buffer as not modifiable
setlocal nomodifiable
" Restore the report option
let &report = old_report
" Clean up all the old variables used for the last filetype
call <SID>StackView_Cleanup()
" Mark the buffer as modifiable
setlocal modifiable
call append(0, '" StackView')
let txt = fnamemodify(a:filename, ':t') . ' (' .
\ fnamemodify(a:filename, ':p:h') . ')'
silent! put! =txt
" Mark the buffer as not modifiable
setlocal nomodifiable
" Highlight the comments
if has('syntax')
syntax match StackViewComment '^" .*'
syntax match StackViewFileName '^[^" ].*$'
" Colors to highlight comments and titles
highlight clear StackViewComment
highlight link StackViewComment Comment
highlight clear StackViewTitle
highlight link StackViewTitle Title
if hlexists('MyStackViewFileName')
highlight link StackViewFileName MyStackViewFileName
else
highlight clear StackViewFileName
highlight default StackViewFileName guibg=Grey ctermbg=darkgray
\ guifg=white ctermfg=white
endif
endif
" Folding related settings
if has('folding')
setlocal foldenable
setlocal foldmethod=manual
setlocal foldcolumn=2
setlocal foldtext=v:folddashes.getline(v:foldstart)
endif
" Mark buffer as scratch
silent! setlocal buftype=nofile
silent! setlocal bufhidden=delete
silent! setlocal noswapfile
" Due to a bug in Vim 6.0, the winbufnr() function fails for unlisted
" buffers. So if the list buffer is unlisted, multiple list
" windows will be opened. This bug is fixed in Vim 6.1 and above
if v:version >= 601
silent! setlocal nobuflisted
endif
silent! setlocal nowrap
" If the 'number' option is set in the source window, it will affect the
" list window. So forcefully disable 'number' option for the list
" window
silent! setlocal nonumber
silent! setlocal winfixwidth
silent! setlocal nospell
iabc <buffer>
nnoremap <buffer> <silent> <2-LeftMouse> :call <SID>StackView_Jump_To_Tag(0)<CR>
endfunction
function! s:StackView_Window_Refresh(bkfile)
" Mark the buffer as modifiable
setlocal modifiable
normal! ggdG
" Mark the buffer as not modifiable
setlocal nomodifiable
" Initialize the list window
call s:StackView_Init_Window(a:bkfile)
" List the tags defined in a file
call s:StackView_Explore_File(a:bkfile)
endfunction
" StackView_Explore_File()
" List the tags defined in the specified file in a Vim window
function! s:StackView_Explore_File(filename)
let bufnum = s:StackView_bufnum
let ftype = fnamemodify(a:filename, ':e')
" Check for valid filename and valid filetype
if a:filename == '' || !filereadable(a:filename) || ftype == ''
return
endif
" Set report option to a huge value to prevent informational messages
" while adding lines to the list window
let old_report = &report
set report=99999
" Mark the buffer as modifiable
setlocal modifiable
if !exists('b:curr_wp_select')
let b:curr_wp_select = 0
endif
call LoadConfig(a:filename)
silent! put ='focus'
let b:tlist_wp_start = line('.')
silent! put = b:tlist_wp_list
" create a fold for focus
if has('folding')
let fold_start = b:tlist_wp_start
let fold_end = fold_start + b:tlist_wp_count
exe fold_start . ',' . fold_end . 'fold'
endif
" Syntax highlight the focus names
if has('syntax')
exe 'syntax match StackViewTitle /\%' . b:tlist_wp_start . 'l.*/'
silent! syntax clear StackViewTagFocus
silent! exe 'highlight StackViewTagFocus term=bold ctermfg=Cyan guifg=' . g:StackViewTagFocusFG . ' gui=bold'
let l:hl_line = b:tlist_wp_start + b:curr_wp_select + 1
silent! exe 'syntax match StackViewTagFocus /\%' . l:hl_line . 'l.*/'
endif
silent! put =''
let b:tlist_fp_start = line('.') + 1
silent! put ='stack_list'
silent! put = b:tlist_fp_{b:curr_wp_select}_list
" create a fold for stack_list
if has('folding')
let fold_start = b:tlist_fp_start
let fold_end = fold_start + b:tlist_fp_{b:curr_wp_select}_count
exe fold_start . ',' . fold_end . 'fold'
endif
" Syntax highlight the stack_list names
if has('syntax')
exe 'syntax match StackViewTitle /\%' . b:tlist_fp_start . 'l.*/'
endif
normal! Gdd
" Mark the buffer as not modifiable
setlocal nomodifiable
" Restore the report option
let &report = old_report
" Initially open all the folds
if has('folding')
silent! %foldopen!
endif
" Goto the first line in the buffer
go
return
endfunction
" StackView_Toggle_Window()
" Open a StackView window
function! s:StackView_Toggle_Window(bkfile)
if a:bkfile == ""
echo 'Please specify a file[*.bkpt] path!'
return
endif
let curline = line('.')
" If list window is open then close it.
let winnum = bufwinnr(g:StackView_title)
if winnum != -1
if winnr() == winnum
" Already in the list window. Close it and return
close
else
" Goto the list window, close it and then come back to the
" original window
let curbufnr = bufnr('%')
exe winnum . 'wincmd w'
close
" Need to jump back to the original window only if we are not
" already in that window
let winnum = bufwinnr(curbufnr)
if winnr() != winnum
exe winnum . 'wincmd w'
endif
endif
return
endif
" Open the list window
call s:StackView_Open_Window()
" Initialize the list window
call s:StackView_Init_Window(a:bkfile)
" List the tags defined in a file
call s:StackView_Explore_File(a:bkfile)
endfunction
" StackView_Jump_To_Tag()
" Jump to the location of the current tag
function! s:StackView_Jump_To_Tag(new_window)
" Do not process comment lines and empty lines
let curline = line('.') - 1
if curline >= b:tlist_fp_start
let l:tag_num = curline - b:tlist_fp_start
let l:tag_fullname = b:tlist_fp_{b:curr_wp_select}_{l:tag_num}_fullname
let l:tag_line = b:tlist_fp_{b:curr_wp_select}_{l:tag_num}_line
silent! syntax clear StackViewTagName
silent! exe 'highlight StackViewTagName term=bold ctermfg=Cyan guifg=' . g:StackViewTagNameFG . ' gui=bold'
silent! exe 'syntax match StackViewTagName /\%' . line('.') . 'l.*/'
if !s:isWindowUsable(winnr("#"))
exec s:firstNormalWindow() . "wincmd w"
else
wincmd p
endif
exec ("edit " . l:tag_fullname)
" Jump to the tag
silent call cursor(l:tag_line, 0)
elseif curline >= b:tlist_wp_start && curline < b:tlist_wp_start + b:tlist_wp_count
let b:curr_wp_select = curline - b:tlist_wp_start
call s:StackView_Window_Refresh(s:stackview_config_path)
else
return
endif
endfunction
function! LoadConfig(filename)
let s:stackview_config_path = a:filename
python load_config()
endfunction
command! -n=? -complete=file StackView :call s:StackView_Toggle_Window('<args>')
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

A VIM plug-in for viewing GDB stack information
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/silentdxx/stackview.git
git@gitee.com:silentdxx/stackview.git
silentdxx
stackview
stackview
main
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /