Skip to content

Commit 70034ec

Browse files
committed
support environment without git
1 parent 1638b54 commit 70034ec

2 files changed

Lines changed: 37 additions & 21 deletions

File tree

plugin/03-blink.lua

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
local has_git = vim.fn.executable("git") == 1
2+
13
vim.pack.add({
24
-- optional: provides snippets for the snippet source
35
"https://github.com/rafamadriz/friendly-snippets",
@@ -18,7 +20,7 @@ vim.pack.add({
1820
},
1921
})
2022

21-
require("blink.cmp").setup({
23+
local blink_cmp_opts = {
2224
keymap = {
2325
preset = 'enter',
2426
['<C-x>'] = { 'show', 'show_documentation', 'hide_documentation' },
@@ -46,25 +48,35 @@ require("blink.cmp").setup({
4648
documentation = { auto_show = true },
4749
},
4850

49-
})
51+
}
5052

51-
require("blink.pairs").setup({
52-
mappings = {
53-
enabled = true,
54-
disabled_filetypes = {},
55-
pairs = {},
56-
},
57-
highlights = {
58-
enabled = true,
59-
groups = {
60-
"RainbowDelimiterRed",
61-
"RainbowDelimiterYellow",
62-
"RainbowDelimiterGreen",
63-
"RainbowDelimiterCyan",
64-
"RainbowDelimiterBlue",
65-
"RainbowDelimiterViolet",
66-
"RainbowDelimiterGreen",
53+
if not has_git then
54+
blink_cmp_opts.fuzzy = {
55+
implementation = "lua",
56+
}
57+
end
58+
59+
require("blink.cmp").setup(blink_cmp_opts)
60+
61+
if has_git then
62+
require("blink.pairs").setup({
63+
mappings = {
64+
enabled = true,
65+
disabled_filetypes = {},
66+
pairs = {},
6767
},
68-
},
69-
debug = false,
70-
})
68+
highlights = {
69+
enabled = true,
70+
groups = {
71+
"RainbowDelimiterRed",
72+
"RainbowDelimiterYellow",
73+
"RainbowDelimiterGreen",
74+
"RainbowDelimiterCyan",
75+
"RainbowDelimiterBlue",
76+
"RainbowDelimiterViolet",
77+
"RainbowDelimiterGreen",
78+
},
79+
},
80+
debug = false,
81+
})
82+
end

plugin/gitsigns.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if vim.fn.executable("git") == 0 then
2+
return
3+
end
4+
15
vim.pack.add({ "https://github.com/lewis6991/gitsigns.nvim" })
26

37
require("gitsigns").setup()

0 commit comments

Comments
 (0)