@@ -13,11 +13,11 @@ function! s:FindPythonScriptDir()
1313endfunction ()
1414
1515function ! s: InitLldbPlugin ()
16- if has (' python ' ) == 0
17- call confirm (' ERROR: This Vim installation does not have python support. lldb.vim will not work.' )
16+ if ! has (' python3 ' )
17+ call confirm (' ERROR: This Vim installation does not have python3 support. lldb.vim will not work.' )
1818 return
1919 endif
20-
20+
2121 " Key-Bindings
2222 " FIXME: choose sensible keybindings for:
2323 " - process: start, interrupt, continue, continue-to-cursor
@@ -29,10 +29,10 @@ function! s:InitLldbPlugin()
2929 endif
3030
3131 "
32- " Setup the python interpreter path
32+ " Setup the python3 interpreter path
3333 "
3434 let vim_lldb_pydir = s: FindPythonScriptDir ()
35- execute ' python import sys; sys.path.append("' . vim_lldb_pydir . ' ")'
35+ execute ' python3 import sys; sys.path.append("' . vim_lldb_pydir . ' ")'
3636
3737 "
3838 " Register :L<Command>
@@ -41,86 +41,86 @@ function! s:InitLldbPlugin()
4141 "
4242
4343 " Window show/hide commands
44- command -complete =custom ,s: CompleteWindow -nargs =1 Lhide python ctrl.doHide (' <args>' )
45- command -complete = custom , s: CompleteWindow - nargs =0 Lshow python ctrl.doShow (' <args>' )
46-
44+ command -complete =custom ,s: CompleteWindow -nargs =1 Lhide python3 ctrl.doHide (' <args>' )
45+ command -nargs =0 Lshow python3 ctrl.doShow (' <args>' )
46+
4747 " Launching convenience commands (no autocompletion)
48- command -nargs =* Lstart python ctrl.doLaunch (True, ' <args>' )
49- command -nargs =* Lrun python ctrl.doLaunch (False, ' <args>' )
50- command -nargs =1 Lattach python ctrl.doAttach (' <args>' )
51- command -nargs =0 Ldetach python ctrl.doDetach ()
48+ command -nargs =* Lstart python3 ctrl.doLaunch (True, ' <args>' )
49+ command -nargs =* Lrun python3 ctrl.doLaunch (False, ' <args>' )
50+ command -nargs =1 Lattach python3 ctrl.doAttach (' <args>' )
51+ command -nargs =0 Ldetach python3 ctrl.doDetach ()
5252
5353 " Regexp-commands: because vim's command mode does not support '_' or '-'
5454 " characters in command names, we omit them when creating the :L<cmd>
5555 " equivalents.
56- command -complete =custom ,s: CompleteCommand -nargs =* Lregexpattach python ctrl.doCommand (' _regexp-attach' , ' <args>' )
57- command -complete =custom ,s: CompleteCommand -nargs =* Lregexpbreak python ctrl.doCommand (' _regexp-break' , ' <args>' )
58- command -complete =custom ,s: CompleteCommand -nargs =* Lregexpbt python ctrl.doCommand (' _regexp-bt' , ' <args>' )
59- command -complete =custom ,s: CompleteCommand -nargs =* Lregexpdown python ctrl.doCommand (' _regexp-down' , ' <args>' )
60- command -complete =custom ,s: CompleteCommand -nargs =* Lregexptbreak python ctrl.doCommand (' _regexp-tbreak' , ' <args>' )
61- command -complete =custom ,s: CompleteCommand -nargs =* Lregexpdisplay python ctrl.doCommand (' _regexp-display' , ' <args>' )
62- command -complete =custom ,s: CompleteCommand -nargs =* Lregexpundisplay python ctrl.doCommand (' _regexp-undisplay' , ' <args>' )
63- command -complete =custom ,s: CompleteCommand -nargs =* Lregexpup python ctrl.doCommand (' _regexp-up' , ' <args>' )
64-
65- command -complete =custom ,s: CompleteCommand -nargs =* Lapropos python ctrl.doCommand (' apropos' , ' <args>' )
66- command -complete =custom ,s: CompleteCommand -nargs =* Lbacktrace python ctrl.doCommand (' bt' , ' <args>' )
67- command -complete =custom ,s: CompleteCommand -nargs =* Lbreakpoint python ctrl.doBreakpoint (' <args>' )
68- command -complete =custom ,s: CompleteCommand -nargs =* Lcommand python ctrl.doCommand (' command' , ' <args>' )
69- command -complete =custom ,s: CompleteCommand -nargs =* Ldisassemble python ctrl.doCommand (' disassemble' , ' <args>' )
70- command -complete =custom ,s: CompleteCommand -nargs =* Lexpression python ctrl.doCommand (' expression' , ' <args>' )
71- command -complete =custom ,s: CompleteCommand -nargs =* Lhelp python ctrl.doCommand (' help' , ' <args>' )
72- command -complete =custom ,s: CompleteCommand -nargs =* Llog python ctrl.doCommand (' log' , ' <args>' )
73- command -complete =custom ,s: CompleteCommand -nargs =* Lplatform python ctrl.doCommand (' platform' ,' <args>' )
74- command -complete =custom ,s: CompleteCommand -nargs =* Lplugin python ctrl.doCommand (' plugin' , ' <args>' )
75- command -complete =custom ,s: CompleteCommand -nargs =* Lprocess python ctrl.doProcess (' <args>' )
76- command -complete =custom ,s: CompleteCommand -nargs =* Lregister python ctrl.doCommand (' register' , ' <args>' )
77- command -complete =custom ,s: CompleteCommand -nargs =* Lscript python ctrl.doCommand (' script' , ' <args>' )
78- command -complete =custom ,s: CompleteCommand -nargs =* Lsettings python ctrl.doCommand (' settings' ,' <args>' )
79- command -complete =custom ,s: CompleteCommand -nargs =* Lsource python ctrl.doCommand (' source' , ' <args>' )
80- command -complete =custom ,s: CompleteCommand -nargs =* Ltype python ctrl.doCommand (' type' , ' <args>' )
81- command -complete =custom ,s: CompleteCommand -nargs =* Lversion python ctrl.doCommand (' version' , ' <args>' )
82- command -complete =custom ,s: CompleteCommand -nargs =* Lwatchpoint python ctrl.doCommand (' watchpoint' , ' <args>' )
83-
56+ command -complete =custom ,s: CompleteCommand -nargs =* Lregexpattach python3 ctrl.doCommand (' _regexp-attach' , ' <args>' )
57+ command -complete =custom ,s: CompleteCommand -nargs =* Lregexpbreak python3 ctrl.doCommand (' _regexp-break' , ' <args>' )
58+ command -complete =custom ,s: CompleteCommand -nargs =* Lregexpbt python3 ctrl.doCommand (' _regexp-bt' , ' <args>' )
59+ command -complete =custom ,s: CompleteCommand -nargs =* Lregexpdown python3 ctrl.doCommand (' _regexp-down' , ' <args>' )
60+ command -complete =custom ,s: CompleteCommand -nargs =* Lregexptbreak python3 ctrl.doCommand (' _regexp-tbreak' , ' <args>' )
61+ command -complete =custom ,s: CompleteCommand -nargs =* Lregexpdisplay python3 ctrl.doCommand (' _regexp-display' , ' <args>' )
62+ command -complete =custom ,s: CompleteCommand -nargs =* Lregexpundisplay python3 ctrl.doCommand (' _regexp-undisplay' , ' <args>' )
63+ command -complete =custom ,s: CompleteCommand -nargs =* Lregexpup python3 ctrl.doCommand (' _regexp-up' , ' <args>' )
64+
65+ command -complete =custom ,s: CompleteCommand -nargs =* Lapropos python3 ctrl.doCommand (' apropos' , ' <args>' )
66+ command -complete =custom ,s: CompleteCommand -nargs =* Lbacktrace python3 ctrl.doCommand (' bt' , ' <args>' )
67+ command -complete =custom ,s: CompleteCommand -nargs =* Lbreakpoint python3 ctrl.doBreakpoint (' <args>' )
68+ command -complete =custom ,s: CompleteCommand -nargs =* Lcommand python3 ctrl.doCommand (' command' , ' <args>' )
69+ command -complete =custom ,s: CompleteCommand -nargs =* Ldisassemble python3 ctrl.doCommand (' disassemble' , ' <args>' )
70+ command -complete =custom ,s: CompleteCommand -nargs =* Lexpression python3 ctrl.doCommand (' expression' , ' <args>' )
71+ command -complete =custom ,s: CompleteCommand -nargs =* Lhelp python3 ctrl.doCommand (' help' , ' <args>' )
72+ command -complete =custom ,s: CompleteCommand -nargs =* Llog python3 ctrl.doCommand (' log' , ' <args>' )
73+ command -complete =custom ,s: CompleteCommand -nargs =* Lplatform python3 ctrl.doCommand (' platform' ,' <args>' )
74+ command -complete =custom ,s: CompleteCommand -nargs =* Lplugin python3 ctrl.doCommand (' plugin' , ' <args>' )
75+ command -complete =custom ,s: CompleteCommand -nargs =* Lprocess python3 ctrl.doProcess (' <args>' )
76+ command -complete =custom ,s: CompleteCommand -nargs =* Lregister python3 ctrl.doCommand (' register' , ' <args>' )
77+ command -complete =custom ,s: CompleteCommand -nargs =* Lscript python3 ctrl.doCommand (' script' , ' <args>' )
78+ command -complete =custom ,s: CompleteCommand -nargs =* Lsettings python3 ctrl.doCommand (' settings' ,' <args>' )
79+ command -complete =custom ,s: CompleteCommand -nargs =* Lsource python3 ctrl.doCommand (' source' , ' <args>' )
80+ command -complete =custom ,s: CompleteCommand -nargs =* Ltype python3 ctrl.doCommand (' type' , ' <args>' )
81+ command -complete =custom ,s: CompleteCommand -nargs =* Lversion python3 ctrl.doCommand (' version' , ' <args>' )
82+ command -complete =custom ,s: CompleteCommand -nargs =* Lwatchpoint python3 ctrl.doCommand (' watchpoint' , ' <args>' )
83+
8484 " Convenience (shortcut) LLDB commands
85- command -complete =custom ,s: CompleteCommand -nargs =* Lprint python ctrl.doCommand (' print' , vim .eval (" s:CursorWord('<args>')" ))
86- command -complete =custom ,s: CompleteCommand -nargs =* Lpo python ctrl.doCommand (' po' , vim .eval (" s:CursorWord('<args>')" ))
87- command -complete =custom ,s: CompleteCommand -nargs =* LpO python ctrl.doCommand (' po' , vim .eval (" s:CursorWORD('<args>')" ))
88- command -complete =custom ,s: CompleteCommand -nargs =* Lbt python ctrl.doCommand (' bt' , ' <args>' )
85+ command -complete =custom ,s: CompleteCommand -nargs =* Lprint python3 ctrl.doCommand (' print' , vim .eval (" s:CursorWord('<args>')" ))
86+ command -complete =custom ,s: CompleteCommand -nargs =* Lpo python3 ctrl.doCommand (' po' , vim .eval (" s:CursorWord('<args>')" ))
87+ command -complete =custom ,s: CompleteCommand -nargs =* LpO python3 ctrl.doCommand (' po' , vim .eval (" s:CursorWORD('<args>')" ))
88+ command -complete =custom ,s: CompleteCommand -nargs =* Lbt python3 ctrl.doCommand (' bt' , ' <args>' )
8989
9090 " Frame/Thread-Selection (commands that also do an Uupdate but do not
9191 " generate events in LLDB)
92- command -complete =custom ,s: CompleteCommand -nargs =* Lframe python ctrl.doSelect (' frame' , ' <args>' )
93- command -complete =custom ,s: CompleteCommand -nargs =? Lup python ctrl.doCommand (' up' , ' <args>' , print_on_success= False, goto_file= True)
94- command -complete =custom ,s: CompleteCommand -nargs =? Ldown python ctrl.doCommand (' down' , ' <args>' , print_on_success= False, goto_file= True)
95- command -complete =custom ,s: CompleteCommand -nargs =* Lthread python ctrl.doSelect (' thread' , ' <args>' )
92+ command -complete =custom ,s: CompleteCommand -nargs =* Lframe python3 ctrl.doSelect (' frame' , ' <args>' )
93+ command -complete =custom ,s: CompleteCommand -nargs =? Lup python3 ctrl.doCommand (' up' , ' <args>' , print_on_success= False, goto_file= True)
94+ command -complete =custom ,s: CompleteCommand -nargs =? Ldown python3 ctrl.doCommand (' down' , ' <args>' , print_on_success= False, goto_file= True)
95+ command -complete =custom ,s: CompleteCommand -nargs =* Lthread python3 ctrl.doSelect (' thread' , ' <args>' )
9696
97- command -complete =custom ,s: CompleteCommand -nargs =* Ltarget python ctrl.doTarget (' <args>' )
97+ command -complete =custom ,s: CompleteCommand -nargs =* Ltarget python3 ctrl.doTarget (' <args>' )
9898
9999 " Continue
100- command -complete =custom ,s: CompleteCommand -nargs =* Lcontinue python ctrl.doContinue ()
100+ command -complete =custom ,s: CompleteCommand -nargs =* Lcontinue python3 ctrl.doContinue ()
101101
102102 " Thread-Stepping (no autocompletion)
103- command -nargs =0 Lstepinst python ctrl.doStep (StepType.INSTRUCTION)
104- command -nargs =0 Lstepinstover python ctrl.doStep (StepType.INSTRUCTION_OVER)
105- command -nargs =0 Lstepin python ctrl.doStep (StepType.INTO)
106- command -nargs =0 Lstep python ctrl.doStep (StepType.INTO)
107- command -nargs =0 Lnext python ctrl.doStep (StepType.OVER)
108- command -nargs =0 Lfinish python ctrl.doStep (StepType.OUT)
103+ command -nargs =0 Lstepinst python3 ctrl.doStep (StepType.INSTRUCTION)
104+ command -nargs =0 Lstepinstover python3 ctrl.doStep (StepType.INSTRUCTION_OVER)
105+ command -nargs =0 Lstepin python3 ctrl.doStep (StepType.INTO)
106+ command -nargs =0 Lstep python3 ctrl.doStep (StepType.INTO)
107+ command -nargs =0 Lnext python3 ctrl.doStep (StepType.OVER)
108+ command -nargs =0 Lfinish python3 ctrl.doStep (StepType.OUT)
109109
110110 " hack: service the LLDB event-queue when the cursor moves
111111 " FIXME: some threaded solution would be better...but it
112112 " would have to be designed carefully because Vim's APIs are non threadsafe;
113113 " use of the vim module **MUST** be restricted to the main thread.
114- command -nargs =0 Lrefresh python ctrl.doRefresh ()
114+ command -nargs =0 Lrefresh python3 ctrl.doRefresh ()
115115 autocmd CursorMoved * :Lrefresh
116116 autocmd CursorHold * :Lrefresh
117- autocmd VimLeavePre * python ctrl.doExit ()
117+ autocmd VimLeavePre * python3 ctrl.doExit ()
118118
119- execute ' pyfile ' . vim_lldb_pydir . ' /plugin.py'
119+ execute ' py3file ' . vim_lldb_pydir . ' /plugin.py'
120120endfunction ()
121121
122122function ! s: CompleteCommand (A, L, P )
123- python << EOF
123+ python3 << EOF
124124a = vim .eval (" a:A" )
125125l = vim .eval (" a:L" )
126126p = vim .eval (" a:P" )
129129endfunction ()
130130
131131function ! s: CompleteWindow (A, L, P )
132- python << EOF
132+ python3 << EOF
133133a = vim .eval (" a:A" )
134134l = vim .eval (" a:L" )
135135p = vim .eval (" a:P" )
0 commit comments