summaryrefslogtreecommitdiff
path: root/lua/maps/find.lua
blob: 27a7fec654584af795f7db7f9d0d58b6995f7f08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
local utility_misc = require("utility.misc")

vim.keymap.set("n", "<leader>p", function()
	if vim.fn.win_gettype() ~= "" or vim.fn.win_getid() == vim.g.term_win then
		-- Window is not a normal window or is a terminal window
		return
	end

	require("telescope.builtin").find_files()
end)

vim.keymap.set("n", "<leader>b", function ()
	if vim.fn.win_gettype() ~= "" or vim.fn.win_getid() == vim.g.term_win then
		-- Window is not a normal window or is a terminal window
		return
	end

	require("telescope.builtin").buffers()
end)

vim.keymap.set("n", "<leader>gc", function ()
	require("telescope.builtin").git_commits()
end)

vim.keymap.set("n", "<leader>gb", function()
	require("telescope.builtin").git_branches()
end)

vim.keymap.set("n", "<leader>gcl", function()
	require("telescope.builtin").conflicts()
end)

vim.keymap.set("n", "<leader>f", function()
	if vim.fn.win_gettype() ~= "" or vim.fn.win_getid() == vim.g.term_win then
		-- Window is not a normal window or is a terminal window
		return
	end

	require("telescope.builtin").live_grep()
end)

vim.keymap.set("n", "<leader>e", function()
	if vim.fn.win_gettype() ~= "" or vim.fn.win_getid() == vim.g.term_win then
		-- Window is not a normal window or is a terminal window
		return
	end

	require("telescope").extensions.file_browser.file_browser()
end)

vim.keymap.set("n", "<leader>E", function()
	if vim.fn.win_gettype() ~= "" or vim.fn.win_getid() == vim.g.term_win then
		-- Window is not a normal window or is a terminal window
		return
	end

	local curr_buf_dir = utility_misc.dir_name(vim.api.nvim_buf_get_name(0))

	require("telescope").extensions.file_browser.file_browser({
		path = curr_buf_dir
	})
end)