Skip to content

Commit 9094241

Browse files
committed
replace telescope by snacks
1 parent 694b6df commit 9094241

File tree

4 files changed

+140
-70
lines changed

4 files changed

+140
-70
lines changed

lazy-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
44
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
55
"gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" },
6-
"lazy.nvim": { "branch": "main", "commit": "59334064f8604ca073791c25dcc5c9698865406e" },
6+
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
77
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
8+
"mason-lspconfig.nvim": { "branch": "main", "commit": "6bdb14f230de0904229ec367b410fb817e59b072" },
89
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
910
"mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" },
11+
"nvim-lspconfig": { "branch": "master", "commit": "cc2f5f2fa28d240574808e78847978ed6ef20d2a" },
1012
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
1113
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
12-
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
1314
"rustaceanvim": { "branch": "master", "commit": "12504405821c05874d2d1f6b5ec919f9808e2c99" },
14-
"snacks.nvim": { "branch": "main", "commit": "bfe8c26dbd83f7c4fbc222787552e29b4eccfcc0" },
15-
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
15+
"snacks.nvim": { "branch": "main", "commit": "dae80fb393f712bd7352a20f9185f5e16b69f20f" },
1616
"tokyonight": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" }
1717
}

lua/plugins/lsp_config.lua

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
local setup = { "neovim/nvim-lspconfig" }
2+
3+
setup.dependencies = {
4+
"williamboman/mason.nvim",
5+
"williamboman/mason-lspconfig.nvim",
6+
"saghen/blink.cmp",
7+
}
8+
9+
function setup.config(_)
10+
-- local mason_lspconfig = require "mason-lspconfig"
11+
-- local lspconfig = require "lspconfig"
12+
-- local blink = require "blink.cmp"
13+
14+
-- mason_lspconfig.setup_handlers {
15+
-- -- The first entry (without a key) will be the default handler
16+
-- -- and will be called for each installed server that doesn't have
17+
-- -- a dedicated handler.
18+
-- function(server_name, config) -- default handler (optional)
19+
-- lspconfig[server_name].setup {
20+
-- flags = {
21+
-- debounce_text_changes = 150,
22+
-- },
23+
-- capabilities = blink.get_lsp_capabilities(),
24+
-- }
25+
-- end,
26+
-- ["ts_ls"] = function()
27+
-- lspconfig.ts_ls.setup {
28+
-- on_attach = function(client, _)
29+
-- client.server_capabilities.documentformattingprovider = false
30+
-- client.server_capabilities.documentrangeformattingprovider = false
31+
-- end,
32+
-- }
33+
-- end,
34+
-- }
35+
require("mason").setup()
36+
require("mason-lspconfig").setup({
37+
ensure_installed = { "lua_ls", "ty" },
38+
})
39+
40+
local lspconfig = require('lspconfig')
41+
local capabilities = require("blink.cmp").get_lsp_capabilities()
42+
43+
-- require('mason-lspconfig').setup_handlers {
44+
-- -- The first entry (without a key) will be the default handler.
45+
-- -- This will be called for all servers that are not handled by a specific handler.
46+
-- function (server_name)
47+
-- lspconfig[server_name].setup {
48+
-- capabilities = capabilities
49+
-- -- Add other common server configurations here
50+
-- }
51+
-- end,
52+
-- -- Specific handlers for certain servers
53+
-- ["lua_ls"] = function ()
54+
-- lspconfig.lua_ls.setup {
55+
-- capabilities = capabilities,
56+
-- settings = {
57+
-- Lua = {
58+
-- diagnostics = {
59+
-- globals = {'vim'},
60+
-- },
61+
-- },
62+
-- },
63+
-- }
64+
-- end,
65+
-- -- ... other custom server setups
66+
-- }
67+
end
68+
69+
return setup

lua/plugins/snacks.lua

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ setup.opts = {
2727
},
2828
git = { enabled = true },
2929
lazygit = { enabled = true },
30+
words = { enabled = true },
3031
}
3132

3233
setup.keys = {
34+
-- buffers
3335
{
3436
"gc",
3537
function()
@@ -44,6 +46,7 @@ setup.keys = {
4446
end,
4547
desc = "Delete all but the current buffer",
4648
},
49+
-- terminal
4750
{
4851
"<C-t>",
4952
function()
@@ -52,6 +55,15 @@ setup.keys = {
5255
mode = { "n", "i", "t" },
5356
desc = "Toggle terminal",
5457
},
58+
{
59+
"<space>tn",
60+
function()
61+
Snacks.terminal.open()
62+
end,
63+
mode = { "n", "i", "t" },
64+
desc = "Toggle terminal",
65+
},
66+
-- lazy git
5567
{
5668
"<space>l",
5769
function()
@@ -68,6 +80,48 @@ setup.keys = {
6880
mode = { "n" },
6981
desc = "Lazygit",
7082
},
83+
-- files
84+
{
85+
"<space><space>",
86+
function()
87+
Snacks.picker.files()
88+
end,
89+
mode = { "n" },
90+
desc = "Search in files",
91+
},
92+
{
93+
"<space>b",
94+
function()
95+
Snacks.picker.buffers()
96+
end,
97+
mode = { "n" },
98+
desc = "Search in buffers",
99+
},
100+
{
101+
"<space>a",
102+
function()
103+
Snacks.picker.grep()
104+
end,
105+
mode = { "n" },
106+
desc = "Grep",
107+
},
108+
-- LSP
109+
{
110+
"gd",
111+
function()
112+
Snacks.picker.lsp_definitions()
113+
end,
114+
mode = { "n" },
115+
desc = "LSP definitions",
116+
},
117+
{
118+
"gr",
119+
function()
120+
Snacks.picker.lsp_references()
121+
end,
122+
mode = { "n" },
123+
desc = "Picker files",
124+
},
71125
}
72126

73127
setup.config = function()
@@ -78,12 +132,23 @@ setup.config = function()
78132
id = "lsp_progress",
79133
title = "LSP Progress",
80134
opts = function(notif)
81-
notif.icon = ev.data.params.value.kind == "end" and ""
82-
or spinner[math.floor(vim.uv.hrtime() / (1e6 * 80)) % #spinner + 1]
135+
notif.icon = ev.data.params.value.kin== "end" and ""
136+
or spinner[math.floor(vim.uv.hrtime() / (1e6 * 80)) % #spinner + 1]
83137
end,
84138
})
85139
end,
86140
})
87141
end
88142

143+
setup.init = function()
144+
vim.api.nvim_create_autocmd("User", {
145+
pattern = "VeryLazy",
146+
callback = function()
147+
vim._print = function(_, ...)
148+
Snacks.debug.inspect(...)
149+
end
150+
end,
151+
})
152+
end
153+
89154
return setup

lua/plugins/telescope.lua

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)