Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 79d1af3

Browse files
author
Daniel Malea
committedMay 23, 2013
Improve vim-lldb expression commands for objective-c and implement evaluate-under-cursor:
1. Added new :Lpo command 2. :Lpo and :Lprint can be invoked without parameters. In that case cursor word will be used 3. Added :LpO command in that case instead of <cword> will be used stripped <cWORD>. This command is useful for printing objective-c properties (for ex.: self.tableView). Patch by Arthur Evstifeev!! git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@182613 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0be9b3b commit 79d1af3

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed
 

‎utils/vim-lldb/doc/lldb.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ Possible window name arguments to the Lhide and Lshow commands include:
3737
* locals
3838
* registers
3939
* threads
40-
lldb-:Lattach
40+
*lldb-:Lattach*
4141
:Lattach <process-name> Attach to a process by name.
4242

43-
lldb-:Ldetach
43+
*lldb-:Ldetach*
4444
:Ldetach Detach from the current process.
4545

4646
*lldb-:Ltarget*
@@ -90,6 +90,13 @@ Possible window name arguments to the Lhide and Lshow commands include:
9090
command is invoked. If no arguments are provided,
9191
a breakpoint at the location under the cursor.
9292

93+
*lldb-:Lprint*
94+
*lldb-:Lpo*
95+
*lldb-:LpO*
96+
:Lprint <expr> Aliases to the lldb print and po commands. Cursor
97+
:Lpo <expr> word (cursor WORD for LpO) will be used when
98+
:LpO <expr> expression omitted.
99+
93100
MAPPINGS *lldb-mappings*
94101

95102
On Mac OS X (under MacVim) , the following key mappings are available:

‎utils/vim-lldb/plugin/lldb.vim

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ function! s:InitLldbPlugin()
8282
command -complete=custom,s:CompleteCommand -nargs=* Lwatchpoint python ctrl.doCommand('watchpoint', '<args>')
8383

8484
" Convenience (shortcut) LLDB commands
85-
command -complete=custom,s:CompleteCommand -nargs=* Lprint python ctrl.doCommand('print', '<args>')
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>')"))
8688
command -complete=custom,s:CompleteCommand -nargs=* Lbt python ctrl.doCommand('bt', '<args>')
8789

8890
" Frame/Thread-Selection (commands that also do an Uupdate but do not
@@ -135,4 +137,15 @@ returnCompleteWindow(a, l, p)
135137
EOF
136138
endfunction()
137139

140+
" Returns cword if search term is empty
141+
function! s:CursorWord(term)
142+
return empty(a:term) ? expand('<cword>') : a:term
143+
endfunction()
144+
145+
" Returns cleaned cWORD if search term is empty
146+
function! s:CursorWORD(term)
147+
" Will strip all non-alphabetic characters from both sides
148+
return empty(a:term) ? substitute(expand('<cWORD>'), '^\A*\(.\{-}\)\A*$', '\1', '') : a:term
149+
endfunction()
150+
138151
call s:InitLldbPlugin()

0 commit comments

Comments
 (0)