diff --git a/init.lua b/init.lua index d669b1c9..8249eeca 100644 --- a/init.lua +++ b/init.lua @@ -1,42 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== - -Kickstart.nvim is *not* a distribution. - -Kickstart.nvim is a template 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 should start exploring, configuring and tinkering to - explore Neovim! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example: - - https://learnxinyminutes.com/docs/lua/ - - - And then you can explore or search through `:help lua-guide` - - https://neovim.io/doc/user/lua-guide.html - - -Kickstart Guide: - -I have left several `:help X` comments throughout the init.lua -You should run that command and read that help section for more information. - -In addition, I have some `NOTE:` items throughout the file. -These are for you, the reader to help understand what is happening. Feel free to delete -them once you know what you're doing, but they should serve as a guide for when you -are first encountering a few different constructs in your nvim config. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now :) ---]] -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) @@ -373,11 +334,13 @@ end, { desc = '[/] Fuzzily search in current buffer' }) vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) +-- vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) +vim.keymap.set('n', 'sh', require("harpoon.ui").toggle_quick_menu, { desc = '[S]earch [H]arpoon' }) + -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` @@ -448,12 +411,12 @@ require('nvim-treesitter.configs').setup { -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) +vim.keymap.set('n', 'dm', vim.diagnostic.open_float, { desc = 'Open floating [d]iagnostic [m]essage' }) +vim.keymap.set('n', 'dl', vim.diagnostic.setloclist, { desc = 'Open [d]iagnostics [l]ist' }) -- Toggle diagnostics require('toggle_lsp_diagnostics').init() -vim.keymap.set('n', 'td', ':ToggleDiag', { desc = '[T]oggle [d]iagnostics' }); +vim.keymap.set('n', 'dt', ':ToggleDiag', { desc = '[d]iagnostics [T]oggle' }); --vim.keymap.set('n', 'td', require('toggle_lsp_diagnostics')) -- [[ Configure LSP ]] @@ -473,15 +436,15 @@ local on_attach = function(_, bufnr) vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) end - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + -- nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + -- nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') + -- nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + -- nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') -- See `:help K` for why this keymap nmap('K', vim.lsp.buf.hover, 'Hover Documentation') @@ -489,11 +452,13 @@ local on_attach = function(_, bufnr) -- Lesser used LSP functionality nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + --[[ nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') nmap('wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, '[W]orkspace [L]ist Folders') + --]] -- Create a command `:Format` local to the LSP buffer vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) @@ -525,6 +490,21 @@ local servers = { }, } +-- harpoon +vim.keymap.set('n', 'm', require("harpoon.mark").add_file, { desc = '[M]ark' }); +vim.keymap.set('n', 'q', function() + require("harpoon.ui").nav_file(1) +end, { desc = '[q] Harpoon -> file number 1' }) +vim.keymap.set('n', 'w', function() + require("harpoon.ui").nav_file(2) +end, { desc = '[q] Harpoon -> file number 2' }) +vim.keymap.set('n', 'e', function() + require("harpoon.ui").nav_file(3) +end, { desc = '[q] Harpoon -> file number 3' }) +vim.keymap.set('n', 'r', function() + require("harpoon.ui").nav_file(4) +end, { desc = '[q] Harpoon -> file number 4' }) + -- Setup neovim lua configuration require('neodev').setup() @@ -599,7 +579,6 @@ cmp.setup { } -- MY KEYMAPS -- - -- exit insert mode with lk vim.keymap.set("i", "lk", "") @@ -609,6 +588,10 @@ vim.keymap.set("n", "x", vim.cmd.Ex) -- open fugitive in vertical split vim.keymap.set('n', 'gs', ':vertical G') +-- MY SETTINGS -- +vim.opt.scrolloff = 10 + + -- transparent bg --[[ require("transparent").setup({ -- Optional, you don't have to run setup.