summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/nvim/lua/plugins.lua4
-rw-r--r--.config/nvim/lua/setup/fugitive.lua6
-rwxr-xr-x.local/bin/in-git-repo9
3 files changed, 18 insertions, 1 deletions
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index cf27f1f..68a0ee1 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -137,8 +137,10 @@ return require('packer').startup(function(use)
use {
"tpope/vim-fugitive",
- config = "vim.cmd [[call FugitiveDetect('~/.cfg')]]",
cmd = { 'G', 'Ggrep' },
+ config = function()
+ require "setup.fugitive"
+ end,
}
use {
diff --git a/.config/nvim/lua/setup/fugitive.lua b/.config/nvim/lua/setup/fugitive.lua
new file mode 100644
index 0000000..b48b4a9
--- /dev/null
+++ b/.config/nvim/lua/setup/fugitive.lua
@@ -0,0 +1,6 @@
+vim.cmd([[
+silent !in-git-repo
+if v:shell_error
+ call FugitiveDetect('~/.cfg')
+endif
+]])
diff --git a/.local/bin/in-git-repo b/.local/bin/in-git-repo
new file mode 100755
index 0000000..e155bc8
--- /dev/null
+++ b/.local/bin/in-git-repo
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+res=$(git rev-parse --is-inside-work-tree 2>/dev/null)
+
+if [[ $res == true ]]; then
+ exit 0
+else
+ exit 1
+fi