feat: config refresh
This commit is contained in:
parent
a24128cfca
commit
f956194c53
16 changed files with 217 additions and 233 deletions
12
lua/config/keybinds.lua
Normal file
12
lua/config/keybinds.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
vim.keymap.set("n", "<C-h>", "<cmd>wincmd h<CR>", { desc = "Go to split on left" })
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>wincmd j<CR>", { desc = "Go to split above" })
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>wincmd k<CR>", { desc = "Go to split below" })
|
||||
vim.keymap.set("n", "<C-l>", "<cmd>wincmd l<CR>", { desc = "Go to split on right" })
|
||||
|
||||
vim.keymap.set("n", "<leader>|", "<C-w>v", { desc = "Split window right" })
|
||||
vim.keymap.set("n", "<leader>-", "<C-w>s", { desc = "Split window below" })
|
||||
vim.keymap.set("n", "<leader>wd", "<C-w>c", { desc = "Delete window" })
|
||||
|
||||
vim.keymap.set("n", "<Leader>y", '"*y', { desc = "Yank into system clipboard" })
|
||||
vim.keymap.set("v", "<Leader>y", '"*y', { desc = "Yank into system clipboard" })
|
||||
|
35
lua/config/lazy.lua
Normal file
35
lua/config/lazy.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
-- This is also a good place to setup other settings (vim.opt)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
|
@ -1,5 +0,0 @@
|
|||
vim.filetype.add({
|
||||
extension = {
|
||||
njk = "html",
|
||||
},
|
||||
})
|
|
@ -1,24 +0,0 @@
|
|||
vim.keymap.set("n", "<C-h>", "<cmd>wincmd h<CR>", { desc = "Go to split on left" })
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>wincmd j<CR>", { desc = "Go to split above" })
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>wincmd k<CR>", { desc = "Go to split below" })
|
||||
vim.keymap.set("n", "<C-l>", "<cmd>wincmd l<CR>", { desc = "Go to split on right" })
|
||||
|
||||
vim.keymap.set("n", "<leader>|", "<C-w>v", { desc = "Split window right" })
|
||||
vim.keymap.set("n", "<leader>-", "<C-w>s", { desc = "Split window below" })
|
||||
vim.keymap.set("n", "<leader>wd", "<C-w>c", { desc = "Delete window" })
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", { desc = "Move lines under cursor up" })
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", { desc = "Move lines under cursor down" })
|
||||
|
||||
vim.keymap.set("n", "n", "nzzzv", { desc = "Go to next search result and keep cursor centered on screen" })
|
||||
vim.keymap.set("n", "N", "Nzzzv", { desc = "Go to previous search result and keep cursor centered on screen" })
|
||||
|
||||
vim.keymap.set("x", "<Leader>p", '"_dP', { desc = "Paste without replacing clipboard contents" })
|
||||
|
||||
vim.keymap.set("n", "<Leader>y", '"*y', { desc = "Yank into system clipboard" })
|
||||
vim.keymap.set("v", "<Leader>y", '"*y', { desc = "Yank into system clipboard" })
|
||||
|
||||
vim.keymap.set("t", "<C-h>", "<cmd>wincmd h<CR>", { desc = "Go to split on left (Terminal)" })
|
||||
vim.keymap.set("t", "<C-j>", "<cmd>wincmd j<CR>", { desc = "Go to split above (Terminal)" })
|
||||
vim.keymap.set("t", "<C-k>", "<cmd>wincmd k<CR>", { desc = "Go to split below (Terminal)" })
|
||||
vim.keymap.set("t", "<C-l>", "<cmd>wincmd l<CR>", { desc = "Go to split on right (Terminal)" })
|
|
@ -16,7 +16,32 @@ return {
|
|||
event = "VeryLazy",
|
||||
opts = {
|
||||
lang = {
|
||||
graphql = "# %s",
|
||||
html = "<!-- %s -->",
|
||||
javascript = {
|
||||
"// %s", -- default commentstring when no treesitter node matches
|
||||
"/* %s */",
|
||||
call_expression = "// %s", -- specific commentstring for call_expression
|
||||
jsx_attribute = "// %s",
|
||||
jsx_element = "{/* %s */}",
|
||||
jsx_fragment = "{/* %s */}",
|
||||
spread_element = "// %s",
|
||||
statement_block = "// %s",
|
||||
},
|
||||
pug = "//- %s",
|
||||
php = "// %s",
|
||||
tsx = {
|
||||
"// %s", -- default commentstring when no treesitter node matches
|
||||
"/* %s */",
|
||||
call_expression = "// %s", -- specific commentstring for call_expression
|
||||
jsx_attribute = "// %s",
|
||||
jsx_element = "{/* %s */}",
|
||||
jsx_fragment = "{/* %s */}",
|
||||
spread_element = "// %s",
|
||||
statement_block = "// %s",
|
||||
},
|
||||
twig = "{# %s #}",
|
||||
typescript = { "// %s", "/* %s */" }, -- langs can have multiple commentstrings
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,36 +1,66 @@
|
|||
return {
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
css = { "prettierd" },
|
||||
scss = { "prettierd" },
|
||||
html = { "djlint" },
|
||||
lua = { "stylua" },
|
||||
markdown = { "prettierd" },
|
||||
javascript = { "prettierd" },
|
||||
javascriptreact = { "prettierd" },
|
||||
json = { "prettierd" },
|
||||
jsonc = { "prettierd" },
|
||||
toml = { "taplo" },
|
||||
typescript = { "prettierd" },
|
||||
typescriptreact = { "prettierd" },
|
||||
},
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
},
|
||||
formatters = {
|
||||
taplo = {
|
||||
args = function()
|
||||
-- conform.nvim does not parse bash envvars, so we do it ourselves
|
||||
local CONFIG_PATH = os.getenv("HOME") .. "/.config/taplo/taplo.toml"
|
||||
return {
|
||||
"format",
|
||||
"--config",
|
||||
CONFIG_PATH,
|
||||
"-",
|
||||
}
|
||||
end,
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
css = { "prettierd" },
|
||||
scss = { "prettierd" },
|
||||
html = { "djlint" },
|
||||
lua = { "stylua" },
|
||||
markdown = { "prettierd" },
|
||||
javascript = { "prettierd" },
|
||||
javascriptreact = { "prettierd" },
|
||||
json = { "prettierd" },
|
||||
jsonc = { "prettierd" },
|
||||
php = { "php_cs_fixer" },
|
||||
toml = { "taplo" },
|
||||
typescript = { "prettierd" },
|
||||
typescriptreact = { "prettierd" },
|
||||
twig = { "twig-cs-fixer" },
|
||||
},
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
},
|
||||
formatters = {
|
||||
taplo = {
|
||||
args = function()
|
||||
-- conform.nvim does not parse bash envvars, so we do it ourselves
|
||||
local CONFIG_PATH = os.getenv("HOME") .. "/.config/taplo/taplo.toml"
|
||||
return {
|
||||
"format",
|
||||
"--config",
|
||||
CONFIG_PATH,
|
||||
"-",
|
||||
}
|
||||
end,
|
||||
},
|
||||
php_cs_fixer = {
|
||||
args = function()
|
||||
local CONFIG_PATH = os.getenv("HOME") .. "/.config/php-cs-fixer/php-cs-fixer.php"
|
||||
return {
|
||||
"fix",
|
||||
"$FILENAME",
|
||||
"--config",
|
||||
CONFIG_PATH,
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"djlint",
|
||||
"php-cs-fixer",
|
||||
"prettierd",
|
||||
"proselint",
|
||||
"stylua",
|
||||
"twig-cs-fixer",
|
||||
},
|
||||
auto_update = true,
|
||||
automatic_installation = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,22 +1,4 @@
|
|||
return {
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
event = "VeryLazy",
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
-- optional for floating window border decoration
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>gg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "VeryLazy",
|
||||
|
@ -38,7 +20,6 @@ return {
|
|||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>ghb", ":Gitsigns blame_line<CR>", desc = "Blame line" },
|
||||
{ "<leader>ghs", ":Gitsigns stage_hunk<CR>", desc = "Stage hunk", mode = { "n", "v" } },
|
||||
{ "<leader>ghr", ":Gitsigns reset_hunk<CR>", desc = "Reset hunk", mode = { "n", "v" } },
|
||||
},
|
||||
|
|
|
@ -11,25 +11,14 @@ return {
|
|||
"eslint",
|
||||
"html",
|
||||
"lua_ls",
|
||||
"psalm", -- .php
|
||||
"taplo", -- .toml
|
||||
"ts_ls",
|
||||
"twiggy_language_server", -- .twig
|
||||
"yamlls", -- .yml
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"djlint",
|
||||
"prettierd",
|
||||
"proselint",
|
||||
"stylua",
|
||||
},
|
||||
auto_update = true,
|
||||
automatic_installation = true,
|
||||
},
|
||||
},
|
||||
-- lspconfig should be the last step.
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
|
@ -49,10 +38,12 @@ return {
|
|||
})
|
||||
end,
|
||||
},
|
||||
html = {},
|
||||
lua_ls = {},
|
||||
html = {},
|
||||
psalm = {},
|
||||
taplo = {},
|
||||
tsserver = {},
|
||||
ts_ls = {},
|
||||
twiggy_language_server = {},
|
||||
yamlls = {},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
event = "VeryLazy",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<Leader>ee", "<cmd>Neotree toggle<CR>", desc = "Toggle Neotree" },
|
||||
{ "<Leader>er", "<cmd>Neotree reveal<CR>", desc = "Reveal file" },
|
||||
|
|
23
lua/plugins/snack.lua
Normal file
23
lua/plugins/snack.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
return {
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
opts = {
|
||||
dashboard = { enabled = true },
|
||||
git = { enabled = true },
|
||||
lazygit = { enabled = true },
|
||||
notifier = { enabled = true },
|
||||
quickfile = { enabled = true },
|
||||
scratch = { enabled = true },
|
||||
statuscolumn = { enabled = true },
|
||||
terminal = { enabled = true },
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>.", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
|
||||
{ "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
|
||||
{ "<leader>n", function() Snacks.notifier.show_history() end, desc = "Notification History" },
|
||||
{ "<leader>gb", function() Snacks.git.blame_line() end, desc = "Git Blame Line" },
|
||||
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
|
||||
{ "<c-/>", function() Snacks.terminal() end, desc = "Toggle Terminal" },
|
||||
}
|
||||
}
|
|
@ -3,8 +3,11 @@ return {
|
|||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false,
|
||||
build = ":TSUpdate",
|
||||
event = { "VeryLazy" },
|
||||
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"graphql",
|
||||
"html",
|
||||
"htmldjango",
|
||||
"javascript",
|
||||
|
@ -14,8 +17,10 @@ return {
|
|||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"php",
|
||||
"pug",
|
||||
"tsx",
|
||||
"twig",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
|
@ -36,17 +37,20 @@ return {
|
|||
scope = { enabled = false },
|
||||
exclude = {
|
||||
filetypes = {
|
||||
"help",
|
||||
"Trouble",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"trouble",
|
||||
"help",
|
||||
"lazy",
|
||||
"mason",
|
||||
"neo-tree",
|
||||
"notify",
|
||||
"snacks_dashboard",
|
||||
"snacks_notif",
|
||||
"snacks_terminal",
|
||||
"snacks_win",
|
||||
"toggleterm",
|
||||
"lazyterm",
|
||||
"trouble",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -61,84 +65,25 @@ return {
|
|||
init = function()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = {
|
||||
"help",
|
||||
"Trouble",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"trouble",
|
||||
"help",
|
||||
"lazy",
|
||||
"mason",
|
||||
"neo-tree",
|
||||
"notify",
|
||||
"snacks_dashboard",
|
||||
"snacks_notif",
|
||||
"snacks_terminal",
|
||||
"snacks_win",
|
||||
"toggleterm",
|
||||
"lazyterm",
|
||||
"trouble",
|
||||
},
|
||||
callback = function()
|
||||
vim.b.miniindentscope_disable = true
|
||||
callback = function(data)
|
||||
vim.b[data.buf].miniindentscope_disable = true
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
opts = {
|
||||
timeout = 2000,
|
||||
stages = "static",
|
||||
},
|
||||
},
|
||||
{
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
},
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- https://github.com/MaximilianLloyd/ascii.nvim
|
||||
dashboard.section.header.val = {
|
||||
" ",
|
||||
" ░░░ ▄▄▄▄▄▄███▄▄▄▄▄ ",
|
||||
" ▄███████▀▀▀▀▀▀█▓▓▓▓▓▓██▄▄▄▄ ",
|
||||
" ▐████▄▄ ■▓▓▓▓▀▀▀▀▀▀▀▀▀█████■ ██▄ ",
|
||||
" ▀█████████▄▄▄▄▄███████████▀▀ ▄▄ ████░▄▄▄ ",
|
||||
" ▐██▄ ▄▄▄▄▄▄▀▀▀▀▀▀▀▀▓▓▓▀░░░▄▄▄ ▄▄ ▐███▏▐██▓▄████ ",
|
||||
" ▄█▓░███▓ ▄▓▓▓▄▄████████████▄█████▄ ▄█████████▐███ ████▏██▀████▀ ",
|
||||
" ▐███▄███░▀████████▀▀ ▀▓█████▓▀██▓████▀▀ ███████ ▄█████ ■ ██▀ ",
|
||||
" ▀████▓██ ▐██████ ▐████ ▐████▀ ▒████████▄ ▄███████ ",
|
||||
" ▀███ ▀▀█████▄ ▄████ ▄████▏ ▄█████▀█████████▀ ███ ",
|
||||
" ▀████▄ ▄████▐██▄███████▄▄▄███▓██▏ ▀██████▀ ▐██ ",
|
||||
" ▀████████▀ ▀████▀▀████████▀▐██▏ ▀██▀▀ ▐██▏ ",
|
||||
" ▓▓█ ▀████ ▀ ■███▄▄ ███ ██▏ ",
|
||||
" ▀▀▀ ▀▀ ▀█████▄▓▀ ██▏ ",
|
||||
" ░░ ▄████████████▄▄▄▄▄▄▄ ▀▀▀████▄▄ ▒▒▒ ██▏ ▄▄ ",
|
||||
" ▀▀████▀▀▀▀▀▀████████████▄▄▓▓▓███▄ ░░░░ ▐█▏ ■▀▀ ",
|
||||
" ▀▀▀▀▀▀█████▓▓▓▓█▄▄ ▐█ ",
|
||||
" ▄█████████▄▄ ",
|
||||
" ▄▄▄▄████████▀▀▀▀▀▀▀███▏ ",
|
||||
" ▄▄█████▀▀▀▀ ▀■ ",
|
||||
" ▄███▀▀▀▀ ",
|
||||
" ■▀▀ ",
|
||||
" ",
|
||||
}
|
||||
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("e", " > New File", "<cmd>ene<CR>"),
|
||||
dashboard.button("SPC ee", " > File explorer", "<cmd>Neotree<CR>"),
|
||||
dashboard.button("q", " > Quit", "<cmd>qa<CR>"),
|
||||
}
|
||||
|
||||
alpha.setup(dashboard.opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue