From cea7aa184b43c2a699f362fbfa681c03c097364c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ef=C4=8D=C3=ADk=20Luk=C3=A1=C5=A1?= Date: Wed, 17 Apr 2024 08:59:26 +0200 Subject: [PATCH] Custom neovim setup. --- init.lua | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 140 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 496f45b8..8863205a 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -190,6 +190,10 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Center cursor after moving half page +vim.keymap.set('n', '', 'zz', { desc = 'Center cursor after down half page' }) +vim.keymap.set('n', '', 'zz', { desc = 'Center cursor after down half up' }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -283,6 +287,8 @@ require('lazy').setup({ require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['h'] = { name = '[H]arpoon', _ = 'which_key_ignore' }, + ['l'] = { name = '[L]azy Git', _ = 'which_key_ignore' }, ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, @@ -402,6 +408,71 @@ require('lazy').setup({ end, }, + { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + + harpoon:setup() + + vim.keymap.set('n', 'ha', function() + harpoon:list():add() + end, { desc = '[A]dd to list' }) + vim.keymap.set('n', 'he', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = '[E]xplorer' }) + + vim.keymap.set('n', 'h1', function() + harpoon:list():select(1) + end, { desc = 'Switch to [1] mark' }) + vim.keymap.set('n', 'h2', function() + harpoon:list():select(2) + end, { desc = 'Switch to [2] mark' }) + vim.keymap.set('n', 'h3', function() + harpoon:list():select(3) + end, { desc = 'Switch to [3] mark' }) + vim.keymap.set('n', 'h4', function() + harpoon:list():select(4) + end, { desc = 'Switch to [4] mark' }) + + -- vim.keymap.set('n', '', function() + -- harpoon:list():replace_at(1) + -- end) + -- vim.keymap.set('n', '', function() + -- harpoon:list():replace_at(2) + -- end) + -- vim.keymap.set('n', '', function() + -- harpoon:list():replace_at(3) + -- end) + -- vim.keymap.set('n', '', function() + -- harpoon:list():replace_at(4) + -- end) + end, + }, + + { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + config = function() + require('copilot').setup { + suggestion = { + auto_trigger = true, + keymap = { + accept = '', + accept_word = false, + accept_line = false, + next = '', + prev = '', + dismiss = '', + }, + }, + } + end, + }, + { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { @@ -740,18 +811,52 @@ require('lazy').setup({ end, }, + { 'tjdevries/colorbuddy.nvim' }, + + { 'rose-pine/neovim', name = 'rose-pine' }, + + { + 'folke/tokyonight.nvim', + config = function() + require('tokyonight').setup { + -- your configuration comes here + -- or leave it empty to use the default settings + style = 'storm', -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day` + transparent = true, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = false }, + keywords = { italic = false }, + -- Background styles. Can be "dark", "transparent" or "normal" + sidebars = 'dark', -- style for sidebars, see below + floats = 'dark', -- style for floating windows + }, + } + end, + }, + { -- You can easily change to a different colorscheme. -- Change the name of the colorscheme plugin below, and then -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + 'catppuccin/nvim', + name = 'catpuccin', priority = 1000, -- Make sure to load this before all the other start plugins. init = function() + -- require('rose-pine').setup { + -- disable_background = true, + -- styles = { + -- italic = false, + -- }, + -- } + -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'catppuccin' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' @@ -798,6 +903,7 @@ require('lazy').setup({ -- Check out: https://github.com/echasnovski/mini.nvim end, }, + { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', @@ -829,6 +935,36 @@ require('lazy').setup({ end, }, + { + 'max397574/better-escape.nvim', + opts = { + mapping = { 'jk', 'kj' }, + timeout = vim.o.timeoutlen, + clear_empty_lines = false, + keys = '', + }, + }, + + { + 'kdheepak/lazygit.nvim', + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + -- optional for floating window border decoration + dependencies = { + 'nvim-lua/plenary.nvim', + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { 'lg', 'LazyGit', desc = 'LazyGit' }, + }, + }, + -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations.