This commit is contained in:
2024-10-07 22:30:54 +01:00
parent 7080c2325f
commit 7456f414e1
3 changed files with 112 additions and 5 deletions

View File

@ -1,5 +1,5 @@
require("./mappings") -- Leader
require("./lazy") vim.g.mapleader = " "
-- Guard (Linters + Formatters) -- Guard (Linters + Formatters)
vim.g.guard_config = { vim.g.guard_config = {
@ -10,3 +10,61 @@ vim.g.guard_config = {
-- Sync system clipboard and neovim register -- Sync system clipboard and neovim register
vim.opt.clipboard = { "unnamedplus" } vim.opt.clipboard = { "unnamedplus" }
-- Save undo history
vim.opt.undofile = true
--
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Modules --
-- Lazy = Package Manager --
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)
require("lazy").setup("plugins")
vim.cmd("colorscheme everblush")
-- Mappings
-- Save --
vim.keymap.set("n", "<C-s>", "<Cmd>w<CR>")
-- Split navigation --
vim.keymap.set("n", "<C-h>", "<C-w>h")
vim.keymap.set("n", "<C-j>", "<C-w>j")
vim.keymap.set("n", "<C-k>", "<C-w>k")
vim.keymap.set("n", "<C-l>", "<C-w>l")
-- Buffers --
vim.keymap.set("n", "<leader>x", "<Cmd>bd<CR>")
-- Telescope Mappings --
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
vim.keymap.set("n", "<leader>fw", builtin.live_grep, { desc = "Telescope live grep" })
-- Neo Tree --
vim.keymap.set("n", "<C-n>", "<Cmd> Neotree toggle <CR>")
vim.keymap.set("n", "<leader>e", "<Cmd> Neotree focus <CR>")
-- LSP --
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action)

View File

@ -1,13 +1,17 @@
{ {
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"everblush": { "branch": "main", "commit": "9a0e695fdd57b340d3ba2b72406e3ca519029f25" },
"guard-collection": { "branch": "main", "commit": "06da4a065b974bbedf1a5535232c90a3526f8a43" }, "guard-collection": { "branch": "main", "commit": "06da4a065b974bbedf1a5535232c90a3526f8a43" },
"guard.nvim": { "branch": "main", "commit": "bdbc43dadd530b0058708723db76e705a4542063" }, "guard.nvim": { "branch": "main", "commit": "bdbc43dadd530b0058708723db76e705a4542063" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-cmp": { "branch": "main", "commit": "d3a3056204e1a9dbb7c7fe36c114dc43b681768c" },
"nvim-lspconfig": { "branch": "master", "commit": "38da5bbe1eaab2394056109e48c7e195bdb8fdfe" }, "nvim-lspconfig": { "branch": "master", "commit": "38da5bbe1eaab2394056109e48c7e195bdb8fdfe" },
"nvim-treesitter": { "branch": "master", "commit": "0179a89656b4ce395a4487c07ae385b8425524ae" }, "nvim-treesitter": { "branch": "master", "commit": "0179a89656b4ce395a4487c07ae385b8425524ae" },
"nvim-web-devicons": { "branch": "master", "commit": "f0267921c845c42685968401bc49aa65e18d3e09" }, "nvim-web-devicons": { "branch": "master", "commit": "f0267921c845c42685968401bc49aa65e18d3e09" },
"nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, "nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"telescope.nvim": { "branch": "master", "commit": "74ce793a60759e3db0d265174f137fb627430355" } "telescope.nvim": { "branch": "master", "commit": "74ce793a60759e3db0d265174f137fb627430355" },
"vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" }
} }

View File

@ -1,4 +1,34 @@
return { return {
{ "Everblush/nvim", name = "everblush" },
{ "hrsh7th/vim-vsnip" },
{ "hrsh7th/cmp-nvim-lsp" },
{
"hrsh7th/nvim-cmp",
config = function()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
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 }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "vsnip" },
}, {
{ name = "buffer" },
}),
})
end,
},
{ {
"nvimdev/guard.nvim", "nvimdev/guard.nvim",
-- Builtin configuration, optional -- Builtin configuration, optional
@ -23,7 +53,7 @@ return {
local configs = require("nvim-treesitter.configs") local configs = require("nvim-treesitter.configs")
configs.setup({ configs.setup({
ensure_installed = { "lua", "javascript", "typescript", "html" }, ensure_installed = { "lua", "javascript", "typescript", "html", "tsx" },
sync_install = false, sync_install = false,
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
@ -42,6 +72,12 @@ return {
"s1n7ax/nvim-window-picker", "s1n7ax/nvim-window-picker",
version = "2.*", version = "2.*",
config = function() config = function()
require("neo-tree").setup({
update_focused_file = {
enable = true,
},
})
require("window-picker").setup({ require("window-picker").setup({
filter_rules = { filter_rules = {
include_current_win = false, include_current_win = false,
@ -66,8 +102,13 @@ return {
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { "hrsh7th/cmp-nvim-lsp" },
config = function() config = function()
require("lspconfig").lua_ls.setup({ local lsp = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
lsp.lua_ls.setup({
capabilities = capabilities,
settings = { settings = {
Lua = { Lua = {
diagnostics = { globals = { "vim", "require" } }, diagnostics = { globals = { "vim", "require" } },
@ -78,6 +119,10 @@ return {
}, },
}, },
}) })
lsp.vtsls.setup({
capabilities = capabilities,
})
end, end,
}, },
} }