{"id":13594134,"url":"https://github.com/ojroques/nvim-osc52","last_synced_at":"2025-04-05T17:08:44.623Z","repository":{"id":45920004,"uuid":"514506960","full_name":"ojroques/nvim-osc52","owner":"ojroques","description":"A Neovim plugin to copy text through SSH with OSC52","archived":false,"fork":false,"pushed_at":"2024-05-24T14:24:15.000Z","size":27,"stargazers_count":377,"open_issues_count":3,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-04T11:47:46.598Z","etag":null,"topics":["nvim-plugin","osc52"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ojroques.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":"2022-07-16T07:14:58.000Z","updated_at":"2025-03-21T15:06:22.000Z","dependencies_parsed_at":"2023-11-12T14:41:40.016Z","dependency_job_id":"9be0573d-f7ad-41e8-9349-3e7179a0950e","html_url":"https://github.com/ojroques/nvim-osc52","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojroques%2Fnvim-osc52","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojroques%2Fnvim-osc52/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojroques%2Fnvim-osc52/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojroques%2Fnvim-osc52/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ojroques","download_url":"https://codeload.github.com/ojroques/nvim-osc52/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369952,"owners_count":20927928,"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":["nvim-plugin","osc52"],"created_at":"2024-08-01T16:01:29.146Z","updated_at":"2025-04-05T17:08:44.606Z","avatar_url":"https://github.com/ojroques.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# nvim-osc52\n\n**Note**: As of Neovim 10.0 (specifically since [this\nPR](https://github.com/neovim/neovim/pull/25872)), native support for OSC52 has\nbeen added and therefore this plugin is now obsolete. Check `:h clipboard-osc52`\nfor more details.\n\nA Neovim plugin to copy text to the system clipboard using the ANSI OSC52\nsequence.\n\nThe plugin wraps a piece of text inside an OSC52 sequence and writes it to\nNeovim's stderr. When your terminal detects the OSC52 sequence, it will copy the\ntext into the system clipboard.\n\nThis is totally location-independent, you can copy text from anywhere including\nfrom remote SSH sessions. The only requirement is that your terminal must\nsupport OSC52 which is the case for most modern terminal emulators.\n\nnvim-osc52 is a rewrite of\n[vim-oscyank](https://github.com/ojroques/vim-oscyank) in Lua.\n\n## Installation\nWith [packer.nvim](https://github.com/wbthomason/packer.nvim) for instance:\n```lua\nuse {'ojroques/nvim-osc52'}\n```\n\n### Configuration for tmux\n\nIf you are using tmux, run these steps first: [enabling OSC52 in\ntmux](https://github.com/tmux/tmux/wiki/Clipboard#quick-summary).\n\nThen, you can use the tmux option `set-clipboard on` or `allow-passthrough on`.\n\nFor tmux versions before 3.3a, you will need to use the `set-clipboard` option:\n`set -s set-clipboard on`\n\nFor tmux versions starting with 3.3a, you can configure tmux to allow passthrough\nof escape sequences (`set -g allow-passthrough on`). With this option you can leave\n`set-clipboard` to its default (`external`).\nThe allow-passthrough option works well for nested tmux sessions or when running\ntmux on both the local and remote servers. When using allow-passthrough, be sure\nto enable `tmux_passthrough` for this plugin.\n\n## Usage\nAdd this to your config (assuming Neovim 0.7+):\n```lua\nvim.keymap.set('n', '\u003cleader\u003ec', require('osc52').copy_operator, {expr = true})\nvim.keymap.set('n', '\u003cleader\u003ecc', '\u003cleader\u003ec_', {remap = true})\nvim.keymap.set('v', '\u003cleader\u003ec', require('osc52').copy_visual)\n```\n\nUsing these mappings:\n* In normal mode, \u003ckbd\u003e\\\u003cleader\\\u003ec\u003c/kbd\u003e is an operator that will copy the given\n  text to the clipboard.\n* In normal mode, \u003ckbd\u003e\\\u003cleader\\\u003ecc\u003c/kbd\u003e will copy the current line.\n* In visual mode, \u003ckbd\u003e\\\u003cleader\\\u003ec\u003c/kbd\u003e will copy the current selection.\n\n## Configuration\nThe available options with their default values are:\n```lua\nrequire('osc52').setup {\n  max_length = 0,           -- Maximum length of selection (0 for no limit)\n  silent = false,           -- Disable message on successful copy\n  trim = false,             -- Trim surrounding whitespaces before copy\n  tmux_passthrough = false, -- Use tmux passthrough (requires tmux: set -g allow-passthrough on)\n}\n```\n\n## Advanced usage\nThe following methods are also available:\n* `require('osc52').copy(text)`: copy text `text`\n* `require('osc52').copy_register(register)`: copy text from register `register`\n\nFor instance, to automatically copy text that was yanked into register `+`:\n```lua\nfunction copy()\n  if vim.v.event.operator == 'y' and vim.v.event.regname == '+' then\n    require('osc52').copy_register('+')\n  end\nend\n\nvim.api.nvim_create_autocmd('TextYankPost', {callback = copy})\n```\n\n## Using nvim-osc52 as clipboard provider\nYou can use the plugin as your clipboard provider, see `:h provider-clipboard`\nfor more details. Simply add these lines to your config:\n```lua\nlocal function copy(lines, _)\n  require('osc52').copy(table.concat(lines, '\\n'))\nend\n\nlocal function paste()\n  return {vim.fn.split(vim.fn.getreg(''), '\\n'), vim.fn.getregtype('')}\nend\n\nvim.g.clipboard = {\n  name = 'osc52',\n  copy = {['+'] = copy, ['*'] = copy},\n  paste = {['+'] = paste, ['*'] = paste},\n}\n\n-- Now the '+' register will copy to system clipboard using OSC52\nvim.keymap.set('n', '\u003cleader\u003ec', '\"+y')\nvim.keymap.set('n', '\u003cleader\u003ecc', '\"+yy')\n```\n\nNote that if you set your clipboard provider like the example above, copying\ntext from outside Neovim and pasting with \u003ckbd\u003ep\u003c/kbd\u003e won't work. But you can\nstill use the paste shortcut of your terminal emulator (usually\n\u003ckbd\u003ectrl+shift+v\u003c/kbd\u003e).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fojroques%2Fnvim-osc52","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fojroques%2Fnvim-osc52","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fojroques%2Fnvim-osc52/lists"}