diff options
| -rw-r--r-- | lldb/utils/vim-lldb/doc/lldb.txt | 11 | ||||
| -rw-r--r-- | lldb/utils/vim-lldb/plugin/lldb.vim | 15 |
2 files changed, 23 insertions, 3 deletions
diff --git a/lldb/utils/vim-lldb/doc/lldb.txt b/lldb/utils/vim-lldb/doc/lldb.txt index e3801970999..e54e6f2db0d 100644 --- a/lldb/utils/vim-lldb/doc/lldb.txt +++ b/lldb/utils/vim-lldb/doc/lldb.txt @@ -37,10 +37,10 @@ Possible window name arguments to the Lhide and Lshow commands include: * locals * registers * threads - lldb-:Lattach + *lldb-:Lattach* :Lattach <process-name> Attach to a process by name. - lldb-:Ldetach + *lldb-:Ldetach* :Ldetach Detach from the current process. *lldb-:Ltarget* @@ -90,6 +90,13 @@ Possible window name arguments to the Lhide and Lshow commands include: command is invoked. If no arguments are provided, a breakpoint at the location under the cursor. + *lldb-:Lprint* + *lldb-:Lpo* + *lldb-:LpO* +:Lprint <expr> Aliases to the lldb print and po commands. Cursor +:Lpo <expr> word (cursor WORD for LpO) will be used when +:LpO <expr> expression omitted. + MAPPINGS *lldb-mappings* On Mac OS X (under MacVim) , the following key mappings are available: diff --git a/lldb/utils/vim-lldb/plugin/lldb.vim b/lldb/utils/vim-lldb/plugin/lldb.vim index e4a248c1fd9..ac5cfe3fbb4 100644 --- a/lldb/utils/vim-lldb/plugin/lldb.vim +++ b/lldb/utils/vim-lldb/plugin/lldb.vim @@ -82,7 +82,9 @@ function! s:InitLldbPlugin() command -complete=custom,s:CompleteCommand -nargs=* Lwatchpoint python ctrl.doCommand('watchpoint', '<args>') " Convenience (shortcut) LLDB commands - command -complete=custom,s:CompleteCommand -nargs=* Lprint python ctrl.doCommand('print', '<args>') + command -complete=custom,s:CompleteCommand -nargs=* Lprint python ctrl.doCommand('print', vim.eval("s:CursorWord('<args>')")) + command -complete=custom,s:CompleteCommand -nargs=* Lpo python ctrl.doCommand('po', vim.eval("s:CursorWord('<args>')")) + command -complete=custom,s:CompleteCommand -nargs=* LpO python ctrl.doCommand('po', vim.eval("s:CursorWORD('<args>')")) command -complete=custom,s:CompleteCommand -nargs=* Lbt python ctrl.doCommand('bt', '<args>') " Frame/Thread-Selection (commands that also do an Uupdate but do not @@ -135,4 +137,15 @@ returnCompleteWindow(a, l, p) EOF endfunction() +" Returns cword if search term is empty +function! s:CursorWord(term) + return empty(a:term) ? expand('<cword>') : a:term +endfunction() + +" Returns cleaned cWORD if search term is empty +function! s:CursorWORD(term) + " Will strip all non-alphabetic characters from both sides + return empty(a:term) ? substitute(expand('<cWORD>'), '^\A*\(.\{-}\)\A*$', '\1', '') : a:term +endfunction() + call s:InitLldbPlugin() |

