Skip to content

Commit b6c8863

Browse files
committed
add snack
1 parent 2776e0b commit b6c8863

File tree

7 files changed

+55
-142
lines changed

7 files changed

+55
-142
lines changed

init.lua

Lines changed: 1 addition & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -285,110 +285,6 @@ require('lazy').setup({
285285
--
286286
-- Use the `dependencies` key to specify the dependencies of a particular plugin
287287

288-
{ -- Fuzzy Finder (files, lsp, etc)
289-
'nvim-telescope/telescope.nvim',
290-
event = 'VimEnter',
291-
dependencies = {
292-
'nvim-lua/plenary.nvim',
293-
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
294-
'nvim-telescope/telescope-fzf-native.nvim',
295-
296-
-- `build` is used to run some command when the plugin is installed/updated.
297-
-- This is only run then, not every time Neovim starts up.
298-
build = 'make',
299-
300-
-- `cond` is a condition used to determine whether this plugin should be
301-
-- installed and loaded.
302-
cond = function()
303-
return vim.fn.executable 'make' == 1
304-
end,
305-
},
306-
{ 'nvim-telescope/telescope-ui-select.nvim' },
307-
308-
-- Useful for getting pretty icons, but requires a Nerd Font.
309-
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
310-
},
311-
config = function()
312-
-- Telescope is a fuzzy finder that comes with a lot of different things that
313-
-- it can fuzzy find! It's more than just a "file finder", it can search
314-
-- many different aspects of Neovim, your workspace, LSP, and more!
315-
--
316-
-- The easiest way to use Telescope, is to start by doing something like:
317-
-- :Telescope help_tags
318-
--
319-
-- After running this command, a window will open up and you're able to
320-
-- type in the prompt window. You'll see a list of `help_tags` options and
321-
-- a corresponding preview of the help.
322-
--
323-
-- Two important keymaps to use while in Telescope are:
324-
-- - Insert mode: <c-/>
325-
-- - Normal mode: ?
326-
--
327-
-- This opens a window that shows you all of the keymaps for the current
328-
-- Telescope picker. This is really useful to discover what Telescope can
329-
-- do as well as how to actually do it!
330-
331-
-- [[ Configure Telescope ]]
332-
-- See `:help telescope` and `:help telescope.setup()`
333-
require('telescope').setup {
334-
-- You can put your default mappings / updates / etc. in here
335-
-- All the info you're looking for is in `:help telescope.setup()`
336-
--
337-
-- defaults = {
338-
-- mappings = {
339-
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
340-
-- },
341-
-- },
342-
-- pickers = {}
343-
extensions = {
344-
['ui-select'] = {
345-
require('telescope.themes').get_dropdown(),
346-
},
347-
},
348-
}
349-
350-
-- Enable Telescope extensions if they are installed
351-
pcall(require('telescope').load_extension, 'fzf')
352-
pcall(require('telescope').load_extension, 'ui-select')
353-
354-
-- See `:help telescope.builtin`
355-
local builtin = require 'telescope.builtin'
356-
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
357-
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
358-
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
359-
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
360-
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
361-
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
362-
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
363-
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
364-
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
365-
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
366-
367-
-- Slightly advanced example of overriding default behavior and theme
368-
vim.keymap.set('n', '<leader>/', function()
369-
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
370-
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
371-
winblend = 10,
372-
previewer = false,
373-
})
374-
end, { desc = '[/] Fuzzily search in current buffer' })
375-
376-
-- It's also possible to pass additional configuration options.
377-
-- See `:help telescope.builtin.live_grep()` for information about particular keys
378-
vim.keymap.set('n', '<leader>s/', function()
379-
builtin.live_grep {
380-
grep_open_files = true,
381-
prompt_title = 'Live Grep in Open Files',
382-
}
383-
end, { desc = '[S]earch [/] in Open Files' })
384-
385-
-- Shortcut for searching your Neovim configuration files
386-
vim.keymap.set('n', '<leader>sn', function()
387-
builtin.find_files { cwd = vim.fn.stdpath 'config' }
388-
end, { desc = '[S]earch [N]eovim files' })
389-
end,
390-
},
391-
392288
-- LSP Plugins
393289
{
394290
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
@@ -462,43 +358,6 @@ require('lazy').setup({
462358
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
463359
end
464360

465-
-- Rename the variable under your cursor.
466-
-- Most Language Servers support renaming across files, etc.
467-
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
468-
469-
-- Execute a code action, usually your cursor needs to be on top of an error
470-
-- or a suggestion from your LSP for this to activate.
471-
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
472-
473-
-- Find references for the word under your cursor.
474-
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
475-
476-
-- Jump to the implementation of the word under your cursor.
477-
-- Useful when your language has ways of declaring types without an actual implementation.
478-
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
479-
480-
-- Jump to the definition of the word under your cursor.
481-
-- This is where a variable was first declared, or where a function is defined, etc.
482-
-- To jump back, press <C-t>.
483-
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
484-
485-
-- WARN: This is not Goto Definition, this is Goto Declaration.
486-
-- For example, in C this would take you to the header.
487-
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
488-
489-
-- Fuzzy find all the symbols in your current document.
490-
-- Symbols are things like variables, functions, types, etc.
491-
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
492-
493-
-- Fuzzy find all the symbols in your current workspace.
494-
-- Similar to document symbols, except searches over your entire project.
495-
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
496-
497-
-- Jump to the type of the word under your cursor.
498-
-- Useful when you're not sure what type a variable is and you want to see
499-
-- the definition of its *type*, not where it was *defined*.
500-
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
501-
502361
-- Show the signature of the symbol under your cursor.
503362
map('gh', vim.lsp.buf.hover, 'Hover Documentation')
504363

@@ -920,7 +779,7 @@ require('lazy').setup({
920779
-- This is the easiest way to modularize your config.
921780
--
922781
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
923-
{ import = 'custom.plugins' },
782+
{ import = 'plugins' },
924783
--
925784
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
926785
-- Or use telescope!

lua/plugins/snacks.lua

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
return {
2+
'folke/snacks.nvim',
3+
priority = 1000,
4+
lazy = false,
5+
---@type snacks.Config
6+
opts = {
7+
-- your configuration comes here
8+
-- or leave it empty to use the default settings
9+
-- refer to the configuration section below
10+
bigfile = { enabled = true },
11+
dashboard = { enabled = true },
12+
explorer = { enabled = true },
13+
indent = { enabled = true },
14+
input = { enabled = true },
15+
picker = { enabled = true },
16+
notifier = { enabled = true },
17+
quickfile = { enabled = true },
18+
scope = { enabled = true },
19+
scroll = { enabled = true },
20+
statuscolumn = { enabled = true },
21+
words = { enabled = true },
22+
},
23+
keys = {
24+
{
25+
'gd',
26+
function()
27+
Snacks.picker.lsp_definitions()
28+
end,
29+
desc = 'Goto Definition',
30+
},
31+
{
32+
'gD',
33+
function()
34+
Snacks.picker.lsp_declarations()
35+
end,
36+
desc = 'Goto Declaration',
37+
},
38+
{
39+
'gr',
40+
function()
41+
Snacks.picker.lsp_references()
42+
end,
43+
nowait = true,
44+
desc = 'References',
45+
},
46+
{
47+
'gI',
48+
function()
49+
Snacks.picker.lsp_implementations()
50+
end,
51+
desc = 'Goto Implementation',
52+
},
53+
},
54+
}

0 commit comments

Comments
 (0)