This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 107
/
init.lua
199 lines (189 loc) · 5.68 KB
/
init.lua
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
local telescope = {}
telescope.settings = {
defaults = {
find_command = {
"rg",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "descending",
layout_strategy = "horizontal",
prompt_prefix = " ",
layout_config = {
width = 0.75,
preview_cutoff = 120,
prompt_position = "bottom",
vertical = { mirror = false },
horizontal = {
mirror = false,
preview_width = 0.6,
},
},
file_ignore_patterns = { "^%.git/", "^node_modules/", "^__pycache__/" },
winblend = 0,
scroll_strategy = "cycle",
border = {},
borderchars = {
"─",
"│",
"─",
"│",
"╭",
"╮",
"╯",
"╰",
},
color_devicons = true,
use_less = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
},
extensions = { "mapper" },
}
telescope.packages = {
["telescope.nvim"] = {
"nvim-telescope/telescope.nvim",
commit = "1ba7278cf08da8048e7f589ef6b65a39fd3e4dbf",
cmd = "Telescope",
lazy = true,
},
["telescope-file-browser.nvim"] = {
"nvim-telescope/telescope-file-browser.nvim",
commit = "304508fb7bea78e3c0eeddd88c4837501e403ae8",
cmd = "Telescope browse_files",
keys = "<leader>.",
dependencies = {"nvim-telescope/telescope.nvim"},
-- after = "telescope.nvim",
lazy = true,
},
}
telescope.configs = {}
telescope.configs["telescope.nvim"] = function()
local telescope_package = require("telescope")
local actions = require("telescope.actions")
telescope_package.setup(vim.tbl_deep_extend("force", {
defaults = {
file_sorter = require("telescope.sorters").get_fuzzy_file,
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
-- ["<CR>"] = actions.select_default + actions.center, -- Currently breaks telescope-file-browser
},
n = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
},
},
},
}, doom.features.telescope.settings))
for _, ext in ipairs(doom.features.telescope.settings.extensions) do
telescope_package.load_extension(ext)
end
end
telescope.configs["telescope-file-browser.nvim"] = function()
require("telescope").load_extension("file_browser")
end
telescope.binds = function()
local utils = require("doom.utils")
local is_module_enabled = utils.is_module_enabled
local binds = {
"<leader>",
name = "+prefix",
{
{
"`",
function()
vim.cmd(("Telescope find_files cwd=%s"):format(vim.fn.getcwd()))
end,
name = "Browse cwd",
},
{ ".", "<cmd>Telescope file_browser<CR>", name = "Browse project" },
{ ",", "<cmd>Telescope buffers<CR>", name = "Search buffers" },
{ "/", "<cmd>Telescope live_grep<CR>", name = "Search text" },
{ ":", "<cmd>Telescope command_history<CR>", name = "Search recent commands" },
{
"b",
name = "+buffer",
{
{ "f", "<cmd>Telescope buffers show_all_buffers=true<CR>", name = "Find from all" },
{ "s", "<cmd>Telescope current_buffer_fuzzy_find<CR>", name = "Search text" },
},
},
{
"f",
name = "+file",
{
{ "f", "<cmd>Telescope find_files<CR>", name = "Find in project" },
{ "r", "<cmd>Telescope oldfiles<CR>", name = "Find recent" },
},
},
{
"h",
name = "+help",
{
{ "t", "<cmd>Telescope help_tags<CR>", name = "Find tags" },
{ "k", "<cmd>Telescope mapper<CR>", name = "Open keybindings" },
},
},
{
"g",
name = "+git",
{
{ "S", "<cmd>Telescope git_status<CR>", name = "Status" },
{ "B", "<cmd>Telescope git_branches<CR>", name = "Branches" },
{ "c", "<cmd>Telescope git_commits<CR>", name = "Commits" },
},
},
{
"s",
name = "+search",
{
{ "r", "<cmd>Telescope resume<CR>", name = "Resume previous search" },
{ "t", "<cmd>Telescope live_grep<CR>", name = "Search text" },
{ "b", "<cmd>Telescope current_buffer_fuzzy_find<CR>", name = "Text in buffer" },
{ "h", "<cmd>Telescope command_history<CR>", name = "Recent commands" },
{ "m", "<cmd>Telescope marks<CR>", name = "Marks" },
},
},
{
"t",
name = "+tweak",
{
{
"C",
"<cmd>Telescope colorscheme enable_preview=true<CR>",
name = "Switch colorscheme",
},
},
},
},
}
if is_module_enabled("features", "lsp") then
table.insert(binds[2], {
{
"c",
name = "+code",
{
{ "s", "<cmd>Telescope lsp_document_symbols<CR>", name = "Lsp symbols", remap = true },
},
},
})
end
return binds
end
telescope.autocmds = {
{ "User", "TelescopePreviewerLoaded", "setlocal wrap" },
}
return telescope