Setup
This commit is contained in:
parent
81116c962a
commit
095c6182eb
21 changed files with 562 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,4 +5,4 @@
|
|||
!.gitignore
|
||||
|
||||
# Include NVim
|
||||
!nvim
|
||||
!/nvim/**/*
|
||||
|
|
5
nvim/.luarc.json
Normal file
5
nvim/.luarc.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"diagnostics.globals": [
|
||||
"vim"
|
||||
]
|
||||
}
|
1
nvim/init.lua
Normal file
1
nvim/init.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require('core')
|
2
nvim/lua/core/init.lua
Normal file
2
nvim/lua/core/init.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
require("vim-config")
|
||||
require("core.packagemanager")
|
15
nvim/lua/core/packagemanager.lua
Normal file
15
nvim/lua/core/packagemanager.lua
Normal 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", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local opts = {}
|
||||
require("lazy").setup("plugins", opts)
|
1
nvim/lua/plugins.lua
Normal file
1
nvim/lua/plugins.lua
Normal file
|
@ -0,0 +1 @@
|
|||
return {}
|
6
nvim/lua/plugins/code-autobrackets.lua
Normal file
6
nvim/lua/plugins/code-autobrackets.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
'm4xshen/autoclose.nvim',
|
||||
config = function ()
|
||||
require("autoclose").setup()
|
||||
end
|
||||
}
|
13
nvim/lua/plugins/code-highliting.lua
Normal file
13
nvim/lua/plugins/code-highliting.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
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
|
||||
}
|
40
nvim/lua/plugins/code-lsp-extra.lua
Normal file
40
nvim/lua/plugins/code-lsp-extra.lua
Normal 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, {})
|
||||
end,
|
||||
}
|
162
nvim/lua/plugins/code-lsp.lua
Normal file
162
nvim/lua/plugins/code-lsp.lua
Normal file
|
@ -0,0 +1,162 @@
|
|||
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
|
||||
})
|
||||
|
||||
-- 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", "K", vim.lsp.buf.hover, {})
|
||||
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, {})
|
||||
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, {})
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
|
||||
end
|
||||
}
|
||||
}
|
71
nvim/lua/plugins/code-snippets.lua
Normal file
71
nvim/lua/plugins/code-snippets.lua
Normal file
|
@ -0,0 +1,71 @@
|
|||
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 })
|
||||
-- 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({
|
||||
-- Keybinding --
|
||||
["<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 }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
}, { { name = "buffer" } }),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
32
nvim/lua/plugins/dashboard.lua
Normal file
32
nvim/lua/plugins/dashboard.lua
Normal 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,
|
||||
}
|
29
nvim/lua/plugins/debugging.lua
Normal file
29
nvim/lua/plugins/debugging.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
},
|
||||
config = function()
|
||||
-- Setup --
|
||||
local dap = require("dap")
|
||||
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>dt", ":DapToggleBreakpoint<CR>")
|
||||
vim.keymap.set("n", "<Leader>dc", ":DapContinue<CR>")
|
||||
vim.keymap.set("n", "<Leader>dx", ":DapTerminate<CR>")
|
||||
vim.keymap.set("n", "<Leader>do", ":DapStepOver<CR>")
|
||||
end,
|
||||
}
|
60
nvim/lua/plugins/editor-bar.lua
Normal file
60
nvim/lua/plugins/editor-bar.lua
Normal 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,
|
||||
},
|
||||
}
|
61
nvim/lua/plugins/file-tree.lua
Normal file
61
nvim/lua/plugins/file-tree.lua
Normal 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 filesystem reveal left<CR>", {})
|
||||
vim.keymap.set("n", "<leader>bf", ":Neotree buffers reveal float<CR>", {})
|
||||
end,
|
||||
}
|
17
nvim/lua/plugins/git.lua
Normal file
17
nvim/lua/plugins/git.lua
Normal 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>", {})
|
||||
vim.keymap.set("n", "<leader>gb", ":Gitsigns toggle_current_line_blame<CR>", {})
|
||||
vim.keymap.set("n", "<leader>go", ":Git <CR>", {})
|
||||
end,
|
||||
},
|
||||
}
|
24
nvim/lua/plugins/search.lua
Normal file
24
nvim/lua/plugins/search.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
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 --
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<C-p>", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
|
||||
end
|
||||
}
|
9
nvim/lua/plugins/theme.lua
Normal file
9
nvim/lua/plugins/theme.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
-- Set Theme --
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
end
|
||||
}
|
8
nvim/lua/vim-config/editor.lua
Normal file
8
nvim/lua/vim-config/editor.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
-- Use 2 Spaces Instead of Tabs --
|
||||
vim.cmd("set expandtab")
|
||||
vim.cmd("set tabstop=1")
|
||||
vim.cmd("set softtabstop=2")
|
||||
vim.cmd("set shiftwidth=2")
|
||||
|
||||
-- Enable Line Number --
|
||||
vim.cmd("set number")
|
2
nvim/lua/vim-config/init.lua
Normal file
2
nvim/lua/vim-config/init.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
require("vim-config.editor")
|
||||
require("vim-config.keymap")
|
3
nvim/lua/vim-config/keymap.lua
Normal file
3
nvim/lua/vim-config/keymap.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<Tab>", ">>")
|
||||
vim.keymap.set("n", "<S-Tab>", "<<")
|
Loading…
Reference in a new issue