diff --git a/README.md b/README.md index 7c62e907134..034006caa9a 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,7 @@ sudo mkdir -p /opt/nvim-linux-x86_64 sudo chmod a+rX /opt/nvim-linux-x86_64 sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz -# make it available in /usr/local/bin, distro installs to /usr/bin +# make it available in /usr/local/bin, distro installs to /usr/bi? sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ ``` diff --git a/init.lua b/init.lua index aff5250e921..ded7611fdd2 100644 --- a/init.lua +++ b/init.lua @@ -26,9 +26,7 @@ What is Kickstart? Kickstart.nvim is a starting point for your own configuration. The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to + what your configuration is doing, and modify it to suit your nee Once you've done that, you can start exploring, configuring and tinkering to make Neovim your own! That might mean leaving Kickstart just the way it is for a while or immediately breaking it into modular pieces. It's up to you! @@ -97,6 +95,9 @@ do -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' + + -- I set this. + vim.keymap.set('n', 'op', vim.cmd.Ex, { desc = 'Opens netRW' }) -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = false @@ -966,12 +967,12 @@ do -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug' - -- require 'kickstart.plugins.indent_line' - -- require 'kickstart.plugins.lint' - -- require 'kickstart.plugins.autopairs' - -- require 'kickstart.plugins.neo-tree' - -- require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps + require 'kickstart.plugins.debug' + require 'kickstart.plugins.indent_line' + require 'kickstart.plugins.lint' + require 'kickstart.plugins.autopairs' + require 'kickstart.plugins.neo-tree' + require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps -- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- @@ -979,5 +980,63 @@ do -- require 'custom.plugins' end +local harpoon = require 'harpoon' + +-- REQUIRED +harpoon:setup {} +-- REQUIRED + +-- 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', '', function() + toggle_telescope(harpoon:list()) +end, { desc = 'Open harpoon window' }) + +vim.keymap.set('n', 'a', function() + harpoon:list():add() +end, { desc = 'Add file to harpoon list.' }) +vim.keymap.set('n', '', 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, { desc = 'Navigate to file at harpoon posistion 1' }) +vim.keymap.set('n', '2', function() + harpoon:list():select(2) +end, { desc = 'Navigate to file at harpoon posistion 2' }) +vim.keymap.set('n', '3', function() + harpoon:list():select(3) +end, { desc = 'Navigate to file at harpoon posistion 3' }) +vim.keymap.set('n', '4', function() + harpoon:list():select(4) +end, { desc = 'Navigate to file at harpoon posistion 4' }) + +-- Toggle previous & next buffers stored within Harpoon list +vim.keymap.set('n', '', function() + harpoon:list():prev() +end, { desc = 'Harpoon previous file' }) +vim.keymap.set('n', '', function() + harpoon:list():next() +end, { desc = 'Harpoon next file' }) + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et