fix(config): new config, it's been a while
This commit is contained in:
commit
1fe92c532b
11 changed files with 385 additions and 0 deletions
2
init.lua
Normal file
2
init.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
require("config.vim")
|
||||
require("config.lazy")
|
||||
22
lazy-lock.json
Normal file
22
lazy-lock.json
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
|
||||
"conform.nvim": { "branch": "master", "commit": "9fd3d5e0b689ec1bf400c53cbbec72c6fdf24081" },
|
||||
"cord.nvim": { "branch": "master", "commit": "1aadec47743e6cfe77ae6860a5b4305a465f03be" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "ed4dc336a73c18da6fea6e1cf7ad6e1b76d281eb" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1d77bd86e1c3eaa777010c95dad455b83823f247" },
|
||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
|
||||
"nvim-eslint": { "branch": "main", "commit": "e052854a05c0e247c0fc886bcff7c8ef9d54c2b9" },
|
||||
"nvim-highlight-colors": { "branch": "main", "commit": "e0c4a58ec8c3ca7c92d3ee4eb3bc1dd0f7be317e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a9b2fb560c4ab22c10728fd5149dbd7b62aa4f69" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" }
|
||||
}
|
||||
28
lua/config/lazy.lua
Normal file
28
lua/config/lazy.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
-- 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)
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- plugin import
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
install = {},
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
54
lua/config/vim.lua
Normal file
54
lua/config/vim.lua
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
-- set the leader
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- neovim/vim variables
|
||||
local opt = vim.opt
|
||||
local keybind = vim.keymap.set
|
||||
|
||||
-- basic
|
||||
opt.relativenumber = true
|
||||
opt.number = true
|
||||
opt.termguicolors = true
|
||||
|
||||
-- indentation
|
||||
opt.tabstop = 2
|
||||
opt.softtabstop = 0
|
||||
opt.shiftwidth = 2
|
||||
opt.smarttab = true
|
||||
opt.smartindent = true
|
||||
|
||||
-- searches
|
||||
opt.incsearch = true
|
||||
|
||||
-- mapleader
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- keybinds
|
||||
keybind("n", "<leader>hh", "<cmd>lua vim.diagnostic.setqflist()<CR>", { desc = "LSP Diagonistics" })
|
||||
|
||||
-- buffer keybinds
|
||||
keybind("n", "<leader>bb", "<cmd>bprevious<CR>", { desc = "Switch to previous buffer" })
|
||||
keybind("n", "<leader>nn", "<cmd>bnext<CR>", { desc = "Switch to next buffer" })
|
||||
keybind("n", "<leader>,,", "<cmd>bdel<CR>", { desc = "Delete Buffer" })
|
||||
|
||||
-- visual mode keybinds
|
||||
keybind("v", "<leader>ii", '"+y', { desc = "Copy to clipboard ( + yank)" })
|
||||
keybind("v", "<", "<gv", { desc = "Indent left and reselect" })
|
||||
keybind("v", ">", ">gv", { desc = "Indent right and reselect" })
|
||||
keybind("v", "<S-Up>", ":m '<-2<CR>gv", { desc = "Move selection up" })
|
||||
keybind("v", "<S-Down>", ":m '>+1<CR>gv", { desc = "Move selection down" })
|
||||
|
||||
-- friend keybinds
|
||||
keybind("i", "jk", "<Esc>", { desc = "Keybind set for Justin" })
|
||||
|
||||
-- file explorer
|
||||
keybind("n", "<leader>mm", "<Cmd>Neotree toggle<CR>", { desc = "Toggle File Explorer" })
|
||||
keybind("n", "<leader>jj", "<Cmd>Neotree action=focus<CR>", { desc = "Focus on file explorer" })
|
||||
|
||||
-- file handling
|
||||
opt.backup = false
|
||||
opt.writebackup = false
|
||||
opt.swapfile = false
|
||||
opt.undofile = true
|
||||
opt.undodir = vim.fn.expand("~/.nvim/undodir")
|
||||
opt.autoread = true
|
||||
39
lua/plugins/completion.lua
Normal file
39
lua/plugins/completion.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
return {
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
dependencies = {
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
},
|
||||
version = "1.*",
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = "none",
|
||||
['<Tab>'] = { 'select_next', 'fallback' },
|
||||
['<S-Tab>'] = { 'select_prev', 'fallback' },
|
||||
["<CR>"] = { 'select_and_accept', 'fallback' },
|
||||
['<C-e>'] = { 'hide', 'fallback' }
|
||||
},
|
||||
|
||||
completion = {
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
treesitter_highlighting = true
|
||||
},
|
||||
menu = { auto_show = true },
|
||||
ghost_text = { enabled = true }
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
},
|
||||
|
||||
signature = { enabled = true },
|
||||
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||
}
|
||||
}
|
||||
}
|
||||
84
lua/plugins/dev-utils.lua
Normal file
84
lua/plugins/dev-utils.lua
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
return {
|
||||
-- Parser that does syntax highlighting
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = 'master',
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
config = function ()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
"cpp",
|
||||
"java",
|
||||
"javascript",
|
||||
"bash",
|
||||
"python",
|
||||
"typescript",
|
||||
"css",
|
||||
"html",
|
||||
"jsdoc",
|
||||
"http",
|
||||
"sql",
|
||||
"ssh_config",
|
||||
"json",
|
||||
"tsx",
|
||||
"xml",
|
||||
"yaml",
|
||||
"nginx",
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"cmake"
|
||||
},
|
||||
indent = { enable = true },
|
||||
highlight = { enable = true }
|
||||
})
|
||||
end
|
||||
},
|
||||
|
||||
-- Allows pairs for {}, '', "", ()
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = true,
|
||||
opts = {}
|
||||
},
|
||||
|
||||
-- Allows automatic tagging on HTML or JSON (E.g: <div>test</div> )
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
config = function()
|
||||
require("nvim-ts-autotag").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Provides highlighting on TODO's, E.g:
|
||||
-- NOTE: This is a note.
|
||||
-- WARN: This is warning note.
|
||||
-- TODO: This is a to-do note.
|
||||
-- FIX: This is a fix note.
|
||||
-- PERF: This is a performance note.
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("todo-comments").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Allows highlighting for hexadecimal colors for RGB characters.
|
||||
-- E.g: #FFFFFF
|
||||
{
|
||||
"brenoprata10/nvim-highlight-colors",
|
||||
config = function()
|
||||
require("nvim-highlight-colors").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Shows line(s) indicating indentation.
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
16
lua/plugins/discord.lua
Normal file
16
lua/plugins/discord.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
-- Just Discord Rich Presence for Neovim, neat huh?
|
||||
return {
|
||||
"vyfor/cord.nvim",
|
||||
build = ":Cord update",
|
||||
config = function()
|
||||
require("cord").setup({
|
||||
display = {
|
||||
flavor = "dark",
|
||||
},
|
||||
text = {
|
||||
default = "programming most likely",
|
||||
workspace = "",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
18
lua/plugins/file-explorer.lua
Normal file
18
lua/plugins/file-explorer.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
lazy = false,
|
||||
opts = {
|
||||
window = {
|
||||
mappings = {
|
||||
["P"] = "toggle_preview",
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
38
lua/plugins/formatter.lua
Normal file
38
lua/plugins/formatter.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
-- Formatter plugin, helps with formatting code on saving the file.
|
||||
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
|
||||
-- This will provide type hinting with LuaLS
|
||||
---@module "conform"
|
||||
---@type conform.setupOpts
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
python = { "black" },
|
||||
javascript = { "prettier" }, -- add stop_after_first for n > 1
|
||||
typescript = { "prettier" },
|
||||
sh = { "shfmt", "shellcheck" },
|
||||
bash = { "shfmt", "shellcheck" },
|
||||
},
|
||||
formatters = {
|
||||
prettier = {
|
||||
prepend_args = function()
|
||||
return { "" }
|
||||
end,
|
||||
},
|
||||
},
|
||||
default_format_opts = {
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
},
|
||||
},
|
||||
|
||||
init = function()
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
end,
|
||||
}
|
||||
75
lua/plugins/lsp.lua
Normal file
75
lua/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
return {
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
dependencies = {
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
},
|
||||
opts = function()
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
-- Ensure the install of these language servers
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"clangd",
|
||||
"bashls",
|
||||
"ts_ls",
|
||||
"cssls",
|
||||
"html",
|
||||
"tailwindcss",
|
||||
"pylsp",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false,
|
||||
config = function()
|
||||
local caps = vim.lsp.protocol.make_client_capabilities()
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities(caps)
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
vim.lsp.config("*", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("ts_ls", {
|
||||
init_options = { preferences = { disableSuggestions = false } },
|
||||
})
|
||||
|
||||
vim.lsp.enable({
|
||||
"lua_ls",
|
||||
"clangd",
|
||||
"bashls",
|
||||
"ts_ls",
|
||||
"cssls",
|
||||
"html",
|
||||
"tailwindcss",
|
||||
"pylsp",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"esmuellert/nvim-eslint",
|
||||
config = function()
|
||||
require("nvim-eslint").setup({
|
||||
settings = {
|
||||
workingDirectory = function(bufnr)
|
||||
return { directory = vim.fs.root(bufnr, { "package.json" }) }
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
9
lua/plugins/ui.lua
Normal file
9
lua/plugins/ui.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
-- Colorscheme
|
||||
{
|
||||
"rebelot/kanagawa.nvim",
|
||||
config = function()
|
||||
vim.cmd([[colorscheme kanagawa-dragon]])
|
||||
end,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue