diff --git a/init.lua b/init.lua index ea86b792..ce18e71c 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 and selected in the terminal -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' @@ -230,7 +230,6 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following -- keys can be used to configure plugin behavior/loading/etc. @@ -607,7 +606,7 @@ require('lazy').setup({ local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -829,13 +828,13 @@ require('lazy').setup({ -- 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', + 'olimorris/onedarkpro.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. init = function() -- 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 'onedark' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' @@ -907,7 +906,18 @@ require('lazy').setup({ -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, - + -- neoscroll + { + 'karb94/neoscroll.nvim', + config = function() + require('neoscroll').setup() + end, + }, + { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim' }, + }, -- 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. @@ -954,3 +964,65 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +-- + +-- Harpoon keymaps +local harpoon = require 'harpoon' +harpoon:setup() + +vim.keymap.set('n', 'a', function() + harpoon:list():add() +end, { desc = 'Add file to harpoon list' }) +vim.keymap.set('n', 'h', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) +end, { desc = 'Toggle harpoon quick menu' }) +vim.keymap.set('n', '1', function() + harpoon:list():select(1) +end) +vim.keymap.set('n', '2', function() + harpoon:list():select(2) +end) +vim.keymap.set('n', '3', function() + harpoon:list():select(3) +end) +vim.keymap.set('n', '4', function() + harpoon:list():select(4) +end) +vim.keymap.set('n', '5', function() + harpoon:list():select(5) +end) + +-- Toggle previous & next buffers stored within Harpoon list +vim.keymap.set('n', '', function() + harpoon:list():prev() +end) +vim.keymap.set('n', '', function() + harpoon:list():next() +end) + +local harpoon = require 'harpoon' +harpoon:setup {} + +-- basic telescope configuration +local conf = require('telescope.config').values +local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Harpoon', + finder = require('telescope.finders').new_table { + results = file_paths, + }, + previewer = conf.file_previewer {}, + sorter = conf.generic_sorter {}, + }) + :find() +end + +vim.keymap.set('n', 'h', function() + toggle_telescope(harpoon:list()) +end, { desc = 'Open harpoon window' })