feat: initial commit

This commit is contained in:
Folke Lemaitre 2022-12-30 17:30:52 +01:00
commit 58e5dae036
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
18 changed files with 683 additions and 0 deletions

15
.neoconf.json Normal file
View file

@ -0,0 +1,15 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"sumneko_lua": {
"enabled": true
}
}
}
}

4
init.lua Normal file
View file

@ -0,0 +1,4 @@
require("user.options")
require("user.lazy")
require("user.autocommands")
require("user.mappings")

34
lazy-lock.json Normal file
View file

@ -0,0 +1,34 @@
{
"LuaSnip": { "branch": "master", "commit": "563827f00bb4fe43269e3be653deabc0005f1302" },
"alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" },
"catppuccin": { "branch": "main", "commit": "26e498db297607fe17a6206c5a28f0f4cb532954" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" },
"friendly-snippets": { "branch": "main", "commit": "1a6a02350568d6830bcfa167c72f9b6e75e454ae" },
"gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
"indent-blankline.nvim": { "branch": "master", "commit": "db7cbcb40cc00fc5d6074d7569fb37197705e7f6" },
"lualine.nvim": { "branch": "master", "commit": "32a7382a75a52e8ad05f4cec7eeb8bbfbe80d461" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "698713735933a5891080fc3d87a687f90b9d2aee" },
"mason.nvim": { "branch": "main", "commit": "1592493e3406c271e9128b4d424731e25f1ff2a1" },
"mini.comment": { "branch": "main", "commit": "e5294cc3e75bafb2369f235d31a98b01a9cc67ad" },
"mini.pairs": { "branch": "main", "commit": "fec9aba50912d8c3d92d07d6a77952de84f8d7ad" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "3b41f0d17139bb156f1acd907608f63e0e307caf" },
"neoconf.nvim": { "branch": "main", "commit": "c50f45c0338073a5c2e8ddacc325e8231e22cefd" },
"neodev.nvim": { "branch": "main", "commit": "8e06acf88e0621badd9499cfcafbce5ca97dfe8e" },
"nui.nvim": { "branch": "main", "commit": "4939282919885e1c83aff68ecb35b3cadf6015a9" },
"null-ls.nvim": { "branch": "main", "commit": "647a1eeeefc43ce15d941972642210637c370471" },
"nvim-bufferline.lua": { "branch": "main", "commit": "028a87933d99f8bb88f2f70a4def3ff9574f3594" },
"nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" },
"nvim-lspconfig": { "branch": "master", "commit": "22c87d6f48c4fb1daf33476450d0b14a64230809" },
"nvim-notify": { "branch": "master", "commit": "b005821516f1f37801a73067afd1cef2dbc4dfe8" },
"nvim-treesitter": { "branch": "master", "commit": "69388e84c34d40c3d5c7d2f310db13276f2179e1" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "32d9627123321db65a4f158b72b757bcaef1a3f4" },
"nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" },
"plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" },
"telescope.nvim": { "branch": "master", "commit": "b79cd6c88b3d96b0f49cb7d240807cd59b610cd8" },
"tokyonight.nvim": { "branch": "main", "commit": "8a619f0cf3ed9051081d9fc0cd4f852a7355f546" },
"which-key.nvim": { "branch": "main", "commit": "8682d3003595017cd8ffb4c860a07576647cc6f8" }
}

40
lua/user/autocommands.lua Normal file
View file

@ -0,0 +1,40 @@
-- Check if we need to reload the file when it changed
vim.api.nvim_create_autocmd("FocusGained", { command = "checktime" })
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", { callback = vim.highlight.on_yank })
-- go to last loc when opening a buffer
vim.api.nvim_create_autocmd("BufReadPre", {
pattern = "*",
callback = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = "<buffer>",
once = true,
callback = function()
vim.cmd(
[[if &ft !~# 'commit\|rebase' && line("'\"") > 1 && line("'\"") <= line("$") | exe 'normal! g`"' | endif]]
)
end,
})
end,
})
-- close some filetypes with <q>
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
"qf",
"help",
"man",
"notify",
"lspinfo",
"spectre_panel",
"startuptime",
"tsplayground",
"PlenaryTestPopup",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})

30
lua/user/lazy.lua Normal file
View file

@ -0,0 +1,30 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("user.plugins", {
defaults = { lazy = true, version = "*" },
install = { colorscheme = { "tokyonight", "habamax" } },
checker = { enabled = true },
performance = {
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
"nvim-treesitter-textobjects",
},
},
},
})
vim.keymap.set("n", "<leader>l", "<cmd>:Lazy<cr>")

66
lua/user/mappings.lua Normal file
View file

@ -0,0 +1,66 @@
-- Move to window using the <meta> movement keys
vim.keymap.set("n", "<A-left>", "<C-w>h")
vim.keymap.set("n", "<A-down>", "<C-w>j")
vim.keymap.set("n", "<A-up>", "<C-w>k")
vim.keymap.set("n", "<A-right>", "<C-w>l")
-- Resize window using <shift> arrow keys
vim.keymap.set("n", "<S-Up>", "<cmd>resize +2<CR>")
vim.keymap.set("n", "<S-Down>", "<cmd>resize -2<CR>")
vim.keymap.set("n", "<S-Left>", "<cmd>vertical resize -2<CR>")
vim.keymap.set("n", "<S-Right>", "<cmd>vertical resize +2<CR>")
-- Move Lines
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==")
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv")
vim.keymap.set("i", "<A-j>", "<Esc>:m .+1<CR>==gi")
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv")
vim.keymap.set("i", "<A-k>", "<Esc>:m .-2<CR>==gi")
-- Switch buffers with <ctrl>
vim.keymap.set("n", "<C-Left>", "<cmd>bprevious<cr>")
vim.keymap.set("n", "<C-Right>", "<cmd>bnext<cr>")
-- Easier pasting
vim.keymap.set("n", "[p", ":pu!<cr>")
vim.keymap.set("n", "]p", ":pu<cr>")
-- Clear search with <esc>
vim.keymap.set({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>")
vim.keymap.set("n", "gw", "*N")
vim.keymap.set("x", "gw", "*N")
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
vim.keymap.set("n", "n", "'Nn'[v:searchforward]", { expr = true })
vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true })
vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true })
vim.keymap.set("n", "N", "'nN'[v:searchforward]", { expr = true })
vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true })
vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true })
-- Add undo break-points
vim.keymap.set("i", ",", ",<c-g>u")
vim.keymap.set("i", ".", ".<c-g>u")
vim.keymap.set("i", ";", ";<c-g>u")
-- save in insert mode
vim.keymap.set("i", "<C-s>", "<cmd>:w<cr><esc>")
vim.keymap.set("n", "<C-s>", "<cmd>:w<cr><esc>")
-- better indenting
vim.keymap.set("v", "<", "<gv")
vim.keymap.set("v", ">", ">gv")
-- makes * and # work on visual mode too.
vim.cmd([[
function! g:VSetSearch(cmdtype)
let temp = @s
norm! gv"sy
let @/ = '\V' . substitute(escape(@s, a:cmdtype.'\'), '\n', '\\n', 'g')
let @s = temp
endfunction
xnoremap * :<C-u>call g:VSetSearch('/')<CR>/<C-R>=@/<CR><CR>
xnoremap # :<C-u>call g:VSetSearch('?')<CR>?<C-R>=@/<CR><CR>
]])

51
lua/user/options.lua Normal file
View file

@ -0,0 +1,51 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.opt.autowrite = true -- enable auto write
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
vim.opt.cmdheight = 1
vim.opt.completeopt = "menu,menuone,noselect"
vim.opt.conceallevel = 3 -- Hide * markup for bold and italic
vim.opt.confirm = true -- confirm to save changes before exiting modified buffer
vim.opt.cursorline = true -- Enable highlighting of the current line
vim.opt.expandtab = true -- Use spaces instead of tabs
vim.opt.formatoptions = "jcroqlnt" -- tcqj
vim.opt.grepformat = "%f:%l:%c:%m"
vim.opt.grepprg = "rg --vimgrep"
vim.opt.guifont = "FiraCode Nerd Font:h11"
vim.opt.hidden = true -- Enable modified buffers in background
vim.opt.ignorecase = true -- Ignore case
vim.opt.inccommand = "nosplit" -- preview incremental substitute
vim.opt.joinspaces = false -- No double spaces with join after a dot
vim.opt.laststatus = 0
vim.opt.list = true -- Show some invisible characters (tabs...
vim.opt.mouse = "a" -- enable mouse mode
vim.opt.number = true -- Print line number
vim.opt.pumblend = 10 -- Popup blend
vim.opt.pumheight = 10 -- Maximum number of entries in a popup
vim.opt.relativenumber = true -- Relative line numbers
vim.opt.scrolloff = 4 -- Lines of context
vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
vim.opt.shiftround = true -- Round indent
vim.opt.shiftwidth = 2 -- Size of an indent
vim.opt.shortmess = "filnxtToOFWIcC"
vim.opt.showmode = false -- dont show mode since we have a statusline
vim.opt.sidescrolloff = 8 -- Columns of context
vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
vim.opt.smartcase = true -- Don't ignore case with capitals
vim.opt.smartindent = true -- Insert indents automatically
vim.opt.spelllang = { "en" }
vim.opt.splitbelow = true -- Put new windows below current
vim.opt.splitkeep = "screen"
vim.opt.splitright = true -- Put new windows right of current
vim.opt.tabstop = 2 -- Number of spaces tabs count for
vim.opt.termguicolors = true -- True color support
vim.opt.timeoutlen = 300
vim.opt.undofile = true
vim.opt.undolevels = 10000
vim.opt.updatetime = 200 -- save swap file and trigger CursorHold
vim.opt.wildmode = "longest:full,full" -- Command-line completion mode
vim.opt.wrap = false -- Disable line wrap
-- fix markdown indentation settings
vim.g.markdown_recommended_style = 0

6
lua/user/plugins/api.lua Normal file
View file

@ -0,0 +1,6 @@
-- plugins that provide apis for other plugins
return {
"nvim-tree/nvim-web-devicons",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
}

View file

@ -0,0 +1,90 @@
return {
-- git signs
{
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
config = {
signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
untracked = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
},
},
},
-- snippets
{
"L3MON4D3/LuaSnip",
dependencies = {
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
},
-- auto completion
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
},
config = function()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
}),
})
end,
},
-- auto pairs
{
"echasnovski/mini.pairs",
config = function()
require("mini.pairs").setup({})
end,
},
-- comments
{ "JoosepAlviste/nvim-ts-context-commentstring" },
{
"echasnovski/mini.comment",
event = "VeryLazy",
config = function()
require("mini.comment").setup({
hooks = {
pre = function()
require("ts_context_commentstring.internal").update_commentstring({})
end,
},
})
end,
},
}

View file

@ -0,0 +1,17 @@
return {
{
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
config = function()
require("tokyonight").setup({ style = "moon" })
vim.cmd.colorscheme("tokyonight")
end,
},
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
},
}

View file

@ -0,0 +1,35 @@
vim.g.neo_tree_remove_legacy_commands = 1
return {
-- file explorer
{
"nvim-neo-tree/neo-tree.nvim",
cmd = "Neotree",
keys = { { "<leader>ft", "<cmd>Neotree toggle<cr>", desc = "NeoTree" } },
config = {
filesystem = {
follow_current_file = true,
hijack_netrw_behavior = "open_current",
},
},
},
-- fuzzy finder
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
keys = { { "<leader><space>", "<cmd>Telescope find_files<cr>", desc = "Find Files" } },
config = true,
},
-- which-key
{
"folke/which-key.nvim",
event = "VeryLazy",
config = {
plugins = { spelling = true },
key_labels = { ["<leader>"] = "SPC" },
},
},
}

View file

@ -0,0 +1,49 @@
local M = {}
M.autoformat = true
function M.toggle()
M.autoformat = not M.autoformat
if M.autoformat then
vim.notify("enabled format on save")
else
vim.notify("disabled format on save")
end
end
function M.format()
if M.autoformat then
vim.lsp.buf.format()
end
end
function M.nls_formatter(ft)
local sources = require("null-ls.sources")
local available = sources.get_available(ft, "NULL_LS_FORMATTING")
return #available > 0
end
function M.on_attach(client, buf)
local ft = vim.api.nvim_buf_get_option(buf, "filetype")
local enable = false
if M.nls_formatter(ft) then
enable = client.name == "null-ls"
else
enable = not (client.name == "null-ls")
end
client.server_capabilities.documentFormattingProvider = enable
-- format on save
if client.server_capabilities.documentFormattingProvider then
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("LspFormat", {}),
buffer = 0,
callback = function()
M.format()
end,
})
end
end
return M

View file

@ -0,0 +1,49 @@
local servers = require("user.plugins.lsp.servers")
local function on_attach(client, bufnr)
require("user.plugins.lsp.format").on_attach(client, bufnr)
require("user.plugins.lsp.mappings").on_attach(client, bufnr)
end
return {
-- lspconfig
{
"neovim/nvim-lspconfig",
event = "BufReadPre",
dependencies = {
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
{ "folke/neodev.nvim", config = true },
{ "williamboman/mason.nvim", config = true },
{ "williamboman/mason-lspconfig.nvim", config = { ensure_installed = vim.tbl_keys(servers) } },
"hrsh7th/cmp-nvim-lsp",
},
config = function()
---@type _.lspconfig.options
local defaults = {
on_attach = on_attach,
capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
}
for server, opts in pairs(servers) do
opts = vim.tbl_deep_extend("force", {}, defaults, opts or {})
require("lspconfig")[server].setup(opts)
end
end,
},
-- formatters
{
"jose-elias-alvarez/null-ls.nvim",
event = "BufReadPre",
config = function()
local nls = require("null-ls")
nls.setup({
on_attach = on_attach,
sources = {
-- nls.builtins.formatting.prettierd,
nls.builtins.formatting.stylua,
nls.builtins.diagnostics.flake8,
},
})
end,
},
}

View file

@ -0,0 +1,70 @@
local M = {}
function M.on_attach(client, buffer)
local cap = client.server_capabilities
require("which-key").register({
buffer = buffer,
["<leader>"] = {
c = {
name = "+code",
{
cond = client.name == "tsserver",
o = { "<cmd>:TypescriptOrganizeImports<CR>", "Organize Imports" },
R = { "<cmd>:TypescriptRenameFile<CR>", "Rename File" },
},
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename", cond = cap.renameProvider },
a = {
{ vim.lsp.buf.code_action, "Code Action" },
{ "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action", mode = "v" },
},
f = {
{
require("user.plugins.lsp.format").format,
"Format Document",
cond = cap.documentFormatting,
},
{
require("user.plugins.lsp.format").format,
"Format Range",
cond = cap.documentRangeFormatting,
mode = "v",
},
},
d = { vim.diagnostic.open_float, "Line Diagnostics" },
l = {
name = "+lsp",
i = { "<cmd>LspInfo<cr>", "Lsp Info" },
},
},
x = {
d = { "<cmd>Telescope diagnostics<cr>", "Search Diagnostics" },
},
},
g = {
name = "+goto",
d = { "<cmd>Telescope lsp_definitions<cr>", "Goto Definition" },
r = { "<cmd>Telescope lsp_references<cr>", "References" },
R = { "<cmd>Trouble lsp_references<cr>", "Trouble References" },
D = { "<cmd>Telescope lsp_declarations<CR>", "Goto Declaration" },
I = { "<cmd>Telescope lsp_implementations<CR>", "Goto Implementation" },
t = { "<cmd>Telescope lsp_type_definitions<cr>", "Goto Type Definition" },
},
["<C-k>"] = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "Signature Help", mode = { "n", "i" } },
["K"] = { "<cmd>lua vim.lsp.buf.hover()<CR>", "Hover" },
["[d"] = { "<cmd>lua vim.diagnostic.goto_prev()<CR>", "Next Diagnostic" },
["]d"] = { "<cmd>lua vim.diagnostic.goto_next()<CR>", "Prev Diagnostic" },
["[e"] = { "<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<CR>", "Next Error" },
["]e"] = { "<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<CR>", "Prev Error" },
["[w"] = {
"<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.WARNING})<CR>",
"Next Warning",
},
["]w"] = {
"<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.WARNING})<CR>",
"Prev Warning",
},
})
end
return M

View file

@ -0,0 +1,25 @@
---@type lspconfig.options
local servers = {
bashls = {},
clangd = {},
cssls = {},
tsserver = {},
html = {},
jsonls = {},
pyright = {},
yamlls = {},
sumneko_lua = {
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = "Replace",
},
},
},
},
}
return servers

View file

@ -0,0 +1,16 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufReadPost",
config = function()
require("nvim-treesitter.configs").setup({
sync_install = false,
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
})
end,
},
}

83
lua/user/plugins/ui.lua Normal file
View file

@ -0,0 +1,83 @@
return {
-- better vim.notify
{
"rcarriga/nvim-notify",
event = "VeryLazy",
config = function()
vim.notify = require("notify")
end,
},
-- better vim.ui
{
"stevearc/dressing.nvim",
event = "VeryLazy",
config = true,
},
-- bufferline
{
"akinsho/nvim-bufferline.lua",
event = "BufAdd",
config = true,
},
-- statusline
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
config = true,
},
-- indent guides for Neovim
{
"lukas-reineke/indent-blankline.nvim",
event = "BufReadPre",
config = {
char = "",
},
},
-- dashboard
{
"goolord/alpha-nvim",
lazy = false,
config = function()
local dashboard = require("alpha.themes.dashboard")
local logo = [[
Z
Z
z
z
]]
dashboard.section.header.val = vim.split(logo, "\n")
dashboard.section.buttons.val = {
dashboard.button("f", "" .. " Find file", ":Telescope find_files <CR>"),
dashboard.button("n", "" .. " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("r", "" .. " Recent files", ":Telescope oldfiles <CR>"),
dashboard.button("g", "" .. " Find text", ":Telescope live_grep <CR>"),
dashboard.button("c", "" .. " Config", ":e $MYVIMRC <CR>"),
dashboard.button("q", "" .. " Quit", ":qa<CR>"),
}
dashboard.section.footer.opts.hl = "Type"
dashboard.section.header.opts.hl = "Include"
dashboard.section.buttons.opts.hl = "Keyword"
dashboard.opts.opts.noautocmd = true
require("alpha").setup(dashboard.opts)
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
dashboard.section.footer.val = "🎉 Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
pcall(vim.cmd.AlphaRedraw)
end,
})
end,
},
}

3
stylua.toml Normal file
View file

@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120