Merge pull request #64 from ecosse3/feature/filter-current-file-cmd

feat: add LazyGitFilterCurrentFile command
This commit is contained in:
Dheepak Krishnamurthy
2022-06-14 15:07:15 -06:00
committed by GitHub
3 changed files with 21 additions and 0 deletions

View File

@@ -55,6 +55,18 @@ If the file does not exist it'll load the defaults for you.
![](https://user-images.githubusercontent.com/1813121/78830902-46721580-79d8-11ea-8809-291b346b6c42.gif)
Open project commits with `lazygit` directly from vim in floating window.
```vim
:LazyGitFilter<CR>
```
Open buffer commits with `lazygit` directly from vim in floating window.
```vim
:LazyGitFilterCurrentFile<CR>
```
**Using neovim-remote**
If you have [neovim-remote](https://github.com/mhinz/neovim-remote) and have configured to use it in neovim, it'll launch the commit editor inside your neovim instance when you use `C` inside `lazygit`.

View File

@@ -82,6 +82,12 @@ local function lazygitfilter(path)
exec_lazygit_command(cmd)
end
--- :LazyGitFilterCurrentFile entry point
local function lazygitfiltercurrentfile()
local current_file = vim.fn.expand('%')
lazygitfilter(current_file)
end
--- :LazyGitConfig entry point
local function lazygitconfig()
local os = fn.substitute(fn.system('uname'), '\n', '', '')
@@ -115,6 +121,7 @@ end
return {
lazygit = lazygit,
lazygitfilter = lazygitfilter,
lazygitfiltercurrentfile = lazygitfiltercurrentfile,
lazygitconfig = lazygitconfig,
project_root_dir = project_root_dir,
}

View File

@@ -27,6 +27,8 @@ command! LazyGit lua require'lazygit'.lazygit()
command! LazyGitFilter lua require'lazygit'.lazygitfilter()
command! LazyGitFilterCurrentFile lua require'lazygit'.lazygitfiltercurrentfile()
command! LazyGitConfig lua require'lazygit'.lazygitconfig()
""""""""""""""""""""""""""""""""""""""""""""""""""""""