Added plugins and keymaps

This commit is contained in:
2024-08-18 00:05:19 +02:00
parent 173643186e
commit 7cb6bbef83
4 changed files with 78 additions and 0 deletions

View File

@ -1 +1,5 @@
require("settings")
require("keymaps")
-- Plugins
require("lazy-nvim")

View File

@ -0,0 +1,37 @@
-- Map the leader to space
vim.g.mapleader = " "
-- Remove search highlight with Esc
vim.keymap.set("n", "<Esc>", ":noh<CR>")
-- Center the screen whenever I move by a large amount
--
-- Inspired by ThePrimeagen dotfiles
-- https://github.com/ThePrimeagen/init.lua/blob/e148c2cd/lua/theprimeagen/remap.lua#L9
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzz")
vim.keymap.set("n", "N", "Nzz")
vim.keymap.set("n", "}", "}zz")
vim.keymap.set("n", "{", "{zz")
vim.keymap.set("n", "%", "%zz")
-- Navigate splits
vim.keymap.set("n", "<C-h>", "<C-w>h", { desc = "Go to the left buffer" })
vim.keymap.set("n", "<C-j>", "<C-w>j", { desc = "Go to the bottom buffer" })
vim.keymap.set("n", "<C-k>", "<C-w>k", { desc = "Go to the top buffer" })
vim.keymap.set("n", "<C-l>", "<C-w>l", { desc = "Go to the right buffer" })
vim.keymap.set("n", "<C-A-h>", "<C-w>H", { desc = "Move the buffer to the left" })
vim.keymap.set("n", "<C-A-j>", "<C-w>J", { desc = "Move the buffer to the bottom" })
vim.keymap.set("n", "<C-A-k>", "<C-w>K", { desc = "Move the buffer to the top" })
vim.keymap.set("n", "<C-A-l>", "<C-w>L", { desc = "Move the buffer to the right" })
-- Move the selection up and down
-- https://github.com/ThePrimeagen/init.lua/blob/e148c2cd/lua/theprimeagen/remap.lua#L5
vim.keymap.set("v", "J", [[:m ">+1<CR>gv=gv]])
vim.keymap.set("v", "K", [[:m "<-2<CR>gv=gv]])
-- Don"t move the cursor when I do a `J`
-- https://github.com/ThePrimeagen/init.lua/blob/e148c2cd/lua/theprimeagen/remap.lua#L8
vim.keymap.set("n", "J", "mzJ`z")

View File

@ -0,0 +1,25 @@
-- Install lazy.nvim
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",
"--branch=stable",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
-- Import the plugins from the "plugins/" directory
spec = { import = "plugins" },
-- Don't notify every time a plugin file changes
change_detection = { notify = false },
-- Check for plugins update
checker = { enabled = true },
})

View File

@ -0,0 +1,12 @@
return {
-- Color scheme
{
'catppuccin/nvim',
lazy = false,
priority = 1000,
name = 'catppuccin',
config = function()
vim.cmd.colorscheme('catppuccin-mocha')
end,
},
}