Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
vim-gdb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Moritz Sichert
vim-gdb
Commits
cf11f908
Commit
cf11f908
authored
6 years ago
by
Moritz Sichert
Browse files
Options
Downloads
Patches
Plain Diff
Open file only if it's readable
parent
00c10559
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugin/vim-gdb.vim
+24
-17
24 additions, 17 deletions
plugin/vim-gdb.vim
with
24 additions
and
17 deletions
plugin/vim-gdb.vim
+
24
−
17
View file @
cf11f908
...
...
@@ -16,23 +16,30 @@ function! Tapi_vimgdb_goto(bufnum, arglist)
let
session
=
s:sessions
[
session_id
]
" Go to source window
noautocmd
call
win_gotoid
(
session
[
'source_winid'
])
" Open file if needed
if
filename
!=
expand
(
'%:p'
)
execute
'edit'
fnameescape
(
filename
)
endif
" Update highlighted line
if
session
[
'current_line_matchid'
]
!=
-1
call
matchdelete
(
session
[
'current_line_matchid'
])
endif
let
session
[
'current_line_matchid'
]
=
matchaddpos
(
'VimgdbCurrentLine'
,
[
line
])
" Jump to current line if its not visible
let
first_visible
=
line
(
'w0'
)
let
last_visible
=
line
(
'w$'
)
if
last_visible
>
first_visible &&
(
line
<
first_visible
||
line
>
last_visible
)
execute
'keepjumps normal!'
line
.
'G'
endif
" Switch back to debugger window
noautocmd
call
win_gotoid
(
bufwinid
(
a:bufnum
))
try
" Open file if needed
if
filename
!=
expand
(
'%:p'
)
" Do nothing when file is not readable
if
!
filereadable
(
filename
)
return
endif
execute
'edit'
fnameescape
(
filename
)
endif
" Update highlighted line
if
session
[
'current_line_matchid'
]
!=
-1
call
matchdelete
(
session
[
'current_line_matchid'
])
endif
let
session
[
'current_line_matchid'
]
=
matchaddpos
(
'VimgdbCurrentLine'
,
[
line
])
" Jump to current line if its not visible
let
first_visible
=
line
(
'w0'
)
let
last_visible
=
line
(
'w$'
)
if
last_visible
>
first_visible &&
(
line
<
first_visible
||
line
>
last_visible
)
execute
'keepjumps normal!'
line
.
'G'
endif
finally
" Switch back to debugger window
noautocmd
call
win_gotoid
(
bufwinid
(
a:bufnum
))
endtry
endfunction
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment