{"id":20779587,"url":"https://github.com/declancm/printf.nvim","last_synced_at":"2025-08-20T05:04:31.928Z","repository":{"id":232533911,"uuid":"784543367","full_name":"declancm/printf.nvim","owner":"declancm","description":"A syntax-aware print debugging statement generator for C/C++","archived":false,"fork":false,"pushed_at":"2024-04-14T00:20:49.000Z","size":583,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T02:18:42.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/declancm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-10T03:53:27.000Z","updated_at":"2024-04-15T02:34:43.921Z","dependencies_parsed_at":"2024-04-15T02:44:45.470Z","dependency_job_id":null,"html_url":"https://github.com/declancm/printf.nvim","commit_stats":null,"previous_names":["declancm/printf.nvim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/declancm/printf.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declancm%2Fprintf.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declancm%2Fprintf.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declancm%2Fprintf.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declancm%2Fprintf.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/declancm","download_url":"https://codeload.github.com/declancm/printf.nvim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declancm%2Fprintf.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271268704,"owners_count":24730023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T13:28:35.264Z","updated_at":"2025-08-20T05:04:31.881Z","avatar_url":"https://github.com/declancm.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch1\u003eprintf.nvim\u003c/h1\u003e\n    \u003ch5\u003eA smarter print debugging statement generator for C/C++\u003c/h5\u003e\n\u003c/div\u003e\n\n![printf.nvim](assets/printf_demo.gif \"print_var demo\")\n\n## Features\n\n- Generates print statements for:\n  - line numbers\n  - function names\n  - variable values\n- Syntax and context aware\n- Automatic format specifier detection\n- Customizable (see the Examples section for inspiration)\n\n## Requirements\n\n- Neovim \u003e= 0.8.0\n- A tree-sitter parser for C/C++\n- The clangd language server\n\n## Installation\n\n### lazy.nvim\n\n```lua\n{\n    'declancm/printf.nvim'\n}\n```\n\n## Usage\n\n### Lua API\n\n```lua\nrequire('printf').print_var()   -- Print the variable under the cursor\nrequire('printf').print_line()  -- Print the current line number\nrequire('printf').print_func()  -- Print the name of the enclosed function\nrequire('printf').clean()       -- Cleanup generated statements\n```\n\n### Vim Commands\n\nThe `Printf` command can be used to access the Lua API as Vim commands\n\n```viml\n:Printf print_var      \" equivalent to `:lua require('printf').print_var()`\n:Printf print_line     \" equivalent to `:lua require('printf').print_line()`\n:Printf print_func     \" equivalent to `:lua require('printf').print_func()`\n:Printf clean          \" equivalent to `:lua require('printf').clean()`\n```\n\n### Example Keymaps\n\n#### Lua\n\n```lua\nvim.keymap.set('n', '\u003cleader\u003edv', require('printf').print_var, {})\nvim.keymap.set('n', '\u003cleader\u003edl', require('printf').print_line, {})\nvim.keymap.set('n', '\u003cleader\u003edf', require('printf').print_func, {})\nvim.keymap.set('n', '\u003cleader\u003edc', require('printf').clean, {})\n```\n\n#### VimL\n\n```viml\nnnoremap \u003cleader\u003edv \u003ccmd\u003ePrintf print_var\u003ccr\u003e\nnnoremap \u003cleader\u003edl \u003ccmd\u003ePrintf print_line\u003ccr\u003e\nnnoremap \u003cleader\u003edf \u003ccmd\u003ePrintf print_func\u003ccr\u003e\nnnoremap \u003cleader\u003edc \u003ccmd\u003ePrintf clean\u003ccr\u003e\n```\n\n\u003c!-- panvimdoc-ignore-start --\u003e\n\n### Help\n\nHelp docs can be accessed with `:help printf.nvim`\n\n\u003c!-- panvimdoc-ignore-end --\u003e\n\n## Configuration\n\n```lua\nrequire('printf').setup({\n    -- Generated function call options\n    called_function = {\n        -- Name of the called function\n        name = 'printf',\n        -- Add additional arguments before the format string\n        additional_args = {},\n    },\n    -- 'print_var' specific options\n    print_var = {\n        -- Automatically dereference supported pointer types\n        dereference_pointers = false,\n        -- Format char * variables as strings\n        char_ptr_strings = true,\n    },\n    -- 'print_line' specific options\n    print_line = {\n        -- The variable/identifier/macro with the line number integer value\n        variable = '__LINE__',\n    },\n    -- 'print_func' specific options\n    print_func = {\n        -- The variable/identifier/macro with the function name string\n        variable = '__func__',\n    },\n})\n```\n\n## Examples\n\n### Minimal Neovim Config\n\n```lua\n-- Install plugins\nrequire('lazy').setup({\n    'neovim/nvim-lspconfig',\n    'declancm/printf.nvim'\n})\n\n-- Setup the clangd language server\nrequire('lspconfig').clangd.setup({})\n\n-- Setup printf\nrequire('printf').setup()\n```\n\n### Standard Error Stream\n\n**Config:**\n\n```lua\nrequire('printf').setup({\n    called_function = {\n        name = 'fprintf',\n        additional_args = { 'stderr' }\n    }\n})\n```\n\n**Output:**\n\n```c\nfprintf(stderr, \"example: %d\\n\", example); // auto-generated printf\n```\n\n### Pretty Function\n\n**Config:**\n\n```lua\nrequire('printf').setup({\n    print_func = { variable = '__PRETTY_FUNCTION__' }\n})\n```\n\n**Output:**\n\n```c\nprintf(\"function: %s\\n\", __PRETTY_FUNCTION__); // auto-generated printf\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeclancm%2Fprintf.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeclancm%2Fprintf.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeclancm%2Fprintf.nvim/lists"}