added neovim config and basic README.md

This commit is contained in:
devaine 2024-11-12 21:40:50 -06:00
commit 56bca305b2
No known key found for this signature in database
GPG key ID: BB0EAF4E85E4DE98
12 changed files with 312 additions and 1 deletions

View file

@ -1,3 +1,9 @@
# nvim
neovim config :>
## Required Software to Install
* `ripgrep` - Treesitter
* `gcc` - Compiling LuaSnip
* `zip` and `unzip`

2
init.lua Normal file
View file

@ -0,0 +1,2 @@
require("core.lazy")
require("core.config.custom") -- Custom config

28
lazy-lock.json Normal file
View file

@ -0,0 +1,28 @@
{
"LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"kanagawa.nvim": { "branch": "master", "commit": "ad3dddecd606746374ba4807324a08331dfca23c" },
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
"lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
"nvim-dap": { "branch": "master", "commit": "8517126e9323e346f6a99b3b594c5a940b914dcd" },
"nvim-highlight-colors": { "branch": "main", "commit": "e967e2ba13fd4ca731b41d0e5cc1ac2edcd6e25e" },
"nvim-java": { "branch": "main", "commit": "905013eb83c58bda992724b3ecbe20f60b58513f" },
"nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" },
"nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" },
"nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" },
"nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" },
"nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" },
"nvim-tree.lua": { "branch": "master", "commit": "c7639482a1598f4756798df1b2d72f79fe5bb34f" },
"nvim-treesitter": { "branch": "master", "commit": "7646c1c12a3121562aa87fd79aace48c728ac096" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"typescript-language-server": { "branch": "master", "commit": "184c60de3308621380469d6632bdff2e10f672fd" }
}

View file

@ -0,0 +1,22 @@
local opt = vim.opt
opt.guicursor = "" -- For indentation
opt.relativenumber = true
opt.number = true
opt.tabstop = 2
opt.softtabstop = 2
opt.shiftwidth = 2
opt.smartindent = true
opt.hlsearch = false
opt.incsearch = true
opt.termguicolors = true
vim.g.rust_recommended_style = 0
local setkb = vim.keymap.set
setkb('n', '<M-v>', '<C-v>')

36
lua/core/lazy.lua Normal file
View file

@ -0,0 +1,36 @@
-- 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 = "core.plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "kanagawa-dragon" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

View file

@ -0,0 +1,45 @@
-- https://github.com/hrsh7th/nvim-cmp
-- Basically a completion plugin for neovim
return {
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
{ "L3MON4D3/LuaSnip",
build = "make install_jsregexp"
},
"saadparwaiz1/cmp_luasnip",
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<Tab>'] = cmp.mapping.select_next_item(),
['<S-Tab>'] = cmp.mapping.select_prev_item(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }
}),
formatting = {
format = require("nvim-highlight-colors").format
}
})
end
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true
}
}

View file

@ -0,0 +1,11 @@
return {
{
"rebelot/kanagawa.nvim",
lazy = false,
priority = 1000,
config = function()
-- loads colorscheme
vim.cmd([[colorscheme kanagawa-dragon]])
end,
},
}

View file

@ -0,0 +1,8 @@
-- For more information: https://github.com/brenoprata10/nvim-highlight-colors
return {
"brenoprata10/nvim-highlight-colors",
config = function ()
require("nvim-highlight-colors").setup({})
end
}

100
lua/core/plugins/lsp.lua Normal file
View file

@ -0,0 +1,100 @@
return {
-- Java
-- For checksums: https://github.com/mfussenegger/nvim-jdtls/discussions/249#discussioncomment-3159367
-- It's here first because it needs to have load before lspconfig apparently
{
"nvim-java/nvim-java",
dependencies = {
"neovim/nvim-lspconfig",
},
config = function()
require("java").setup()
require("lspconfig").jdtls.setup({})
end
},
--
-- https://github.com/williamboman/mason.nvim?tab=readme-ov-file#configuration for more information
-- https://github.com/williamboman/mason-lspconfig.nvim?tab=readme-ov-file#setup for more info
{ "williamboman/mason.nvim",
dependencies = {
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig", -- https://github.com/neovim/nvim-lspconfig for more information
},
opts = function()
require("mason").setup({
registries = {
"github:nvim-java/mason-registry",
"github:mason-org/mason-registry"
}
})
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"pylsp",
"clangd",
"bashls",
"ts_ls",
"eslint",
"cssls",
"html",
}
})
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require("lspconfig")
-- LSP Servers
lspconfig.lua_ls.setup {
capabilities = capabilities
}
-- FOR bashls
-- Make sure to install 'shellcheck', :MasonInstall shellcheck
-- Make sure to install 'shfmt', :MasonInstall shfmt
lspconfig.bashls.setup {
capabilities = capabilities
}
lspconfig.pylsp.setup {}
lspconfig.clangd.setup{
cmd = { "clangd", "--background-index", "--clang-tidy", "--log=verbose", "--query-driver=/usr/bin/c++", "--suggest-missing-includes", "--all-scopes-completion", "--completion-style=detailed" },
init_options = {
fallback_flags = { "-std=c++17" },
},
capabilities = capabilities
}
lspconfig.ts_ls.setup {
capabilities = capabilities,
init_options = {
preferences = {
disableSuggestions = true
}
}
}
lspconfig.eslint.setup {
capabilities = capabilities
}
lspconfig.html.setup {
capabilities = capabilities,
}
lspconfig.cssls.setup {
capabilities = capabilities
}
end
},
-- Javascript and/or Typescript
{
"typescript-language-server/typescript-language-server"
}
}

View file

@ -0,0 +1,12 @@
-- https://github.com/nvim-tree/nvim-tree.lua?tab=readme-ov-file -- For more information
return {
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup {}
end,
}

View file

@ -0,0 +1,14 @@
-- For more information on the arguements, visit: https://www.lazyvim.org/extras/editor/telescope#telescopenvim OR for more information on telescope, visit: https://github.com/nvim-telescope/telescope.nvim
return {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' },
cmd = "Telescope",
keys = {
{ "<leader>//", "<cmd>Telescope<cr>", desc = "Start" },
{ "<leader>pp", "<cmd>Telescope find_files<cr>", desc = "File Picker" },
{ "<leader>;;", "<cmd>Telescope buffers<cr>", desc = "Buffer Picker" },
{ "<leader>..", "<cmd>Telescope treesitter<cr>", desc = "Treesitter" },
{ "<leader>[[", "<cmd>Telescop live_grep<cr>", desc = "Grep" }
}
}

View file

@ -0,0 +1,27 @@
-- https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#language-parsers for language parsers
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufRead",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "lua", "cpp", "java", "javascript", "bash", "python", "typescript", "css", "html", "jsdoc" },
sync_install = true,
auto_intsall = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
ident = { enable = true },
autopairs = {
enable = true
}
})
end,
keys = {
{ "<leader>mm", "<cmd>NvimTreeToggle<cr>", desc = "Toggle Tree"}
}
}