Initial commit.

This commit is contained in:
Dan Chadwick 2024-03-03 18:01:30 -05:00
commit 914f9ea767
15 changed files with 403 additions and 0 deletions

5
.luarc.json Normal file
View File

@ -0,0 +1,5 @@
{
"diagnostics.globals": [
"vim"
]
}

16
init.lua Normal file
View File

@ -0,0 +1,16 @@
require("dan.core")
-- Lazy VIM --
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)
require("lazy").setup("plugins")

23
lazy-lock.json Normal file
View File

@ -0,0 +1,23 @@
{
"LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
"alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
"harpoon": { "branch": "harpoon2", "commit": "a38be6e0dd4c6db66997deab71fc4453ace97f9c" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
"lazygit.nvim": { "branch": "main", "commit": "10a5f30536dc2d4abe36d410d83149272ea457fa" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" },
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f3941c57ec85d7bdb44fa53fd858fd80f159018f" },
"nui.nvim": { "branch": "main", "commit": "b81333d12f824dbed5eb231c8a4409a290fdd848" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-lspconfig": { "branch": "master", "commit": "c932a56bf25167b1e88d2a1ebe35bb774b41019a" },
"nvim-treesitter": { "branch": "master", "commit": "6e2b56cbe75ddf18e6efecee44bc3936d70b0b3e" },
"nvim-web-devicons": { "branch": "master", "commit": "4adea17610d140a99c313e3f79a9dc01825d59ae" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"rose-pine": { "branch": "main", "commit": "f977eeba34b030b37f93ece2fbd792477606203b" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }
}

15
lua/dan/core.lua Normal file
View File

@ -0,0 +1,15 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "<leader>gg", vim.cmd.LazyGit)
vim.cmd("set expandtab")
vim.cmd("set tabstop=2")
vim.cmd("set softtabstop=2")
vim.cmd("set shiftwidth=2")
vim.cmd("set syntax=on")
vim.cmd("set number")
vim.cmd("set nu")
vim.cmd("set relativenumber")
vim.cmd("set rnu")
vim.cmd("set number relativenumber")
vim.cmd("set nu rnu")
vim.api.nvim_set_option("clipboard","unnamed")

2
lua/plugins.lua Normal file
View File

@ -0,0 +1,2 @@
return {
}

76
lua/plugins/alpha.lua Normal file
View File

@ -0,0 +1,76 @@
return {
"goolord/alpha-nvim",
event = "VimEnter", -- load plugin after all configuration is set
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[  ]],
[[ ████ ██████ █████ ██ ]],
[[ ███████████ █████  ]],
[[ █████████ ███████████████████ ███ ███████████ ]],
[[ █████████ ███ █████████████ █████ ██████████████ ]],
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
[[ ]],
[[ ]],
[[ ]],
}
_Gopts = {
position = "center",
hl = "Type",
-- wrap = "overflow";
}
-- Set menu
dashboard.section.buttons.val = {
-- dashboard.button("SPC j", "󰈚 Restore Session", ":SessionRestore<cr>"),
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("f", " Find file", ":cd $HOME/dotfiles/.config | Telescope find_files<CR>"),
dashboard.button("g", "󰱼 Find word", ":Telescope live_grep<CR>"),
dashboard.button("r", " Recent", ":Telescope oldfiles<CR>"),
dashboard.button("c", " Config", ":e $MYVIMRC <CR>"),
dashboard.button("m", "󱌣 Mason", ":Mason<CR>"),
dashboard.button("l", "󰒲 Lazy", ":Lazy<CR>"),
dashboard.button("u", "󰂖 Update plugins", "<cmd>lua require('lazy').sync()<CR>"),
dashboard.button("q", " Quit NVIM", ":qa<CR>"),
}
--local function footer()
--return "Mohammed Babiker Babai"
--end
--dashboard.section.footer.val = footer()
dashboard.opts.opts.noautocmd = true
alpha.setup(dashboard.opts)
require("alpha").setup(dashboard.opts)
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
local stats = require("lazy").stats()
local count = (math.floor(stats.startuptime * 100) / 100)
dashboard.section.footer.val = {
"󱐌 " .. stats.count .. " plugins loaded in " .. count .. " ms"
}
pcall(vim.cmd.AlphaRedraw)
end,
})
end,
}

View File

@ -0,0 +1,44 @@
return {
{
"hrsh7th/cmp-nvim-lsp"
},
{
"L3MON4D3/LuaSnip",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets"
}
},
{
"hrsh7th/nvim-cmp",
config = function()
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
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 = 'vsnip' }, -- For vsnip users.
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
end
},
}

38
lua/plugins/harpoon.lua Normal file
View File

@ -0,0 +1,38 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim"
},
config = function()
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
-- basic telescope configuration
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require("telescope.pickers").new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
}):find()
end
vim.keymap.set("n", "<C-h>", function() toggle_telescope(harpoon:list()) end, { desc = "Open harpoon window" })
vim.keymap.set("n", "<leader>a", function() harpoon:list():append() end)
vim.keymap.set("n", "<leader>c", function() harpoon:list():clear() end)
vim.keymap.set("n", "<leader>r", function() harpoon:list():remove() end)
-- vim.keymap.set("n", "<C-h>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
-- Toggle previous & next buffers stored within Harpoon list
-- vim.keymap.set("n", "<C-S-P>", function() harpoon:list():prev() end)
-- vim.keymap.set("n", "<C-S-N>", function() harpoon:list():next() end)
end
}

6
lua/plugins/lazygit.lua Normal file
View File

@ -0,0 +1,6 @@
return {
"kdheepak/lazygit.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
}
}

View File

@ -0,0 +1,33 @@
return {
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls", "phpactor" }
})
end
},
{
"neovim/nvim-lspconfig",
config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({
capabilities = capabilities
})
lspconfig.phpactor.setup({
capabilities = capabilities
})
vim.keymap.set("n", 'K', vim.lsp.buf.hover, {})
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set({ 'n' }, '<leader>ca', vim.lsp.buf.code_action, {})
end
}
}

13
lua/plugins/lualine.lua Normal file
View File

@ -0,0 +1,13 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = {
'nvim-tree/nvim-web-devicons'
},
config = function()
require('lualine'). setup({
options= {
theme = 'dracula'
}
})
end
}

12
lua/plugins/neotree.lua Normal file
View File

@ -0,0 +1,12 @@
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()
vim.keymap.set("n", "<C-n>", ':Neotree filesystem reveal left<CR>', {})
end
}

73
lua/plugins/rose-pine.lua Normal file
View File

@ -0,0 +1,73 @@
return {
'rose-pine/neovim',
name = 'rose-pine',
config = function()
require("rose-pine").setup({
variant = "moon", -- auto, main, moon, or dawn
dark_variant = "main", -- main, moon, or dawn
dim_inactive_windows = false,
extend_background_behind_borders = true,
enable = {
terminal = true,
legacy_highlights = true, -- Improve compatibility for previous versions of Neovim
migrations = true, -- Handle deprecated options automatically
},
styles = {
bold = false,
italic = false,
transparency = false,
},
groups = {
border = "muted",
link = "iris",
panel = "surface",
error = "love",
hint = "iris",
info = "foam",
note = "pine",
todo = "rose",
warn = "gold",
git_add = "foam",
git_change = "rose",
git_delete = "love",
git_dirty = "rose",
git_ignore = "muted",
git_merge = "iris",
git_rename = "pine",
git_stage = "iris",
git_text = "rose",
git_untracked = "subtle",
h1 = "iris",
h2 = "foam",
h3 = "rose",
h4 = "gold",
h5 = "pine",
h6 = "foam",
},
highlight_groups = {
-- Comment = { fg = "foam" },
-- VertSplit = { fg = "muted", bg = "muted" },
},
before_highlight = function(group, highlight, palette)
-- Disable all undercurls
-- if highlight.undercurl then
-- highlight.undercurl = false
-- end
--
-- Change palette colour -- if highlight.fg == palette.pine then
-- highlight.fg = palette.foam
-- end
end,
})
vim.cmd("colorscheme rose-pine")
end
}

33
lua/plugins/telescope.lua Normal file
View File

@ -0,0 +1,33 @@
return {
{
'nvim-telescope/telescope.nvim',
tag = '0.1.5',
dependencies = {
'nvim-lua/plenary.nvim'
},
config = function()
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
end
},
{
"nvim-telescope/telescope-ui-select.nvim",
config = function()
-- This is your opts table
require("telescope").setup {
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
}
}
}
}
-- To get ui-select loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require("telescope").load_extension("ui-select")
end
}
}

View File

@ -0,0 +1,14 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "php", "lua", "vim", "javascript", "html", "yaml" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end
}