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

@ -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"}
}
}