Add neovim

This commit is contained in:
Snoweuph 2024-05-13 20:43:31 +02:00
parent d67e1c2ad5
commit 04e75b253f
Signed by: Snoweuph
GPG key ID: A494330694B208EF
24 changed files with 750 additions and 0 deletions

View file

@ -0,0 +1 @@
neovim lua gcc curl wget git unzip tar gzip ripgrep php composer go nodejs npm

1
.config/nvim/init.lua Normal file
View file

@ -0,0 +1 @@
require("core")

View file

@ -0,0 +1,8 @@
-- Use 2 Spaces Instead of Tabs --
vim.cmd("set expandtab")
vim.cmd("set tabstop=4")
vim.cmd("set softtabstop=4")
vim.cmd("set shiftwidth=4")
-- Enable Line Number --
vim.cmd("set number")

View file

@ -0,0 +1,3 @@
require("core.keymap")
require("core.editor")
require("core.package_manager")

View file

@ -0,0 +1,9 @@
vim.g.mapleader = " "
--[[ Indentation ]]--
vim.keymap.set("n", "<Tab>", " >>")
vim.keymap.set("n", "<S-Tab>", " <<")
--[[ Navigating Panels ]]--
-- TODO: Normal, Insert, Terminal Mode

View file

@ -0,0 +1,15 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local opts = {}
require("lazy").setup("plugins", opts)

View file

@ -0,0 +1,32 @@
return {
"goolord/alpha-nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
-- Setup --
local alpha = require("alpha")
local dashboard = require("alpha.themes.startify")
-- Header --
dashboard.section.header.val = {
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[  ]],
[[ ████ ██████ █████ ██ ]],
[[ ███████████ █████  ]],
[[ █████████ ███████████████████ ███ ███████████ ]],
[[ █████████ ███ █████████████ █████ ██████████████ ]],
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
[[ ]],
[[ ]],
[[ ]],
}
alpha.setup(dashboard.opts)
end,
}

View file

@ -0,0 +1,8 @@
return {
require("plugins.editor.editor_auto_brackets"),
require("plugins.editor.editor_code_highlighting"),
require("plugins.editor.editor_code_snippets"),
require("plugins.editor.editor_debugging"),
require("plugins.editor.editor_language_server"),
require("plugins.editor.editor_markdown_preview")
}

View file

@ -0,0 +1,6 @@
return {
'm4xshen/autoclose.nvim',
config = function()
require("autoclose").setup()
end
}

View file

@ -0,0 +1,19 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
-- Setup --
local config = require("nvim-treesitter.configs")
config.setup({
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
})
end,
},
{
"NoahTheDuke/vim-just",
ft = { "just" },
},
}

View file

@ -0,0 +1,74 @@
return {
{
"L3MON4D3/LuaSnip",
version = "2.*",
dependencies = {
"rafamadriz/friendly-snippets",
"mireq/luasnip-snippets",
},
build = "make install_jsregexp",
config = function()
-- Setup --
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_snipmate").lazy_load()
require("luasnip_snippets.common.snip_utils").setup()
end,
},
{
"hrsh7th/nvim-cmp",
dependencies = {
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp",
},
config = function()
-- Setup --
local cmp = require("cmp")
local luasnip = require("luasnip")
luasnip.setup({
load_ft_func = require("luasnip_snippets.common.snip_utils").load_ft_func,
ft_func = require("luasnip_snippets.common.snip_utils").ft_func,
enable_autosnippets = true,
})
-- Keybinding --
vim.keymap.set({ "i", "s" }, "<Tab>", function()
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
vim.api.nvim_input("<C-V><Tab>")
end
end, { silent = true })
vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
luasnip.jump(-1)
end, { silent = true })
local doc_keybindings = {
["<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 }),
}
-- Setup --
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert(doc_keybindings),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, { { name = "buffer" } }),
})
end,
},
}

View file

@ -0,0 +1,57 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
"rcarriga/nvim-dap-ui",
"nvim-neotest/nvim-nio",
},
config = function()
-- Setup Debugging --
local dap = require("dap")
-- Open UI on Debugging --
local dapui = require("dapui").setup()
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
-- Keybinding --
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Debugger Continue" })
vim.keymap.set("n", "<Leader>dx", dap.terminate, { desc = "Debugger Terminate" })
vim.keymap.set("n", "<Leader>ds", dap.step_over, { desc = "Debugger Step Over" })
-- Breakpoints --
vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
vim.fn.sign_define(
"DapBreakpoint",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointCondition",
{ text = "󰣏", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointRejected",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapLogPoint",
{ text = "", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
)
vim.fn.sign_define(
"DapStopped",
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
)
end,
}

View file

@ -0,0 +1,5 @@
return {
require("plugins.editor.language_server.language_server"),
require("plugins.editor.language_server.language_server_extra"),
require("plugins.editor.language_server.language_server_nvim_configuration"),
}

View file

@ -0,0 +1,30 @@
return {
"mrjones2014/mdpreview.nvim",
ft = "markdown",
dependencies = {
"norcalli/nvim-terminal.lua",
config = true,
},
config = function()
require("mdpreview").setup({
cli_args = {
"glow",
"-s",
"~/.config/glow/catppuccin-macchiato.json",
"-w",
"1",
"--local",
},
renderer = {
opts = {
win_opts = {
number = true,
wrap = false,
},
},
},
})
vim.keymap.set("n", "<Leader>mp", ":Mdpreview<CR>", { desc = "Show Markdown Preview" })
end,
}

View file

@ -0,0 +1,170 @@
return {
{
"williamboman/mason.nvim",
lazy = false,
config = function()
require("mason").setup()
end,
},
{
"williamboman/mason-lspconfig.nvim",
lazy = false,
opts = {
auto_install = true,
},
config = function()
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"bashls",
"dotls",
"jsonls",
"sqlls",
"lemminx",
"yamlls",
"marksman",
"html",
"emmet_ls",
"cssls",
"tailwindcss",
"tsserver",
"stimulus_ls",
"svelte",
"volar",
"eslint",
"phpactor",
"gopls",
"rust_analyzer",
"jdtls",
"kotlin_language_server",
"pylsp",
},
})
end,
},
{
"neovim/nvim-lspconfig",
lazy = false,
config = function()
-- Setup --
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig")
-- Lua support --
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
}
}
}
})
-- Bash support --
lspconfig.bashls.setup({
capabilities = capabilities,
})
-- Dotenv support --
lspconfig.dotls.setup({
capabilities = capabilities,
})
-- JSON support --
lspconfig.jsonls.setup({
capabilities = capabilities,
})
-- SQL support --
lspconfig.sqlls.setup({
capabilities = capabilities,
})
-- XML support --
lspconfig.lemminx.setup({
capabilities = capabilities,
})
-- YAML support --
lspconfig.yamlls.setup({
capabilities = capabilities,
})
-- Markdown support --
lspconfig.marksman.setup({
capabilities = capabilities,
})
-- HTML support --
lspconfig.html.setup({
capabilities = capabilities,
})
-- Emmet support --
lspconfig.emmet_ls.setup({
capabilities = capabilities,
})
-- PHP support --
lspconfig.phpactor.setup({
capabilities = capabilities,
})
-- CSS & SCSS support --$response
lspconfig.cssls.setup({
capabilities = capabilities,
})
-- Tailwind support --
lspconfig.tailwindcss.setup({
capabilities = capabilities,
})
-- JavaScript & TypeScript support --
lspconfig.tsserver.setup({
capabilities = capabilities,
})
-- Stimulus support --
lspconfig.stimulus_ls.setup({
capabilities = capabilities,
})
-- Svelte support --
lspconfig.svelte.setup({
capabilities = capabilities,
})
-- Vue support --
lspconfig.volar.setup({
capabilities = capabilities,
})
-- Go support --
lspconfig.gopls.setup({
capabilities = capabilities,
})
-- Rust support --
lspconfig.rust_analyzer.setup({
capabilities = capabilities,
})
-- Java support --
lspconfig.jdtls.setup({
capabilities = capabilities,
})
-- Kotlin support --
lspconfig.kotlin_language_server.setup({
capabilities = capabilities,
})
-- Python support --
lspconfig.pylsp.setup({
capabilities = capabilities,
})
-- Eslint support --
lspconfig.eslint.setup({
capabilities = capabilities,
})
-- Keybinding --
vim.keymap.set("n", "<leader>cd", vim.lsp.buf.hover, { desc = "Show Code Definition" })
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, { desc = "Go to Definition" })
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, { desc = "Go to References" })
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Do Code Actions" })
end,
}
}

View file

@ -0,0 +1,40 @@
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
-- Setup --
local null_ls = require("null-ls")
null_ls.setup({
sources = {
-- Prettier --
null_ls.builtins.formatting.prettier,
-- Php --
null_ls.builtins.diagnostics.phpstan,
null_ls.builtins.formatting.phpcsfixer.with({
prefer_local = "vendor/bin/php-cs-fixer",
args = { "fix", "--allow-risky=yes", "$FILENAME" }
}),
-- Twig --
null_ls.builtins.diagnostics.twigcs,
-- JavaScript & Typescript
null_ls.builtins.formatting.eslint_d,
-- Lua --
null_ls.builtins.formatting.stylua,
-- Go --
null_ls.builtins.formatting.gofumpt,
null_ls.builtins.code_actions.gomodifytags,
null_ls.builtins.code_actions.impl
},
})
-- Keybinding --
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, { desc = "Format Code" })
end,
}

View file

@ -0,0 +1,16 @@
return {
"folke/neodev.nvim",
dependencies = {
"rcarriga/nvim-dap-ui",
},
config = function()
require("neodev").setup({
library = {
plugins = {
"nvim-dap-ui",
},
types = true,
},
})
end,
}

View file

@ -0,0 +1,61 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
config = function()
-- Setup --
require("neo-tree").setup({
close_if_last_window = false,
enable_git_status = true,
enable_diagnostics = true,
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
-- Git Change type Icon --
added = "",
modified = "",
deleted = "",
renamed = "󰁕",
-- Git Status type Icon --
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
conflict = "",
}
},
symlink_target = {
enabled = false,
},
filesystem = {
hijack_netrw_behavior = "open_default"
}
})
-- Dignostic Icons --
vim.fn.sign_define("DiagnosticSignError", {
text = "", texthl = "DiagnosticSignError"
})
vim.fn.sign_define("DiagnosticSignWarn", {
text = "", texthl = "DiagnosticSignWarn"
})
vim.fn.sign_define("DiagnosticSignInfo", {
text = "", texthl = "DiagnosticSignInfo"
})
vim.fn.sign_define("DiagnosticSignHint", {
text = "󰌵", texthl = "DiagnosticSignHint"
})
-- Keybinding --
vim.keymap.set("n", "<C-n>", ":Neotree toggle reveal left<CR>", { desc = "Toggle File Tree" })
vim.keymap.set("n", "<leader>bf", ":Neotree buffers reveal float<CR>", { desc = "Show Open Files" })
end,
}

View file

@ -0,0 +1,17 @@
return {
{
"tpope/vim-fugitive",
},
{
"lewis6991/gitsigns.nvim",
config = function()
-- Setup --
require("gitsigns").setup()
-- Keybinding --
vim.keymap.set("n", "<leader>gh", ":Gitsigns preview_hunk_inline<CR>", { desc = "Toggle Inline Git Diff" })
vim.keymap.set("n", "<leader>gb", ":Gitsigns toggle_current_line_blame<CR>", { desc = "Toggle Inline Git Blame" })
vim.keymap.set("n", "<leader>go", ":Git <CR>", { desc = "Open Git" })
end,
},
}

View file

@ -0,0 +1,10 @@
return {
"folke/which-key.nvim",
config = function()
vim.o.timeout = true;
vim.o.timeoutlen = 300
require("which-key").setup({
})
end
}

View file

@ -0,0 +1,60 @@
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-ui-select.nvim"
},
config = function()
-- Setup --
require("telescope").setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown({}),
},
},
})
require("telescope").load_extension("ui-select")
-- Keybinding --
vim.keymap.set(
"n",
"<leader>ff",
function()
local telescope = require("telescope.builtin")
local state = require("neo-tree.sources.manager").get_state("filesystem")
telescope.find_files({ search_dirs = { state.path } })
end,
{ desc = "Find File" }
)
vim.keymap.set(
"n",
"<leader>fz",
function()
local telescope = require("telescope.builtin")
local state = require("neo-tree.sources.manager").get_state("filesystem")
telescope.live_grep({ search_dirs = { state.path } })
end,
{ desc = "Fuzzy Find" }
)
vim.keymap.set(
"n",
"<leader>gff",
function()
local telescope = require("telescope.builtin")
telescope.find_files({ search_dirs = { "~" } })
end,
{ desc = "Global Find File" }
)
vim.keymap.set(
"n",
"<leader>gfz",
function()
local telescope = require("telescope.builtin")
telescope.live_grep({ search_dirs = { "~" } })
end,
{ desc = "Global Fuzzy Find" }
)
end
}

View file

@ -0,0 +1,60 @@
return {
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
-- Setup --
require("lualine").setup({
options = {
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
"neo-tree",
"fugitive",
"help",
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_x = { "location" },
lualine_y = { "encoding" },
lualine_z = { "filetype" },
},
inactive_sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_x = { "location" },
lualine_y = { "encoding" },
lualine_z = { "filetype" },
},
tabline = {},
winbar = {
lualine_a = { "filename" },
},
inactive_winbar = {
lualine_a = { "filename" },
},
extensions = {},
})
end,
},
{
"romgrk/barbar.nvim",
dependencies = {
"lewis6991/gitsigns.nvim",
"nvim-tree/nvim-web-devicons",
},
config = function()
require("barbar").setup()
end,
},
}

View file

@ -0,0 +1,39 @@
return {
"caenrique/buffer-term.nvim",
config = function()
local buffer_term = require("buffer-term")
buffer_term.setup()
vim.keymap.set({ "n", "t" }, "<F6>", buffer_term.toggle_last)
vim.keymap.set({ "n", "t" }, "<F6>0", function()
buffer_term.toggle("0")
end)
vim.keymap.set({ "n", "t" }, "<F6>1", function()
buffer_term.toggle("1")
end)
vim.keymap.set({ "n", "t" }, "<F6>2", function()
buffer_term.toggle("2")
end)
vim.keymap.set({ "n", "t" }, "<F6>3", function()
buffer_term.toggle("3")
end)
vim.keymap.set({ "n", "t" }, "<F6>4", function()
buffer_term.toggle("4")
end)
vim.keymap.set({ "n", "t" }, "<F6>5", function()
buffer_term.toggle("5")
end)
vim.keymap.set({ "n", "t" }, "<F6>6", function()
buffer_term.toggle("6")
end)
vim.keymap.set({ "n", "t" }, "<F6>7", function()
buffer_term.toggle("7")
end)
vim.keymap.set({ "n", "t" }, "<F6>8", function()
buffer_term.toggle("8")
end)
vim.keymap.set({ "n", "t" }, "<F6>9", function()
buffer_term.toggle("9")
end)
end,
}

View file

@ -0,0 +1,9 @@
return {
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
config = function()
-- Set Theme --
vim.cmd("colorscheme catppuccin")
end
}