Skip to content

Commit 69e5fa0

Browse files
committed
feat(snacks): use dashboard
i really need to split configs up in `snacks.lua`
1 parent 07a50a3 commit 69e5fa0

5 files changed

Lines changed: 38 additions & 38 deletions

File tree

lua/custom/plugins/dashboard.lua

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

lua/custom/plugins/rust.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
return {
22
{
3-
'mrcjkb/rustaceanvim',
3+
-- 'mrcjkb/rustaceanvim',
4+
5+
dir = '~/projects/rustaceanvim',
6+
name = 'rustaceanvim',
7+
48
ft = { 'rust' },
59
config = function()
610
vim.api.nvim_create_autocmd('LspAttach', {

lua/kickstart/plugins/lspconfig.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,32 +140,32 @@ return {
140140
-- Jump to the definition of the word under your cursor.
141141
-- This is where a variable was first declared, or where a function is defined, etc.
142142
-- To jump back, press <C-t>.
143-
map('gd', deprecated('grd', require('snacks').picker.lsp_definitions), 'Goto Definition')
144-
map('grd', require('snacks').picker.lsp_definitions, 'Goto Definition')
143+
map('gd', deprecated('grd', Snacks.picker.lsp_definitions), 'Goto Definition')
144+
map('grd', Snacks.picker.lsp_definitions, 'Goto Definition')
145145

146146
-- Find references for the word under your cursor.
147-
map('grr', require('snacks').picker.lsp_references, 'Goto References')
147+
map('grr', Snacks.picker.lsp_references, 'Goto References')
148148

149149
-- Jump to the implementation of the word under your cursor.
150150
-- Useful when your language has ways of declaring types without an actual implementation.
151-
map('gri', require('snacks').picker.lsp_implementations, 'Goto Implementation')
151+
map('gri', Snacks.picker.lsp_implementations, 'Goto Implementation')
152152

153153
-- Jump to the type of the word under your cursor.
154154
-- Useful when you're not sure what type a variable is and you want to see
155155
-- the definition of its *type*, not where it was *defined*.
156-
map('grt', require('snacks').picker.lsp_type_definitions, 'Type Definition')
156+
map('grt', Snacks.picker.lsp_type_definitions, 'Type Definition')
157157

158158
map('<leader>ld', vim.diagnostic.open_float, 'Open diagnostic in float')
159159

160160
-- Fuzzy find all the symbols in your current document.
161161
-- Symbols are things like variables, functions, types, etc.
162-
map('<leader>ls', deprecated('gD', require('snacks').picker.lsp_symbols), 'Document Symbols')
163-
map('gD', require('snacks').picker.lsp_symbols, 'Document Symbols')
162+
map('<leader>ls', deprecated('gD', Snacks.picker.lsp_symbols), 'Document Symbols')
163+
map('gD', Snacks.picker.lsp_symbols, 'Document Symbols')
164164

165165
-- Fuzzy find all the symbols in your current workspace.
166166
-- Similar to document symbols, except searches over your entire project.
167-
map('<leader>lS', deprecated('gW', require('snacks').picker.lsp_workspace_symbols), 'Workspace Symbols')
168-
map('gW', require('snacks').picker.lsp_workspace_symbols, 'Workspace Symbols')
167+
map('<leader>lS', deprecated('gW', Snacks.picker.lsp_workspace_symbols), 'Workspace Symbols')
168+
map('gW', Snacks.picker.lsp_workspace_symbols, 'Workspace Symbols')
169169

170170
-- Rename the variable under your cursor.
171171
-- Most Language Servers support renaming across files, etc.
@@ -179,7 +179,7 @@ return {
179179

180180
-- WARN: This is not Goto Definition, this is Goto Declaration.
181181
-- For example, in C this would take you to the header.
182-
map('grD', vim.lsp.buf.declaration, 'Goto Declaration')
182+
map('grD', Snacks.picker.lsp_declarations, 'Goto Declaration')
183183

184184
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
185185
---@param client vim.lsp.Client

lua/kickstart/plugins/snacks.lua

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
--
66
-- Use the `dependencies` key to specify the dependencies of a particular plugin
77

8+
local function read_header_file(path)
9+
local lines = vim.fn.readfile(path)
10+
if vim.tbl_isempty(lines) then
11+
if vim.fn.filereadable(path) == 0 then
12+
return ''
13+
end
14+
end
15+
return table.concat(lines, '\n')
16+
end
17+
818
return {
919
{ -- Fuzzy Finder (files, lsp, etc)
1020
'folke/snacks.nvim',
@@ -32,8 +42,18 @@ return {
3242
-- See `:help snacks-picker` and `:help snacks-picker-setup`
3343
---@type snacks.Config
3444
opts = {
35-
input = { enabled = true },
36-
picker = { enabled = true },
45+
dashboard = {
46+
preset = {
47+
keys = {},
48+
header = read_header_file(vim.fn.stdpath 'config' .. '/lua/header'),
49+
},
50+
sections = {
51+
{ section = 'header' },
52+
{ section = 'startup' },
53+
},
54+
},
55+
input = {},
56+
picker = {},
3757
},
3858
-- See `:help snacks-pickers-sources`
3959
keys = {

lua/lazy-plugins.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('lazy').setup({
2-
'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
2+
{ 'NMAC427/guess-indent.nvim', opts = {} }, -- Detect tabstop and shiftwidth automatically
33

44
-- Use `opts = {}` to force a plugin to be loaded.
55

0 commit comments

Comments
 (0)