{"id":18999086,"url":"https://github.com/crossr/vim-code-notes","last_synced_at":"2025-06-30T08:07:14.067Z","repository":{"id":139441727,"uuid":"257715953","full_name":"CrossR/vim-code-notes","owner":"CrossR","description":"A simple way to take notes on code in (neo)vim.","archived":false,"fork":false,"pushed_at":"2020-04-23T23:30:24.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-30T08:07:12.388Z","etag":null,"topics":["notes","vim","wiki"],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CrossR.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,"publiccode":null,"codemeta":null}},"created_at":"2020-04-21T21:07:14.000Z","updated_at":"2020-04-23T23:30:26.000Z","dependencies_parsed_at":"2023-04-03T22:16:33.421Z","dependency_job_id":null,"html_url":"https://github.com/CrossR/vim-code-notes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CrossR/vim-code-notes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fvim-code-notes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fvim-code-notes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fvim-code-notes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fvim-code-notes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CrossR","download_url":"https://codeload.github.com/CrossR/vim-code-notes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrossR%2Fvim-code-notes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262736603,"owners_count":23356147,"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","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":["notes","vim","wiki"],"created_at":"2024-11-08T17:49:16.771Z","updated_at":"2025-06-30T08:07:14.045Z","avatar_url":"https://github.com/CrossR.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vim-code-notes\n\nA simple way to take notes on code in (neo)vim.\n\n### Usage\n\nOnce installed, set the `g:code_notes#notes_root` variable first (see below).\nThis pairs best with a wiki plugin, like `lervag/wiki.vim`. I run this with my\n`notes_root`, set to a subdirectory of my main wiki.\n\n`:CodeNote` or `\u003cleader\u003ecn` without a visual selection will open a new file for the\ncurrent file. This will open a vertical split for notes on the current file.\n\n`:CodeNoteVisual` or `\u003cleader\u003ecn` with a visual selection, will take the current visual\nselection and produce a note file with that selection (or append it to the existing\nfile).\n\nBy default, we assume Markdown, so new files are created with markdown headers, and\nvisual selections are added to code fences. This can be changed, as outlined below.\n\nMappings can be changed, as outlined below.\n\nA helper function (`code_notes#check_for_note`) exists to help setup lightline, or any\nother status bar plugins or similar.\n\n### Installation\n\nCan be installed with `vim-plug` or any other similar package manager with:\n\n```vim\nPlug 'CrossR/vim-code-notes'\n```\n\n### Config Options\n\n```vim\n\" Where notes should be stored.\n\"\n\" Defaults to empty and MUST be set.\nlet g:code_notes#notes_root = \"~/git/wiki/docs/code\"\n\n\" Extension to be used for each note file.\n\" Effectively lets the filetype be picked.\n\"\n\" Defaults to \".md\"\nlet g:code_notes#note_ext = \".md\"\n\n\" List of folders to look for in the root of a project.\n\" Will be looked for in turn.\n\"\n\" Defaults to [\".git\"]\nlet g:code_notes#root_dirs = [\".git\"]\n\n\" Function to be called that will transform a file path\n\" into a path to be used for the note.\n\"\n\" Should be a function that takes one argument, the repo relative path.\n\" For a file like '~/git/vim-code-notes/plugin/code_notes.vim'\n\" The argument given is 'plugin/code_notes.vim'\n\" Any remaining '/' left in the path will be treated as folders,\n\" and created.\n\" Returns a string, for the notes path.\n\"\n\" Defaults to swapping all '/' -\u003e '_'.\nfunction! CodeNotePathFormat(repo_relative_path) abort\n    return substitute(a:repo_relative_path, \"/\", \"_\", \"g\")\nendfunction\n\nlet g:code_notes#note_name_format = \"CodeNotePathFormat\"\n\n\" Function to be called on file creation.\n\"\n\" Should be a function that takes one argument, the repo relative\n\" path. Returns a list of strings for each line to be added to the new\n\" file.\n\"\n\" Defaults to `# repo/relative_path.cpp` and a new line.\nfunction! CodeNoteTemplate(file_name) abort\n    return [\"# \" . a:file_name, \"\"]\nendfunction\n\nlet g:code_notes#note_template = \"CodeNoteTemplate\"\n\n\" Function to be called that will format a visual selection.\n\"\n\" Should be a function that takes one argument, the list of visual selected lines.\n\" Returns a list of strings, for each of the lines to be inserted.\n\"\n\" Defaults to making a code fenced block of markdown, with the language included,\n\" based on the `filetype`.\nfunction! CodeNoteVisualSelection(lines) abort\n    let l:langage = \u0026ft\n    return [\"\", \"```\" . l:langage] + a:lines + [\"```\", \"\"]\nendfunction\n\nlet g:code_notes#format_selection = \"CodeNoteVisualSelection\"\n```\n\n### Custom Binds\n\n```vim\n\" Remap the follow function with the following.\n\" Replace \u003cleader\u003ecn to swap the bind.\n\" cn -\u003e Code note\nnmap \u003csilent\u003e\u003cbuffer\u003e \u003cleader\u003ecn \u003cPlug\u003eOpenNotesForFile\nvmap \u003csilent\u003e\u003cbuffer\u003e \u003cleader\u003ecn \u003cPlug\u003eOpenNotesForFileVisual\n```\n\n### TODO\n\nFollow ups, assuming its useful:\n\n - Index file, to contain the full table of contents of the notes.\n - Move command, for when `repo/a/b/c.cpp` moves to `repo/d/e/c.cpp`, relocate or link\n     files.\n - More complex templates for notes files.\n - Parsing of certain sections for certain things. I.e. a `# TODO` section.\n    -  That could be parsed out to be apart of the lightline support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossr%2Fvim-code-notes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrossr%2Fvim-code-notes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossr%2Fvim-code-notes/lists"}