mirror of
https://github.com/mikkelsvartveit/dotfiles.git
synced 2025-12-22 11:12:39 +00:00
215 lines
5.1 KiB
Lua
215 lines
5.1 KiB
Lua
-- Install lazy.nvim (plugin manager)
|
|
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",
|
|
"https://github.com/folke/lazy.nvim.git",
|
|
"--branch=stable", -- latest stable release
|
|
lazypath,
|
|
})
|
|
end
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
-- Install plugins
|
|
require("lazy").setup({
|
|
-- Color scheme
|
|
{
|
|
"catppuccin/nvim",
|
|
name = "catppuccin",
|
|
priority = 1000,
|
|
config = function(plugin)
|
|
vim.cmd.colorscheme "catppuccin-macchiato"
|
|
end
|
|
},
|
|
|
|
-- Easy commenting/uncommenting
|
|
{
|
|
"numToStr/Comment.nvim",
|
|
config = true,
|
|
},
|
|
|
|
-- Easy handling of surroundings
|
|
{
|
|
"tpope/vim-surround",
|
|
dependencies = {
|
|
"tpope/vim-repeat",
|
|
},
|
|
},
|
|
|
|
-- Auto-match brackets, quotes etc.
|
|
{
|
|
'windwp/nvim-autopairs',
|
|
event = "InsertEnter",
|
|
opts = {},
|
|
},
|
|
|
|
-- Supermaven AI assist
|
|
{
|
|
"supermaven-inc/supermaven-nvim",
|
|
config = function()
|
|
vim.api.nvim_create_user_command("CPE", "SupermavenStart", {})
|
|
vim.api.nvim_create_user_command("CPD", "SupermavenStop", {})
|
|
|
|
require("supermaven-nvim").setup({})
|
|
|
|
-- Disable on startup
|
|
vim.api.nvim_command("silent! SupermavenStop")
|
|
end,
|
|
},
|
|
|
|
-- Auto-restore session when opening Neovim
|
|
{
|
|
"rmagatti/auto-session",
|
|
opts = {
|
|
log_level = "error",
|
|
},
|
|
},
|
|
|
|
-- File explorer sidebar
|
|
{
|
|
"kyazdani42/nvim-tree.lua",
|
|
commit = "e14989c", -- newer versions break auto-session
|
|
dependencies = {
|
|
"kyazdani42/nvim-web-devicons",
|
|
},
|
|
opts = {
|
|
actions = {
|
|
open_file = {
|
|
quit_on_open = true,
|
|
},
|
|
},
|
|
update_focused_file = {
|
|
enable = true,
|
|
},
|
|
view = {
|
|
signcolumn = "auto",
|
|
adaptive_size = true,
|
|
mappings = {
|
|
list = {
|
|
{ key = "+", action = "cd" },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
init = function()
|
|
vim.g.loaded_netrw = 1
|
|
vim.g.loaded_netrwPlugin = 1
|
|
vim.keymap.set("n", "<leader>n", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
|
|
end,
|
|
},
|
|
|
|
-- Fuzzy finder for files, buffers, etc.
|
|
{
|
|
"nvim-telescope/telescope.nvim",
|
|
tag = "0.1.4",
|
|
dependencies = {
|
|
"nvim-lua/plenary.nvim",
|
|
{"nvim-telescope/telescope-fzf-native.nvim", build = "make"},
|
|
},
|
|
keys = {
|
|
{"<leader>p", "<cmd>Telescope find_files<CR>", noremap = true, silent = true},
|
|
{"<leader>f", "<cmd>Telescope live_grep<CR>", noremap = true, silent = true},
|
|
{"<leader>b", "<cmd>Telescope buffers<CR>", noremap = true, silent = true},
|
|
{"<leader>o", "<cmd>Telescope oldfiles<CR>", noremap = true, silent = true},
|
|
{"<leader>t", "<cmd>Telescope tags<CR>", noremap = true, silent = true},
|
|
{"<leader>c", "<cmd>Telescope commands<CR>", noremap = true, silent = true},
|
|
{"<leader>:", "<cmd>Telescope commands<CR>", noremap = true, silent = true},
|
|
{"<leader>d", "<cmd>Telescope git_status<CR>", noremap = true, silent = true},
|
|
{"<leader><leader>", "<cmd>Telescope resume<CR>", noremap = true, silent = true},
|
|
},
|
|
config = function()
|
|
require("telescope").setup({
|
|
defaults = {
|
|
mappings = {
|
|
i = {
|
|
["<esc>"] = require("telescope.actions").close, -- Disable normal mode
|
|
},
|
|
},
|
|
vimgrep_arguments = {
|
|
"rg",
|
|
"--color=never",
|
|
"--no-heading",
|
|
"--with-filename",
|
|
"--line-number",
|
|
"--column",
|
|
"--smart-case",
|
|
"--fixed-strings",
|
|
}
|
|
}
|
|
})
|
|
require("telescope").load_extension("fzf")
|
|
end,
|
|
},
|
|
|
|
-- Persistent terminal that can be toggled with a keybinding
|
|
{
|
|
"akinsho/nvim-toggleterm.lua",
|
|
tag = "2.4.0",
|
|
keys = "<C-j>",
|
|
config = function()
|
|
require("toggleterm").setup({
|
|
hide_numbers = true,
|
|
direction = 'float',
|
|
open_mapping = [[<C-j>]],
|
|
shell = 'fish',
|
|
})
|
|
end,
|
|
},
|
|
|
|
-- Run code with a keybinding
|
|
{
|
|
"CRAG666/code_runner.nvim",
|
|
cmd = "RunCode",
|
|
dependencies = {
|
|
"akinsho/nvim-toggleterm.lua"
|
|
},
|
|
opts = {
|
|
mode = "toggleterm",
|
|
filetype = {
|
|
python = "python3",
|
|
javascript = "node",
|
|
typescript = "ts-node --esm",
|
|
c = "gcc -o main % && ./main",
|
|
go = "go run",
|
|
},
|
|
},
|
|
init = function()
|
|
vim.keymap.set("n", "<leader><CR>", ":RunCode<CR>", { noremap = true })
|
|
end,
|
|
},
|
|
|
|
-- Live Markdown preview in browser
|
|
{
|
|
"iamcco/markdown-preview.nvim",
|
|
build = "cd app && npm install",
|
|
ft = "markdown",
|
|
init = function()
|
|
vim.g.mkdp_auto_close = 0
|
|
end,
|
|
},
|
|
|
|
-- Git integration - show modified lines next to line numbers
|
|
{
|
|
"lewis6991/gitsigns.nvim",
|
|
config = function()
|
|
require("gitsigns").setup()
|
|
require("scrollbar.handlers.gitsigns").setup()
|
|
end,
|
|
},
|
|
|
|
-- VSCode-like scrollbar with Git and diagnostic markers
|
|
{
|
|
"petertriho/nvim-scrollbar",
|
|
config = true,
|
|
},
|
|
|
|
-- Smooth scrolling
|
|
{
|
|
"karb94/neoscroll.nvim",
|
|
opts = {
|
|
easing_function = "sine",
|
|
}
|
|
},
|
|
})
|