diff --git a/README.md b/README.md index 8e01c31..7def5b6 100644 --- a/README.md +++ b/README.md @@ -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 +``` + +Open buffer commits with `lazygit` directly from vim in floating window. + +```vim +:LazyGitFilterCurrentFile +``` + **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`. diff --git a/lua/lazygit.lua b/lua/lazygit.lua index 1e634eb..7a773a1 100644 --- a/lua/lazygit.lua +++ b/lua/lazygit.lua @@ -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, } diff --git a/plugin/lazygit.vim b/plugin/lazygit.vim index 7655ff4..2722161 100644 --- a/plugin/lazygit.vim +++ b/plugin/lazygit.vim @@ -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() """"""""""""""""""""""""""""""""""""""""""""""""""""""