All Projects → bergercookie → vim-debugstring

bergercookie / vim-debugstring

Licence: other
Debug printf()-style at the speed of light

Programming Languages

Vim Script
2826 projects
shell
77523 projects
C++
36643 projects - #6 most used programming language
C#
18002 projects
r
7636 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to vim-debugstring

Vim Vspec
Vim plugin: Testing framework for Vim script
Stars: ✭ 207 (+590%)
Mutual labels:  vim-plugins
vim-modusline
🌈 Mode-specific statusline colors
Stars: ✭ 39 (+30%)
Mutual labels:  vim-plugins
vim-drawer
VimDrawer is a Vim plugin to group related buffers in tabs automatically by the file name.
Stars: ✭ 26 (-13.33%)
Mutual labels:  vim-plugins
Vim Racket
vim bundle for Racket
Stars: ✭ 207 (+590%)
Mutual labels:  vim-plugins
vim-searchant
searchant.vim is obsoleted by vim-searchhi
Stars: ✭ 55 (+83.33%)
Mutual labels:  vim-plugins
tmux-zsh-vim-titles
Unified terminal titles in tmux, zsh, and vim/nvim
Stars: ✭ 28 (-6.67%)
Mutual labels:  vim-plugins
Bullets.vim
🔫 Bullets.vim is a Vim/NeoVim plugin for automated bullet lists.
Stars: ✭ 199 (+563.33%)
Mutual labels:  vim-plugins
vim-phpstan
A Vim plugin for PHPStan - https://github.com/phpstan/phpstan. It calls `phpstan` to do static analysis of your PHP code and displays the errors in Vim's quickfix list.
Stars: ✭ 26 (-13.33%)
Mutual labels:  vim-plugins
vim-stylus
A better vim plugin for stylus, including proper and up-to-date syntax highligting, indentation and autocomplete
Stars: ✭ 49 (+63.33%)
Mutual labels:  vim-plugins
tabulous
Vim plugin for setting the tabline including the tab page labels. It is lightweight and written in pure Vim script.
Stars: ✭ 21 (-30%)
Mutual labels:  vim-plugins
Is.vim
incremental search improved - successor of incsearch.vim
Stars: ✭ 209 (+596.67%)
Mutual labels:  vim-plugins
Nerdtree
A tree explorer plugin for vim.
Stars: ✭ 16,380 (+54500%)
Mutual labels:  vim-plugins
vim-sass-colors
sass/scss/less/css color literal and color variable highlighting (works with imports)
Stars: ✭ 24 (-20%)
Mutual labels:  vim-plugins
Vim Anyfold
Language agnostic vim plugin for folding and motion based on indentation.
Stars: ✭ 208 (+593.33%)
Mutual labels:  vim-plugins
writable search.vim
Grep for something, then write the original files directly through the search results.
Stars: ✭ 47 (+56.67%)
Mutual labels:  vim-plugins
Vim Go
Go development plugin for Vim
Stars: ✭ 14,085 (+46850%)
Mutual labels:  vim-plugins
lh-tags
ctags base updating, and browsing from vim
Stars: ✭ 25 (-16.67%)
Mutual labels:  vim-plugins
vimapt
A package manager for vim (VimApt => Vim's Advanced Package Tools)
Stars: ✭ 16 (-46.67%)
Mutual labels:  vim-plugins
dotfiles
My hand crafted .dotfiles 🤚🛠❤️
Stars: ✭ 49 (+63.33%)
Mutual labels:  vim-plugins
ipynb notedown.vim
vim plugin for editing jupyter notebook (ipynb) files through notedown
Stars: ✭ 27 (-10%)
Mutual labels:  vim-plugins

vim-debugstring

     _      _                     _        _
    | |    | |                   | |      (_)
  __| | ___| |__  _   _  __ _ ___| |_ _ __ _ _ __   __ _
 / _` |/ _ \ '_ \| | | |/ _` / __| __| '__| | '_ \ / _` |
| (_| |  __/ |_) | |_| | (_| \__ \ |_| |  | | | | | (_| |
 \__,_|\___|_.__/ \__,_|\__, |___/\__|_|  |_|_| |_|\__, |
                         __/ |                      __/ |
                        |___/                      |___/

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

  • The form and syntax of the logging statements target the language at hand (e.g., use printf() in C/C++ but puts() in Ruby)
  • Support for debugging variable expressions e.g., the values of variables or arbitrary expressions at certain parts of your code
  • Support for : Place your cursor over the variable you want to print and press <leader>DS. It will create a debugging string for that variable
  • Support for vim-repeat. No need for repeat the same mapping, or rewrite the lengthy expression that you want to monitor, just use the . character

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.

Lang Debug String Debug Variable
Arduino ✔️ ✔️
Awk
C ✔️ ✔️
C# ✔️ ✔️
C++ ✔️ ✔️
CMake ✔️ ✔️
D
Dockerfile ✔️ ✔️
Fish-Shell ✔️ ✔️
Fortran ✔️ ✔️
Go ✔️ ✔️
Haskell ✔️ ✔️
Java ✔️ ✔️
Javascript ✔️ ✔️
Julia
Lua ✔️ ✔️
Makefile ✔️ ✔️
Matlab
PHP ✔️ ✔️
Perl
Python ✔️ ✔️
R ✔️ ✔️
Ruby ✔️ ✔️
Rust ✔️ ✔️
Scala
Shell ✔️ ✔️
Swift
Typescript ✔️ ✔️
Vim ✔️ ✔️
Visual Basic
Zsh ✔️ ✔️

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

  • Make sure that filetype plugin is enabled. A line like filetype plugin on in your .vimrc should do the job.

Installation

Plugin manager How to install
Dein call dein#add('bergercookie/vim-debugstring')
minpac call minpac#add('bergercookie/vim-debugstring')
Pathogen git clone https://github.com/bergercookie/vim-debugstring.git ~/.vim/bundle/vim-debugstring
Plug Plug 'bergercookie/vim-debugstring'
Vundle Plugin 'bergercookie/vim-debugstring'
manual copy all of the files into your .vim directory (or ~/.config/nvim if you're using neovim)

Dependencies

debugstring depends on the following vim plugins:

  • vim-repeat [OPTIONAL]

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

  • Use vimdoc to generate documentation from the vim docstring (instead of manually updating the .txt file). See the misc/build_doc for more on how this is done.

  • Use vader for unittesting. Use test/run-tests.sh to run them:

    vim -Nu test/vimrc
    :set rtp+=vader.vim/plugin
    :set rtp+=vim-repeat/autoload
    
    :Vader test/*
    

TODO

  • Method to delete all the debugging strings in current buffer / all "touched" buffers - see far.vim
  • Method to print name and contents of a variable
  • [ ]Make the counter buffer-specific Nope, we already have the filename & line for file-specific text
  • Escape double single quotes vimscript variable printing
  • Append to current line if that is empty
  • Support repeat.vim
  • Use an assertion module - vader
  • Use vader.vim for TDD
  • Extend vader support for rest of languages
  • Use travis for CI
  • Bug with changing the filename of the current file
  • Make vim-repeat dependency optional
  • Turn supported languages into a table - what do we support in which language
  • Make vim-repeat dependency optional
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].