-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathtelescope.nix
241 lines (235 loc) · 6.46 KB
/
telescope.nix
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
# │ SHAMELESSLY STOLEN FROM │
# │ https://github.com/khaneliman/khanelivim/blob/058274a310e20e74f7bd274c3f2d2af13a189a04/packages/khanelivim/plugins/telescope.nix#L33 │
# ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
{
config,
lib,
pkgs,
...
}:
{
extraPackages = with pkgs; [ ripgrep ];
keymaps = lib.mkIf config.plugins.telescope.enable [
{
mode = "n";
key = "<leader>fF";
action.__raw = ''
function()
require("telescope.builtin").find_files({ hidden = true, no_ignore = true})
end
'';
options = {
desc = "Find all files";
silent = true;
};
}
{
mode = "n";
key = "<leader>fW";
action.__raw = ''
function()
require("telescope.builtin").live_grep {
additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end,
}
end
'';
options = {
desc = "Find words in all files";
silent = true;
};
}
{
mode = "n";
key = "<leader>f?";
action.__raw = ''
function()
require("telescope.builtin").live_grep { grep_open_files=true }
end
'';
options = {
desc = "Find words in all open buffers";
silent = true;
};
}
(lib.mkIf config.plugins.telescope.extensions.undo.enable {
mode = "n";
key = "<leader>fu";
action = "<cmd>Telescope undo<CR>";
options = {
desc = "List undo history";
};
})
(lib.mkIf config.plugins.telescope.extensions.live-grep-args.enable {
mode = "n";
key = "<leader>fw";
action = "<cmd>Telescope live_grep_args<CR>";
options = {
desc = "Live grep (args)";
};
})
];
plugins.telescope = {
enable = false;
# extensions = {
# file-browser = {
# enable = true;
# settings = {
# hidden = true;
# };
# };
#
# frecency = {
# # FIXME: super slow loading
# # enable = true;
# settings = {
# auto_validate = false;
# };
# };
#
# fzf-native = {
# enable = true;
# };
#
# live-grep-args.enable = true;
#
# ui-select = {
# enable = true;
# settings = {
# __unkeyed.__raw = ''require("telescope.themes").get_dropdown{}'';
# };
# };
#
# undo = {
# enable = true;
# settings = {
# side_by_side = true;
# layout_strategy = "vertical";
# layout_config = {
# preview_height = 0.8;
# };
# };
# };
# };
keymaps = {
"<leader>f'" = {
action = "marks";
options.desc = "View marks";
};
"<leader>f/" = {
action = "current_buffer_fuzzy_find";
options.desc = "Fuzzy find in current buffer";
};
"<leader>f<CR>" = {
action = "resume";
options.desc = "Resume action";
};
"<leader>fa" = {
action = "autocommands";
options.desc = "View autocommands";
};
"<leader>fC" = {
action = "commands";
options.desc = "View commands";
};
"<leader>fb" = {
action = "buffers";
options.desc = "View buffers";
};
"<leader>fc" = {
action = "grep_string";
options.desc = "Grep string";
};
"<leader>fd" = {
action = "diagnostics";
options.desc = "View diagnostics";
};
"<leader>ff" = {
action = "find_files";
options.desc = "Find files";
};
"<leader><leader>" = {
action = "find_files";
options.desc = "Find files";
};
"<leader>fh" = {
action = "help_tags";
options.desc = "View help tags";
};
"<leader>fm" = {
action = "man_pages";
options.desc = "View man pages";
};
"<leader>fo" = {
action = "oldfiles";
options.desc = "View old files";
};
"<leader>fr" = {
action = "registers";
options.desc = "View registers";
};
"<leader>fs" = {
action = "lsp_document_symbols";
options.desc = "Search symbols";
};
"<leader>fq" = {
action = "quickfix";
options.desc = "Search quickfix";
};
"<leader>gB" = {
action = "git_branches";
options.desc = "View git branches";
};
"<leader>gC" = {
action = "git_commits";
options.desc = "View git commits";
};
"<leader>gs" = {
action = "git_status";
options.desc = "View git status";
};
"<leader>gS" = {
action = "git_stash";
options.desc = "View git stashes";
};
};
settings = {
defaults = {
vimgrep_arguments = [
"${pkgs.ripgrep}/bin/rg"
"-L"
"--color=never"
"--no-heading"
"--with-filename"
"--line-number"
"--column"
"--smart-case"
"--fixed-strings"
];
selection_caret = " ";
entry_prefix = " ";
layout_strategy = "flex";
layout_config = {
horizontal = {
prompt_position = "top";
};
};
sorting_strategy = "ascending";
file_ignore_patterns = [
"^.git/"
"^.mypy_cache/"
"^__pycache__/"
"^output/"
"^data/"
"%.ipynb"
];
set_env.COLORTERM = "truecolor";
};
pickers = {
colorscheme = {
enable_preview = true;
};
};
};
};
}