39

GitHub - meain/vim-printer: Quickly print/log the variable in your favourite lan...

 4 years ago
source link: https://github.com/meain/vim-printer
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

vim-printer

68747470733a2f2f692e696d6775722e636f6d2f397074784f34632e676966

Quickly print/log the variable in your favourite language

Installation

Use your favourite plugin manager to install. I use vim-plug.

Plug 'meain/vim-printer'

Usage

There is two keybinding in each normal mode and visual mode. In normal mode it works on current word under cursor and in visual mode it works on the visual selection.

  • <leader>p to add print/log statement below current line
  • <leader>P to add print/log statement above current line

Configuration

You can change the default keybindings like below. It will be used both in normal mode and visual mode.

let g:vim_printer_print_below_keybinding = '<leader>p'
let g:vim_printer_print_above_keybinding = '<leader>P'

You can add new languages or override existing by using:

The text inside {$} will be replaced by the variable

let g:vim_printer_items = {
      \ 'javascript': 'console.log("{$}:", {$})',
      \ }

Future TODO

  • add some kind of debug mode print eg: logging.log() in python or println!('{:?}', var) in rust

Alternatives


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK