{"id":25856947,"url":"https://github.com/m42e/lgh.nvim","last_synced_at":"2025-03-01T18:29:29.291Z","repository":{"id":150292822,"uuid":"471439700","full_name":"m42e/lgh.nvim","owner":"m42e","description":"lgh - local git history implemented lua","archived":false,"fork":false,"pushed_at":"2024-07-06T21:27:13.000Z","size":51,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T19:16:25.783Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lua","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/m42e.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":"2022-03-18T16:26:40.000Z","updated_at":"2024-07-06T21:27:16.000Z","dependencies_parsed_at":"2024-04-25T08:30:02.702Z","dependency_job_id":"6c09feab-1eb4-4c70-8755-978b4bc3b574","html_url":"https://github.com/m42e/lgh.nvim","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/m42e%2Flgh.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m42e%2Flgh.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m42e%2Flgh.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m42e%2Flgh.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m42e","download_url":"https://codeload.github.com/m42e/lgh.nvim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241407293,"owners_count":19958103,"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":[],"created_at":"2025-03-01T18:29:28.379Z","updated_at":"2025-03-01T18:29:29.280Z","avatar_url":"https://github.com/m42e.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# neovim Local Git History - in lua\n\n## What this plugin does\n\nThis plugin saves the file worked on in a git repository every time you save.\nIts a rewrite of https://github.com/m42e/vim-lgh in lua. So this runs only with neovim and is depending on [telescope](https://github.com/nvim-telescope/telescope.nvim).\n\nfzf-lua support has been removed\n\n## Why? Don't you know undo?\n\nYes, I do know undo, and yes I know persistent undo, too. But there are times, when you replace a file on disk, either by yourself or a git checkout or reset,\nor your evil twin deleted a file. And here undo does not help.\n\n## How to use it?\n\nInstall it, feel saver. If you want to see the history of a file type\n\n```\n:LGHistory\n```\n\nAnd then you get a telescope window with all the dates when the file has been stored.\n\n\nTo search a file in the backup files type\n\n```\n:LGHFind\n```\n\nthen select the file and the revision you wish to view.\n\n## To-dos\n\nWell, basically the same as for the old one, but it still covers the basics.\n\n- Handling of more edge use cases.\n- Handling `:q` in diffmode like fugitive does\n\n## Requirements\n\n- git\n- an operating system offering a shell (I think this excludes Windows, if someone is eager to try, e.g. with PowerShell, and it works let me know)\n\n## Installation\n\nWith [lazy.nvim](https://github.com/folke/lazy.nvim):\n\n```lua\n{\n  \"m42e/lgh.nvim\",\n  depencencies = {\n    \"nvim-telescope/telescope.nvim\",\n  },\n  config = function()\n    require(\"lgh\").setup({\n      fix_dangling = true\n    })\n  end,\n}\n```\n\n## Options\n\nYou can configure it by callling the setup function with the following options, the given value represents the default:\n\n```lua\nrequire('lgh').setup({\n  basedir = vim.fn.stdpath('data') .. '/githistory/',\n  git_cmd = 'git',\n  verbose = false,\n  fix_ownership = true,\n  diff = true,\n  new_window = 'vnew',\n  show_diff_preview = true,\n  disabled_paths = {},\n  disabled_filenames = {},\n  })\n\n```\n\n- **basedir**: The location where the history should be saved. Will be created if not existing. You can provide a **function**(options, dirname, filename) instead. This will be called and is expected to return the basepath for the backup the file. It should return the `basedir` in case dirname and filename are `nil`.\n- **git_cmd**: The git command used\n- **verbose**: If true, it will bug you with useless information :D\n- **fix_ownership**: In case you are using you nvim with `su` or `sudo` it will try to restore the original user as file owner, disabling this may cause issues with file permission in the backup folder, so make sure you know what you are doing. Additionally when running in different user mode, the git command will be executed as original user.\n- **diff**: Show history as diff. Else it will only load the history in a new buffer, without starting diff\n- **new_window**: How the new window for the history should be created. Like: `vnew`, `new` and options if you like.\n- **show_diff_preview**: In preview of previous versions show diff instead of whole file, this is only supported if telescope is used. If the file is currently not available on disk, it will fallback to displaying the stored revision.\n- **disabled_paths**: This setting allows you to define __lua patterns__ which the path of the file will be checked against. If a match is found the file will not be backed up.\n- **disabled_filenames**: This setting allows you to define __lua patterns__ which the filename of the file will be checked against. If a match is found the file will not be backed up. You can use this e.g. for files that contain sensitive information.\n\n## Inspirations\n\n- [vim-historic](https://github.com/serby/vim-historic) Which also handles a local history in git. But uses some shell script and I ~try to avoid that~ tried to avoid that. The commands ares till using the shell so Windows will not be supported but no extra shell script.\n- [vim-localhistory](https://github.com/mg979/vim-localhistory) I saw he is using fzf for handling the history files. I really liked the idea, because I thought about how to make vim-historic better but thinking of that I was afraid. vim-localhistory gave me the hint into the right direction.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm42e%2Flgh.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm42e%2Flgh.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm42e%2Flgh.nvim/lists"}