Home

Awesome

vim-debugstring

<p align="center"> <a href="https://travis-ci.org/bergercookie/vim-debugstring" alt="Build Status"> <img src="https://travis-ci.org/bergercookie/vim-debugstring.svg?branch=master" /></a> </p>
     _      _                     _        _
    | |    | |                   | |      (_)
  __| | ___| |__  _   _  __ _ ___| |_ _ __ _ _ __   __ _
 / _` |/ _ \ '_ \| | | |/ _` / __| __| '__| | '_ \ / _` |
| (_| |  __/ |_) | |_| | (_| \__ \ |_| |  | | | | | (_| |
 \__,_|\___|_.__/ \__,_|\__, |___/\__|_|  |_|_| |_|\__, |
                         __/ |                      __/ |
                        |___/                      |___/

Purpose

debugstring aims to automate standard debugging operations (e.g., segfaults). It does that by facilitating the ubiquitous printf()-debugging i.e., scatter logging statements around the various code snippets that you want to test.

Demos

Presentation at Vim-London

Finding a segfault

demo_gif

Control flow

demo_gif2

Expression evaluation

demo_gif3

Features

Currently the following languages are supported. First column corresponds to the standard debugging string while the second to the case of debugging for a specific variable.

LangDebug StringDebug Variable
Arduino:heavy_check_mark::heavy_check_mark:
Awk:x::x:
C:heavy_check_mark::heavy_check_mark:
C#:heavy_check_mark::heavy_check_mark:
C++:heavy_check_mark::heavy_check_mark:
CMake:heavy_check_mark::heavy_check_mark:
D:x::x:
Dockerfile:heavy_check_mark::heavy_check_mark:
Fish-Shell:heavy_check_mark::heavy_check_mark:
Fortran:heavy_check_mark::heavy_check_mark:
Go:heavy_check_mark::heavy_check_mark:
Haskell:heavy_check_mark::heavy_check_mark:
Java:heavy_check_mark::heavy_check_mark:
Javascript:heavy_check_mark::heavy_check_mark:
Julia:x::x:
Lua:heavy_check_mark::heavy_check_mark:
Makefile:heavy_check_mark::heavy_check_mark:
Matlab:x::x:
PHP:heavy_check_mark::heavy_check_mark:
Perl:x::x:
Python:heavy_check_mark::heavy_check_mark:
R:heavy_check_mark::heavy_check_mark:
Ruby:heavy_check_mark::heavy_check_mark:
Rust:heavy_check_mark::heavy_check_mark:
Scala:x::x:
Shell:heavy_check_mark::heavy_check_mark:
Swift:x::x:
Typescript:heavy_check_mark::heavy_check_mark:
Vim:heavy_check_mark::heavy_check_mark:
Visual Basic:x::x:
Zsh:heavy_check_mark::heavy_check_mark:

For a more detailed description of debugstring check doc/debugstring.txt

Usage

Use the mappings of your choice to place unique logging directives during debugging times.

nnoremap <your-key-combination> <Plug>DumpDebugString
nnoremap <a-second-key-combination> <Plug>DumpDebugStringExpr
nnoremap <a-third-key-combination> <Plug>DumpDebugStringCexpr

Default mappings are: <Leader>ds, <Leader>dS, <Leader>DS respectively.

An example of using it in a C++ file is given below:

// Debug String
std::cout << "[a.c:4] DEBUGGING STRING ==> " << 0 << std::endl;

// Debug Variable
std::cout << "[a.c:4] a_variable: " << a_variable << std::endl;

Remarks - Debugging

Installation

Plugin managerHow to install
Deincall dein#add('bergercookie/vim-debugstring')
minpaccall minpac#add('bergercookie/vim-debugstring')
Pathogengit clone https://github.com/bergercookie/vim-debugstring.git ~/.vim/bundle/vim-debugstring
PlugPlug 'bergercookie/vim-debugstring'
VundlePlugin 'bergercookie/vim-debugstring'
manualcopy all of the files into your .vim directory (or ~/.config/nvim if you're using neovim)

Dependencies

debugstring depends on the following vim plugins:

Contributing

In case you want to contribute on a certain feature/fix, don't hesitate to discuss about it in the Github issues or to implement it and make a PR.

License

Current plugin is distributed under the same terms as Vim itself. See the LICENSE file

Self Promotion

In case you like the plugin, you might as well star it on Github or rate it on vim.org Also feel free to check my other plugins

Notes on Development

This mostly comprises a list of stuff I want to keep track of when developing this or other vim plugins

TODO